Jump to content
  • 0

DamageFunction in relation to A_Explode : [ZScript]


Wo0p

Question

Hey forums!

 

Right so. In trying to overcome the large damage range in default Doom damage calculations I'm using DamageFunction a lot. But when it comes to explosion damage does DamageFunction control the damage of A_Explode?

 

Because there's another property called ExplosionDamage in the default block of a class, and it confuses me. Or does ExplosionDamage work like DamageFunction in A_Explode and so I should use that to avoid randomised damage?

 

Class ShaperSlam : Actor
{
	Default
	{
	+NOBLOCKMAP
	+MISSILE
	Radius 2;
	Height 2;
	Damagetype "Blunt";
	//DamageFunction 60;
	//ExplosionDamage 60;
	}
	States    
	{
		Spawn:
		TNT1 A 0;
		TNT1 A 0 A_Explode(random(60,65),118,0);
		Stop;
	}
}

 

Edited by Wo0p

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 0

Explosion damage is not engine-randomised. Its damage only depends on its first parameters and on your distance from explosion.

Your code explosion should do 60-65 damage (in center of explosion).

Edited by jaeden

Share this post


Link to post
  • 1

DamageFunction has no effect on A_Explode.

ExplosionDamage has effect only if the first parameter of A_Explode is less than 0.

 

 

Share this post


Link to post
  • 1

The damage from the explosion is not randomized. It is only dependent on axis distance from the center of the explosion, as you can read here: https://doomwiki.org/wiki/Blast_damage

 

Now if you're talking about a rocket for example, then there's the direct impact component to the total damage dealt, and that one is randomized, but it is a separate damage value that is inflicted separately (and first). That's why sometimes you can hit a zombie with a rocket and the zombie doesn't gib, while the zombies next to him do gib. It's because the zombie you hit directly was killed by the impact damage, dealt before the explosion damage, and did not receive enough damage to go through the gib death.

 

If you want the blast damage to always inflict a consistent value, you can in GZDoom use the fulldamagedistance parameter and set it to the same value as the distance parameter.

https://zdoom.org/wiki/A_Explode

Share this post


Link to post
  • 0
13 minutes ago, jaeden said:

DamageFunction has no effect on A_Explode.

ExplosionDamage has effect only if the first parameter of A_Explode is less than 0.

 

 

 

Do you know if there's any way to avoid the engine-randomised damage with A_Explode? Because I like randomised damage, but the default range is far too large for my taste.

Share this post


Link to post
  • 0
1 minute ago, jaeden said:

Explosion damage is not engine-randomised. Its damage only depends on its first parameters and on your distance from explosion.

Your code explosion should do 60-65 damage (in center of explosion).

 

Ahhh ok! Thanks a bunch, that's the answer I needed :)

Share this post


Link to post
  • 0
26 minutes ago, Gez said:

The damage from the explosion is not randomized. It is only dependent on axis distance from the center of the explosion, as you can read here: https://doomwiki.org/wiki/Blast_damage

 

Now if you're talking about a rocket for example, then there's the direct impact component to the total damage dealt, and that one is randomized, but it is a separate damage value that is inflicted separately (and first). That's why sometimes you can hit a zombie with a rocket and the zombie doesn't gib, while the zombies next to him do gib. It's because the zombie you hit directly was killed by the impact damage, dealt before the explosion damage, and did not receive enough damage to go through the gib death.

 

If you want the blast damage to always inflict a consistent value, you can in GZDoom use the fulldamagedistance parameter and set it to the same value as the distance parameter.

https://zdoom.org/wiki/A_Explode

 

Thanks Gez for the detailed answer :)

I usually don't look at the Doomwiki when I code, but maybe I should incorporate that into my routine. Seems like it has a bit different info than the Zdoom wiki. 

Share this post


Link to post
  • 0
2 hours ago, Wo0p said:

I usually don't look at the Doomwiki when I code, but maybe I should incorporate that into my routine. Seems like it has a bit different info than the Zdoom wiki. 

 

Well, Doomwiki is about Doom in general, while ZDoom-wiki is specific to Z- and derived ports. Doomwiki has more information about behavior from the original engine, such as how damage is calculated. It is helpful to read up on even if you are not doing vanilla mods, since a lot of that behavior is emulated in these actions or at least considered the baseline.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...