Page 1 of 1

Some misbehaviors of A_Explode

PostPosted: Fri Feb 08, 2019 11:11 pm
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 allExpand view
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 allExpand view
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 allExpand view
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.

Re: Some misbehaviors of A_Explode

PostPosted: Fri Feb 08, 2019 11:20 pm
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 allExpand view
TNT1 A 0 A_Explode(30, 41, 1, XF_NOTMISSILE, XF_EXPLICITDAMAGETYPE, false, 41, "None", "Acid")

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 12:43 am
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 allExpand view
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 allExpand view
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 allExpand view
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.

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 4:17 am
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 allExpand view
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.

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 4:40 am
by _mental_
Post a complete runnable sample please.

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 5:18 am
by Kzer-Za
Code: Select allExpand view
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
  }
}

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 6:01 am
by _mental_
A_Explode works for me in both cases. How do you test that it doesn't work from Pain state?

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 7:35 am
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...

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 7:57 am
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:

Re: Some misbehaviors of A_Explode

PostPosted: Sat Feb 09, 2019 12:47 pm
by Kzer-Za
Thanks for the explanation!