Some misbehaviors of A_Explode

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Some misbehaviors of A_Explode

Post by Kzer-Za »

First, it takes not more than 9 arguments. I don't know if it is a bug, but at least it is not mentioned here: https://zdoom.org/wiki/A_Explode. So you can't, e.g. specify a third flag (in addition to the two that are given) in this:

Code: Select all

A_Explode(50, 81, 1, XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE, false, 41, "None", "Acid")
Second, with the same code: the third argument (int flags) seems to miscount. If I give "1" in the code above, everything works. If I give "2" (I tried it first, since I give two flags: XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE), the damage is not dealt.

Third, fulldamageradius does not seem to work as described: "The area within which full damage is inflicted". In my experience it just significantly increases damage, but the damage dealt still drops with the distance from the center. I created a projectile that has A_Explode, and if I shoot it in the wall standing right next to it with this code:

Code: Select all

TNT1 A 0 A_Explode(50,64,1, XF_HURTSOURCE, false);
then it deals exactly 50 damage, as it should. If I change the code to this:

Code: Select all

TNT1 A 0 A_Explode(50,64,1, XF_HURTSOURCE, false, 64);
then I die even if I have 300 hitpoints, if I stand next to the wall. But if I step out from the wall, the damage gradually decreases.
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Some misbehaviors of A_Explode

Post by Kzer-Za »

Fourth: If I place the first piece of code on a monster, it works if I place it in it's death state. But it doesn't if I place it in its pain state:

Code: Select all

TNT1 A 0 A_Explode(30, 41, 1, XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE, false, 41, "None", "Acid")
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Some misbehaviors of A_Explode

Post by Gez »

Kzer-Za wrote:First, it takes not more than 9 arguments. I don't know if it is a bug, but at least it is not mentioned here: https://zdoom.org/wiki/A_Explode. So you can't, e.g. specify a third flag (in addition to the two that are given) in this:

Code: Select all

A_Explode(50, 81, 1, XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE, false, 41, "None", "Acid")
Flags are not supposed to be given as separate arguments. You have to combine them with the | operator if you want to specify several flags.

Here what you're doing is that you pass these values to the parameters:
  • damage: 50
  • radius: 81
  • flags: 1
  • alert: XF_NOTMISSILE
  • fulldamageradius: XF_EXPLICITDAMAGETYPE
  • nails: false
  • naildamage: 41
  • pufftype: None
  • damagetype: Acid
Kzer-Za wrote:Second, with the same code: the third argument (int flags) seems to miscount. If I give "1" in the code above, everything works. If I give "2" (I tried it first, since I give two flags: XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE), the damage is not dealt.
This is because you have misunderstood how flags work. You do not give a count, then each flag as a separate parameter: you give the flags directly, combining them into a single parameter with |. For example:
A_Explode(50, 81, XF_NOTMISSILE|XF_EXPLICITDAMAGETYPE, false, 41, false, 0, "None", "Acid")
Kzer-Za wrote:Third, fulldamageradius does not seem to work as described: "The area within which full damage is inflicted". In my experience it just significantly increases damage, but the damage dealt still drops with the distance from the center. I created a projectile that has A_Explode, and if I shoot it in the wall standing right next to it with this code:

Code: Select all

TNT1 A 0 A_Explode(50,64,1, XF_HURTSOURCE, false);
then it deals exactly 50 damage, as it should. If I change the code to this:

Code: Select all

TNT1 A 0 A_Explode(50,64,1, XF_HURTSOURCE, false, 64);
then I die even if I have 300 hitpoints, if I stand next to the wall. But if I step out from the wall, the damage gradually decreases.
Again, same confusion. Here you pass those values to the parameters:
  • damage: 50
  • radius: 64
  • flags: 1
  • alert: XF_NOTMISSILE
  • fulldamageradius: false
  • nails: 64
This is why you don't get the behavior you're expecting. You did not actually specify a fulldamageradius greater than 0 ("false" is worth zero when interpreted as a numerical value); and you're shooting 64 nails from the explosion so if you're standing right next to a wall you get a lot of hitscan damage from these nails in addition to explosion damage.
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Some misbehaviors of A_Explode

Post by Kzer-Za »

Oh, my bad! From the "int flags" I got the impression that you have to give the number (integer) of flags you are going to set.

But the issue with A_Explode not working on the pain state still stands. Now this code seems to be correct, right?

Code: Select all

TNT1 A 0 A_Explode(30, 41, XF_NOTMISSILE | XF_EXPLICITDAMAGETYPE, false, 41, 0, 0, "None", "Acid")
It works in the death state when I copy-paste it there, but not in the pain state. Changing DamageFactor "Acid" of the monster itself (I thought, maybe it somehow affects that) has no effect.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Some misbehaviors of A_Explode

Post by _mental_ »

Post a complete runnable sample please.
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Some misbehaviors of A_Explode

Post by Kzer-Za »

Code: Select all

ACTOR TempClink : Clink replaces Clink
{
	PainChance 256 // 128
	DamageFactor "Acid", 0
	States
  {
  Spawn:
    CLNK AB 10 A_Look
    Loop
  See:
    CLNK ABCD 3 A_Chase
    Loop
  Melee:
    CLNK E 5 A_FaceTarget
    CLNK F 4 A_FaceTarget
    CLNK G 7 A_CustomMeleeAttack(random[ClinkAttack](3,9), "clink/attack", "clink/attack")
    Goto See
  Pain:
    CLNK H 3
    
    TNT1 A 0 A_Explode(30, 41, XF_NOTMISSILE | XF_EXPLICITDAMAGETYPE, false, 41, 0, 0, "None", "Acid")
    
    CLNK H 3 A_Pain
    Goto See
  Death:
    CLNK IJ 6
    CLNK K 5 A_Scream
    
    TNT1 A 0 A_Explode(30, 41, XF_NOTMISSILE | XF_EXPLICITDAMAGETYPE, false, 41, 0, 0, "None", "Acid")
    
    CLNK L 5 A_NoBlocking
    CLNK MN 5
    CLNK O -1
    Stop
  }
}
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Some misbehaviors of A_Explode

Post by _mental_ »

A_Explode works for me in both cases. How do you test that it doesn't work from Pain state?
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Some misbehaviors of A_Explode

Post by Kzer-Za »

Finally found out what was wrong. I was spawning the wrong Clink the whole time! Not TempClink, but TMPClink, which inherits everything from TempClink but has painthreshold. (Palmface) I hope that will teach me to be more careful in the future...
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Some misbehaviors of A_Explode

Post by D2JK »

Oh, my bad! From the "int flags" I got the impression that you have to give the number (integer) of flags you are going to set.
Internally, the flags are ints - the XF_SOMETHING you are seeing is just an alias to a certain integer. You can enter an integer directly in this field, if you know the values behind the aliases.

Fictional example:
Spoiler:
Kzer-Za
Posts: 509
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Some misbehaviors of A_Explode

Post by Kzer-Za »

Thanks for the explanation!
Post Reply

Return to “Closed Bugs [GZDoom]”