[DECORATE] (and maybe ACS) Is there a way to un-do PoisonDamage?

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

[DECORATE] (and maybe ACS) Is there a way to un-do PoisonDamage?

#1

Post by FranckyFox2468 » Mon Dec 25, 2017 5:46 am

Like so far there only seems to be way to temporarily stop it but only to have it continue afterwards, but question is, is there a way to just stop a poison damage or poison damage of a certain type? Like alltogheter? Cause i've been trying to work around getting damage over time done via hacks and ACS and it has always proven to be unefficient or an absolute pain in the arse that never works.

Its either suicide incuding (on the victim, don't worry) or hacky stuff im not even sure that works. I was recommended to use DamageActor but my attempts to get it to work while getting inventory or making puffs execute the ACS has not worked whatsoever and im really running out of ideas... i just want damage over time i have actual control upon.

If you want to see my last attempt, i was trying to make puffs that would be used by rails that executed an ACS but absolutely nothing works:

Code: Select all

ACTOR FirePuff2
{
  +PUFFONACTORS
  +PUFFGETSOWNER
  +HITTRACER
  +MTHRUSPECIES
  States
  {
  Spawn: 
	TNT1 A 0 nodelay A_JumpIfInventory("FiredUp", 1, "OnFire",  AAPTR_TRACER)
	TNT1 A 0 A_GiveInventory ("FiredUp", 1, AAPTR_TRACER)
	TNT1 A 0
	TNT1 A 1 ACS_NamedExecuteAlways("Afterburn", 0)
	stop
	OnFire:
	TNT1 A 1 A_GiveInventory ("FiredUp", 1, AAPTR_TRACER)
    Stop
	
  }
} 

ACTOR FiredUp : PowerRegeneration ///this is used as a timer, an inventory that fades when it expires
{
  //inventory.maxamount 0
  Powerup.Duration -5
  Powerup.Strength 0
}

Code: Select all

script "Afterburn" (void)
{
  int AfterBID = UniqueTID();
  Thing_ChangeTID(0, AfterBID);
  SetActivator(0, AAPTR_TRACER);
  Print(s:"Fire it up baby!");
  if(!!Checkinventory("FiredUp"))
  {
  SetActivator(AfterBID);
  DamageActor(0, AAPTR_TRACER, 0, AAPTR_TARGET, 10, "fire");
  Delay(15);
  restart;
  }
  else
	terminate;
}

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#2

Post by Empyre » Mon Dec 25, 2017 6:56 pm

Why do you have if(!!Checkinventory("FiredUp")) instead of if(Checkinventory("FiredUp"))?

As an experiment, try PowerRegeneration with a negative Powerup.Strength so it can do the damage.
"For the world is hollow, and I have touched the sky."

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#3

Post by FranckyFox2468 » Mon Dec 25, 2017 7:06 pm

Empyre wrote:
Mon Dec 25, 2017 6:56 pm
Why do you have if(!!Checkinventory("FiredUp")) instead of if(Checkinventory("FiredUp"))?

As an experiment, try PowerRegeneration with a negative Powerup.Strength so it can do the damage.
Just tried both, Neither does anything.

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#4

Post by jdagenet » Mon Dec 25, 2017 11:53 pm

The poison affect can be recreated in ACS quite easily actually:
Spoiler: (Open)

Code: Select all

script "SC_POISONDAMAGE" (int amount)
{
	while (GetActorProperty(0, APROP_HEALTH) > 0 &&
			amount > 0)
	{
		Thing_Damage(0, 1, 0);
		Delay(6);
		amount--;
	}
}
There's several things you can add or modify in this script, but this is basically the equivalent of the hard coded poison damage.
Last edited by jdagenet on Tue Dec 26, 2017 11:07 pm, edited 1 time in total.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#5

Post by FranckyFox2468 » Tue Dec 26, 2017 2:37 am

jdagenet wrote:
Mon Dec 25, 2017 11:53 pm
The poison affect can be recreated in ACS quite easily actually:
Spoiler: (Open)

Code: Select all

script "SC_POISONDAMAGE (int amount)"
{
	while (GetActorProperty(0, APROP_HEALTH) > 0 &&
			amount > 0)
	{
		Thing_Damage(0, 1, 0);
		Delay(6);
		amount--;
	}
}
There's several things you can add or modify in this script, but this is basically the equivalent of the hard coded poison damage.
This seems a little vague. Like do i simply run this on the puff/projectile? Will it get its owner when it does a kill or will it count as a suicide? and what does SC_Poisondamage does?

EDIT: Not sure using thing_damage is a good idea cause even if its inflicted by an enemy, the player in a DM centered game mode will get -1 on their score from dying to it.

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#6

Post by jdagenet » Tue Dec 26, 2017 11:31 pm

Well yeah, you'd need to incorporate a way to make sure that whoever fired the projectile that's going to trigger the script and deal damage is the activator of said script so that way frags are rewarded accordingly. It'll require a set range of TID's assigned to players so that way you can refer to the owner of the projectile and refer back to whoever it hit, etc, but Thing_Damage will work if you handle the pointers correctly.

EDIT: Not sure if I forgot or didn't know this function existed, but DamageActor might save you excess work regarding the pointers and TID's, stuff like that.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#7

Post by FranckyFox2468 » Wed Dec 27, 2017 12:36 am

jdagenet wrote:
Tue Dec 26, 2017 11:31 pm
Well yeah, you'd need to incorporate a way to make sure that whoever fired the projectile that's going to trigger the script and deal damage is the activator of said script so that way frags are rewarded accordingly. It'll require a set range of TID's assigned to players so that way you can refer to the owner of the projectile and refer back to whoever it hit, etc, but Thing_Damage will work if you handle the pointers correctly.

EDIT: Not sure if I forgot or didn't know this function existed, but DamageActor might save you excess work regarding the pointers and TID's, stuff like that.
I actually been fidling around with that since last night and i dunno if its because its a bug or if because it doesn't work in zandronum yet but it doesn't do anything despite giving no error and not telling me the line doesn't exist yet. Yet in GZdoom it works like a charm so i have no idea of what is going on in that regard and it gets severly annoying. I did report it in the tracker just in case, i certainly hope its a bug that can be fixed or else my work will be much harder...

Also, while your solution sounds neat would it mean having to assign a TID to the affected enemies as well? Cause this is exactly what i am trying to avoid. Unless unique TIDs works cause i feel like specific TIDs will get in the way of monsters with specific assigned TIDs when i make a map.

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

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#8

Post by jdagenet » Sat Dec 30, 2017 4:09 am

You don't have to use constant TID's, you can acquire an actor's TID in ACS easily. If an actor has a constant TID for map purposes like you said then you can just return that TID and use it as reference in your code. If the actor doesn't already have a TID you can do something like this:
Spoiler: (Open)

Code: Select all

int OriginalTID = ActivatorTID(); // [JD] Get it's TID.
	int TempTID = UniqueTID(); // [JD] Allot a TID.
	
	// [JD] If the actor doesn't have a TID then assign one we can refer back to.
	if (!OriginalTID)
		Thing_ChangeTID(0, TempTID);
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#9

Post by FranckyFox2468 » Sat Dec 30, 2017 6:25 pm

jdagenet wrote:
Sat Dec 30, 2017 4:09 am
You don't have to use constant TID's, you can acquire an actor's TID in ACS easily. If an actor has a constant TID for map purposes like you said then you can just return that TID and use it as reference in your code. If the actor doesn't already have a TID you can do something like this:
Spoiler: (Open)

Code: Select all

int OriginalTID = ActivatorTID(); // [JD] Get it's TID.
	int TempTID = UniqueTID(); // [JD] Allot a TID.
	
	// [JD] If the actor doesn't have a TID then assign one we can refer back to.
	if (!OriginalTID)
		Thing_ChangeTID(0, TempTID);
I'm not exactly sure what is your code doing... if i understand, it gives it a temporary unique TID then gives it its old TID back afterwards?
But then if the monster already has a TID i just ignore this or... and how do i even check if it already has a TID? And won't my code need to assign a specific TID for...
And how do i get the killer to make the TID for...

Oh my god this is getting so confusing... And on top of that my decorate-only solution, despite being the closest thing to functionning, is still fucking held back by something not available in zandro yet...

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#10

Post by jdagenet » Sat Dec 30, 2017 9:21 pm

Here have a look at this, I put in detailed comments for each part of the script:
Spoiler: (Open)

Code: Select all

	/* [JD] If the actor doesn't have a TID at the time this script is called
			then we'll use this variable to indicate that we need to return the
			TID back to zero to refrain from breaking anything. */
	bool ResetTID;

	// [JD] This is how we get the activator's TID.
	int MasterTID = ActivatorTID();
	
	/* [JD] If the activator doesn't have a TID then give him one.
			If the actor DOES already have a TID then this 'if' statement won't
			take place at all and the script will simply continue. */
	if (!MasterTID)
	{
		/* [JD] Store a random TID in a variable. If we don't store the TID in a
				variable then we won't be able to refer back to the actor. */
		int TempTID = UniqueTID();
		
		// [JD] Change the activator's TID to the stored TID we generated above.
		Thing_ChangeTID(0, TempTID);
		
		/* [JD] Tell the script we need to return the actor's TID back to zero
				once we're done with it. */
		ResetTID = true;
	}
	
	/* [JD] Now we're able to directly refer back to this actor by using
			'TempTID' as a TID argument in functions if the script had to change
			its TID. */
	
	/* [JD] Be sure that once you're finished dealing with the actor that you
			reset its TID if it needs to be reset at the end of the script. */
	if (ResetTID)
		Thing_ChangeTID(0, 0);
Be sure to play around with the script, get a good understanding of what exactly it's doing in-game. It's a fairly simple process, I just think you're getting confused when it comes to actors that need TID's given to them versus actors that already have TID's.

Also, the absence of DamageActor in Zandronum does not mean what you're trying to do can't be done in Zandronum, it will just require a bit more work to get it working in Zandronum without it. DamageActor is more or less a shortcut function that would save the user time by not having them shift actor pointers around to reward frags correctly and things like that. When it comes down to it, Thing_Damage and DamageActor do the exact same thing, only DamageActor gives you a bit more options in that one instance of the function.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#11

Post by Empyre » Sun Dec 31, 2017 2:50 am

I understand how if (!MasterTID) works, but FranckyFox might not. In Doom, all variables are integers. For a boolean, 0 is FALSE and anything else is TRUE. So, if MasterTID is 0, it is FALSE, so if (!MasterTID) is equivalent to if (MasterTID != 0).

If you are going to use TempTID to refer to the TID of the activator, shouldn't the if statement have an else in which you set TempTID = MasterTID?
"For the world is hollow, and I have touched the sky."

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#12

Post by jdagenet » Sun Dec 31, 2017 3:32 am

Empyre wrote:
Sun Dec 31, 2017 2:50 am
... so if (!MasterTID) is equivalent to if (MasterTID != 0).
No, if (!MasterTID) means if (MasterTID == 0). You have it backwards.
If you are going to use TempTID to refer to the TID of the activator, shouldn't the if statement have an else in which you set TempTID = MasterTID?
Yeah, it'd be more efficient to just do MasterTID = TempTID.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#13

Post by Empyre » Sun Dec 31, 2017 5:51 pm

jdagenet wrote:
Sun Dec 31, 2017 3:32 am
Empyre wrote:
Sun Dec 31, 2017 2:50 am
... so if (!MasterTID) is equivalent to if (MasterTID != 0).
No, if (!MasterTID) means if (MasterTID == 0). You have it backwards.
Of course it does! Well duh!

(That "Well duh!" was directed at myself for making such a silly mistake.)
"For the world is hollow, and I have touched the sky."

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#14

Post by FranckyFox2468 » Sun Dec 31, 2017 11:31 pm

jdagenet wrote:
Sat Dec 30, 2017 9:21 pm
Here have a look at this, I put in detailed comments for each part of the script:
Spoiler: (Open)

Code: Select all

	/* [JD] If the actor doesn't have a TID at the time this script is called
			then we'll use this variable to indicate that we need to return the
			TID back to zero to refrain from breaking anything. */
	bool ResetTID;

	// [JD] This is how we get the activator's TID.
	int MasterTID = ActivatorTID();
	
	/* [JD] If the activator doesn't have a TID then give him one.
			If the actor DOES already have a TID then this 'if' statement won't
			take place at all and the script will simply continue. */
	if (!MasterTID)
	{
		/* [JD] Store a random TID in a variable. If we don't store the TID in a
				variable then we won't be able to refer back to the actor. */
		int TempTID = UniqueTID();
		
		// [JD] Change the activator's TID to the stored TID we generated above.
		Thing_ChangeTID(0, TempTID);
		
		/* [JD] Tell the script we need to return the actor's TID back to zero
				once we're done with it. */
		ResetTID = true;
	}
	
	/* [JD] Now we're able to directly refer back to this actor by using
			'TempTID' as a TID argument in functions if the script had to change
			its TID. */
	
	/* [JD] Be sure that once you're finished dealing with the actor that you
			reset its TID if it needs to be reset at the end of the script. */
	if (ResetTID)
		Thing_ChangeTID(0, 0);
Be sure to play around with the script, get a good understanding of what exactly it's doing in-game. It's a fairly simple process, I just think you're getting confused when it comes to actors that need TID's given to them versus actors that already have TID's.

Also, the absence of DamageActor in Zandronum does not mean what you're trying to do can't be done in Zandronum, it will just require a bit more work to get it working in Zandronum without it. DamageActor is more or less a shortcut function that would save the user time by not having them shift actor pointers around to reward frags correctly and things like that. When it comes down to it, Thing_Damage and DamageActor do the exact same thing, only DamageActor gives you a bit more options in that one instance of the function.
If my decorate solution ends up messing up or being impratical ill be sure to have a look around yours. thanks.

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#15

Post by FranckyFox2468 » Wed Jan 03, 2018 4:53 am

jdagenet wrote:
Sat Dec 30, 2017 9:21 pm
Here have a look at this, I put in detailed comments for each part of the script:
Spoiler: (Open)

Code: Select all

	/* [JD] If the actor doesn't have a TID at the time this script is called
			then we'll use this variable to indicate that we need to return the
			TID back to zero to refrain from breaking anything. */
	bool ResetTID;

	// [JD] This is how we get the activator's TID.
	int MasterTID = ActivatorTID();
	
	/* [JD] If the activator doesn't have a TID then give him one.
			If the actor DOES already have a TID then this 'if' statement won't
			take place at all and the script will simply continue. */
	if (!MasterTID)
	{
		/* [JD] Store a random TID in a variable. If we don't store the TID in a
				variable then we won't be able to refer back to the actor. */
		int TempTID = UniqueTID();
		
		// [JD] Change the activator's TID to the stored TID we generated above.
		Thing_ChangeTID(0, TempTID);
		
		/* [JD] Tell the script we need to return the actor's TID back to zero
				once we're done with it. */
		ResetTID = true;
	}
	
	/* [JD] Now we're able to directly refer back to this actor by using
			'TempTID' as a TID argument in functions if the script had to change
			its TID. */
	
	/* [JD] Be sure that once you're finished dealing with the actor that you
			reset its TID if it needs to be reset at the end of the script. */
	if (ResetTID)
		Thing_ChangeTID(0, 0);
Be sure to play around with the script, get a good understanding of what exactly it's doing in-game. It's a fairly simple process, I just think you're getting confused when it comes to actors that need TID's given to them versus actors that already have TID's.

Also, the absence of DamageActor in Zandronum does not mean what you're trying to do can't be done in Zandronum, it will just require a bit more work to get it working in Zandronum without it. DamageActor is more or less a shortcut function that would save the user time by not having them shift actor pointers around to reward frags correctly and things like that. When it comes down to it, Thing_Damage and DamageActor do the exact same thing, only DamageActor gives you a bit more options in that one instance of the function.
I have a question, for something that applies a script every X ticks, do i need to go over that proceedur all over again? If so, won't it lag online games if many monsters/enemies has it running? Also i am starting to wish A_Explode could apply puffs without going all across the bloody room.

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#16

Post by Empyre » Wed Jan 03, 2018 7:46 am

Bullets or rails can apply puffs (even custom puffs) without having to cross the room first, or is that not what you meant?
"For the world is hollow, and I have touched the sky."

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

[DECORATE] Re: (and maybe ACS) Is there a way to un-do PoisonDamage?

#17

Post by FranckyFox2468 » Wed Jan 03, 2018 5:29 pm

Empyre wrote:
Wed Jan 03, 2018 7:46 am
Bullets or rails can apply puffs (even custom puffs) without having to cross the room first, or is that not what you meant?
No i know that but i was going into AoE territory and i realized that you cannot apply puffs with A_Explode, BFGSpray barely works in zandro and nails in a_explode goes all across the e-fin room. But guess ill use a cluster of rails in a 360 in the maintime. Also that only answers the secondary question.

Post Reply