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:
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:
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:
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:
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:
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
Posted: Sat Feb 09, 2019 3: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?
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.
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
Posted: Sat Feb 09, 2019 5: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
Posted: Sat Feb 09, 2019 6: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
Posted: Sat Feb 09, 2019 6: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:
(flag alias = decimal representation = binary representation)
The "|" operator compares values in binary form. For each bit, if a "1" is found in a value, the resulting value will also have "1" in that bit. If no value has a "1" in that bit, then the resulting value will have a "0" in that bit.
01001 is in binary form. In decimal form it equals 9.
This sort of system can be a bit cryptic when you first face it. The advantage is that you can present any sort of combination of flags with a single (positive) integer; each combination is going have only one resulting integer value.