[ACS] (Partly solved)Problem with afterburn/poison damage (help with acs_executealways)

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] (Partly solved)Problem with afterburn/poison damage (help with acs_executealways)

#1

Post by FranckyFox2468 » Sat Nov 18, 2017 6:56 am

EDIT: I managed to partially fix the issue. Figured at the "timeonly" part of the inventory i should add a "fail" state. But one problem remain, suicide. If a player or monster is killed by the inventory it is recognized as a self induced suicide and i would like to find a way to make it so the player or projectile that gave it is recognized as the killer.

Is there a way to straight remove poison damage? like with an item or something, not just blocking it? Because i've been tinkering with afterburn damage for a flamethrower and two options came to me:

1. If there isn't, i deal with poison/fire damage in a way where it cannot be nullified, even going underwater, and gets obnoxious very quickly.

2. This option i actually tried and if this doesn't work i could use help: Inventory based damage with more control of it. The problem with this alternative is that Acs_Execute always only works on one person at once. The problem with acs_executealways is that i can't figure a way to make it work properly. I did came up with a code but if a player dies from say damage, kill is not counter toward the killer and even with a script that checks if a certain inventory is owned BEFORE activating the afterburn damage, if the script is enabled at the very same tick, this rule is completely ignored.

So if you guys can help this would be appreciated. Here's the codes (intended to work both on monsters n players):

ACS:

Code: Select all

script "Afterburn2" (void)
{
  TakeInventory("AfterBurn", 1);
  Print(s:"Fire it up baby!");
  if(!!Checkinventory("FiredUp"))
  {
   Thing_Damage(0, 1);
   Delay(15);
   restart;
  }
  else
    //TakeInventory("afterburn", 1);
	//TakeInventory("firedup", 1);
    TakeInventory("AlreadyBurned", 1);
	terminate;
}

script "Afterburn" (void)
{
  if( !!Checkinventory("AlreadyBurned", 1))
  {
  terminate;
  }
  else
    GiveInventory("AlreadyBurned", 1);
    ACS_NamedExecuteAlways("Afterburn2", 0);
	terminate;
}
Decorate:

Code: Select all

ACTOR Afterburn : CustomInventory
{
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
-Invbar
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A 1
    stop
	Pickup:
	TNT1 A 1 A_JumpIfInventory("Alreadyburned", 1, "timeronly")
	TNT1 A 1 A_GiveInventory("FiredUp", 1)
	TNT1 A 1 ACS_NamedExecuteAlways("Afterburn")
	stop
	Timeronly:
	TNT1 A 1 A_GiveInventory("FiredUp", 1)
	stop
  }
}

ACTOR FiredUp : PowerRegeneration
{
  //inventory.maxamount 0
  Powerup.Duration -5
  Powerup.Strength 0
}

Actor Alreadyburned : Inventory
{
inventory.amount 1
inventory.maxamount 1
Inventory.InterHubAmount 1
 -Invbar 
 +Inventory.Undroppable 
 +Inventory.HubPower
}
I'm kinda tired AF at the moment of writting this so sorry if the code is a bit messy or there is things i wasn't aware of or didn't get right.
Last edited by FranckyFox2468 on Sat Dec 30, 2017 10:31 pm, edited 7 times in total.

User avatar
Komodo
 
Posts: 22
Joined: Thu Apr 27, 2017 3:00 pm

[ACS] Re: REMOVING poison damage?

#2

Post by Komodo » Sat Nov 18, 2017 2:40 pm

Use DamageActor instead of Thing_Damage to set the owner of the damage being done. And if I recall correctly all the frames in the Pickup state get executed at the same tick no matter what the frames duration is so the jumpif there is useless.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: REMOVING poison damage?

#3

Post by FranckyFox2468 » Sat Nov 18, 2017 4:12 pm

Komodo wrote:
Sat Nov 18, 2017 2:40 pm
Use DamageActor instead of Thing_Damage to set the owner of the damage being done. And if I recall correctly all the frames in the Pickup state get executed at the same tick no matter what the frames duration is so the jumpif there is useless.
So you're implying i should make an item that runs a script that checks if a script that executes another script that checks if another script can be ran? Cause wew...

An idea i had was to make the thing based on the "used" state with a maxinventory and take the inventory once the script actually lands but the issue is that it does not work on monsters at all, and once a player received the item once, the effect stops working once it fades out and someone tries to set you on fire again.

Also that doesn't answer how the hell will i be able to make the item recognize who gave it in the first place, or the spawner of the projectile who gave it. Unless there is a way to get the giver of the item?

User avatar
Komodo
 
Posts: 22
Joined: Thu Apr 27, 2017 3:00 pm

[ACS] Re: REMOVING poison damage?

#4

Post by Komodo » Tue Nov 21, 2017 2:14 pm

FranckyFox2468 wrote:
Sat Nov 18, 2017 4:12 pm
So you're implying i should make an item that runs a script that checks if a script that executes another script that checks if another script can be ran? Cause wew...
No DamageActor would have made things much easier then that. Too bad it doesn't work in Zandronum yet so we will have to rely on other ways to award the kill to who ever set the fire/poison.

And I actually managed to find a way to do it. The problem with it is that if the player killed him self by his own fire/poison it doesn't count as suicide.

ACS:

Code: Select all

#library "acs-code"
#include "zcommon.acs"
#Define TID_Player 1000
#Define TID_fire 1130000

script 4300 ENTER{
     Thing_ChangeTid(0, TID_Player + PlayerNumber());
	}

script 4301 RESPAWN{
     Thing_ChangeTid(TID_Player + PlayerNumber(), 0);
     Thing_ChangeTid(0, TID_Player + PlayerNumber());
	}

Script 222 (void){
	 int Owner = GetActorProperty(0,APROP_TracerTID);
	 
	 int burning = CheckInventory("burning");
	 
	 if (SetActivatortoTarget(0)){
		 
		 If(CheckInventory("Afterburn")){
			 
			 int target = ActivatorTID();
			 If(target == 0){
				 int TargetTID = UniqueTID();
				 Thing_ChangeTID(0, TargetTID);
				 target = TargetTID;
				 int test = ActivatorTID();
				}
				
			 If (CheckInventory("burning")){
				 GiveInventory("FiredUp",1); 
				}
				
			else{
				 GiveInventory("burning",1);
				 ACS_EXECUTEALWAYS(111,0,target,Owner,0);
				}
			 
			}
			
		}
	 
	}

Script 111 (int target, int Owner){
	 
	 GiveInventory("FiredUp",1);
	 
	 int newfire = Owner + TID_fire;
	 
	 While(CheckInventory("FiredUp")){
	     
		 SpawnSpotForced("onfire",target,newfire,0);
		 
		 SetActivator(newfire);
		 SetActorProperty(0,APROP_MasterTID,Owner);
		 
		 Delay(1); 
		 
		 SetActivator(target);
		 
		 Delay(10);
		}
		TakeInventory("burning",1);
		TakeInventory("Afterburn",1);	
	}
	
Script 555 (void){
	 int realowner = GetActorProperty(0,APROP_Health);
	 SetActorProperty(0,APROP_MasterTID,realowner);	 
	}
DECORATE:

Code: Select all

ACTOR Afterburn : Inventory
{
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
-Invbar
Inventory.MaxAmount 1
}

ACTOR FiredUp : PowerRegeneration
{
  //inventory.maxamount 0
  Powerup.Duration -5
  Powerup.Strength 0
}

Actor burning: Inventory
{
 Inventory.maxamount 1
}

ACTOR newRocket
{	
	+HitTarget
	health 100
	Radius 4
	Height 8
	Speed 40
	Projectile
	Damage (0)
	scale 1
  States
  {
  Spawn:
    MISL A 1
	MISL A 0 A_RearrangePointers(AAPTR_default,AAPTR_default,AAPTR_TARGET,0)
	MISL A 1 Bright
	Goto Spawn+2

	Death:
	MISL A 1
	MISL B 1 A_RadiusGive("Afterburn",60,RGF_MONSTERS|RGF_PLAYERS,1)
	MISL A 1 ACS_EXECUTEALways(222,0,0,0,0)
	stop
	
  }
}

ACTOR newRocket2: Rocket
{
	+HITTarget
	Damage 0
  States
  {
  Spawn:
    MISL A 1
	Goto Spawn
	
	Death:
	MISL A 1 Bright A_Takefromtarget("FiredUp",1)
	stop
  }
}

ACTOR newfireball
{
  Damage 3
  Radius 30
  Height 60
  Projectile
  Speed 200
  States
  {
  Spawn:
	TNT1 A 1 
	LOOP
	Death:
	TNT1 A 1 
	stop
  }
}

ACTOR newPistol: Pistol replaces Pistol
{
  States
  {
  Fire:
    PISG A 1 
    PISG B 0 A_FireCustomMissile("newRocket",0,0,0,0,0,0)
    PISG B 10 
    Goto Ready
	
  AltFire:
	PISG B 2 A_FireCustomMissile("newRocket2",0,0,0,0,0,0)
	Goto Ready
  }
}

ACTOR newMarine : DoomPlayer
{
  
  Player.StartItem "newPistol"
  Player.StartItem "Clip", 100
  Player.WeaponSlot 2, newPistol

}

ACtor onfire
	{
	 +NOGRAVITY
	 +FLOAT
	 +Ghost
	 +THRUGHOST
	 +THRUACTORS
	 -TELESTOMP
	 +THRUSPECIES
	 +SPECTRAL
	 +SHOOTABLE
	 +COUNTKILL
	 +SOLID
	 +CANPUSHWALLS
	 +CANUSEWALLS
	 +NOTARGET
	 +Friendly
	 Health 100
	 Radius 1
	 Monster
	 Height 1
	 scale  1
	 Mass 0
	 Speed 0
	 States
		{
		Spawn:
		 TNT1 AAAAA 0 
		 TNT1 A 1
		See:
		Missile:
		 TNT1 A 0 
		 TNT1 A 1 A_CustomMissile("newfireball",0,0,0,CMF_AIMDIRECTION)
		Death:
		 TNT1 A 1
		Stop
		}
	}



User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Problem with afterburn/poison damage (help with acs_executealways)

#5

Post by FranckyFox2468 » Wed Nov 22, 2017 7:46 pm

Doesn't exactly solves the problem because if it works on target assignements based on death, then how would you handle ripper projectiles? Not only that, if the afterburn assignement is done via the AOE then it still counts toward a suicide. And won't going with specific TID assignements based get things messy? Cause what if multiple players uses a piercing flamethrower on multiple enemies at once. Won't that make a laggy mess?

User avatar
Komodo
 
Posts: 22
Joined: Thu Apr 27, 2017 3:00 pm

[ACS] Re: Problem with afterburn/poison damage (help with acs_executealways)

#6

Post by Komodo » Thu Nov 23, 2017 9:19 am

FranckyFox2468 wrote:
Wed Nov 22, 2017 7:46 pm
Doesn't exactly solves the problem because if it works on target assignements based on death, then how would you handle ripper projectiles?
In case of ripper projectiles you can adjust the newRocket actor so that in the Spawn state the projectile A_GiveRadius two items, on is the Afterburn item which you have to make it activate Script 222 and the other item is the one which will carry the TID of the shooter so it can be used in Script 222. I assume you know how that can be done.

FranckyFox2468 wrote:
Wed Nov 22, 2017 7:46 pm
Not only that, if the afterburn assignement is done via the AOE then it still counts toward a suicide.
Does it? I tested it in a deathmatch with bots. When they die from the burn I get the kill and they don't get -1 kill.

FranckyFox2468 wrote:
Wed Nov 22, 2017 7:46 pm
And won't going with specific TID assignements based get things messy? Cause what if multiple players uses a piercing flamethrower on multiple enemies at once. Won't that make a laggy mess?
I actually don't know if it will lag or not. but yeah I just looked at the code again and you can safely remove the TID assignement lines and place the content of script 111 inside the "else" in script 222 and it should work fine.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: REMOVING poison damage?

#7

Post by FranckyFox2468 » Tue Dec 26, 2017 8:56 pm

Komodo wrote:
Sat Nov 18, 2017 2:40 pm
Use DamageActor instead of Thing_Damage to set the owner of the damage being done. And if I recall correctly all the frames in the Pickup state get executed at the same tick no matter what the frames duration is so the jumpif there is useless.
I tried DamageActor with some hacky TID assignement, it does literally nothing. No damage at all whatsoever. Atleast in Zandronum, it does work in GZDoom somehow tho... But yet there is no error as if the feature wasn't available or anything... uh... i'm lost.. Is it a bug or its just not part of zandro yet?

EDIT: Turns out DamageActor is not available in Zandro yet.

User avatar
Komodo
 
Posts: 22
Joined: Thu Apr 27, 2017 3:00 pm

[ACS] Re: REMOVING poison damage?

#8

Post by Komodo » Fri Dec 29, 2017 6:41 am

FranckyFox2468 wrote:
Tue Dec 26, 2017 8:56 pm
EDIT: Turns out DamageActor is not available in Zandro yet.
Yes I mentioned that above that is why I posted that messy code. And thanks to Jdagenet (from the other thread) all what was actually needed is setting the activator to the owner of the projectile before using Thing_damage to recognize the owner as the killer. So half of that code is not needed and thing_damage can be used instead.

Check the attached file. use Alt-fire to remove the poison by simply taking the FiredUp item from the target. The newRocket projectile is just one way to get the TIDs and execute the script on the target so if you want you can just adjust it or use any other technique to achieve something similar.
You do not have the required permissions to view the files attached to this post.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: REMOVING poison damage?

#9

Post by FranckyFox2468 » Sat Dec 30, 2017 3:00 am

Komodo wrote:
Fri Dec 29, 2017 6:41 am
FranckyFox2468 wrote:
Tue Dec 26, 2017 8:56 pm
EDIT: Turns out DamageActor is not available in Zandro yet.
Yes I mentioned that above that is why I posted that messy code. And thanks to Jdagenet (from the other thread) all what was actually needed is setting the activator to the owner of the projectile before using Thing_damage to recognize the owner as the killer. So half of that code is not needed and thing_damage can be used instead.

Check the attached file. use Alt-fire to remove the poison by simply taking the FiredUp item from the target. The newRocket projectile is just one way to get the TIDs and execute the script on the target so if you want you can just adjust it or use any other technique to achieve something similar.
And on that other thread i literally mentionned i wanted to avoid giving TIDs to foe cause it will get messy with foes with specific TIDs in maps. Regardless i think i managed to work something out with barely any ACS, involving sticking a projectile to a tracer with a_warp.

Post Reply