A_Detonate takes DamageType into consideration

Moderator: GZDoom Developers

User avatar
Kyle873
Posts: 667
Joined: Thu Jun 28, 2012 11:48 am
Location: Ontario, Canada

A_Detonate takes DamageType into consideration

Post by Kyle873 »

So I was making some different kinds of barrels that do different types of damage, but I'm finding it difficult to do so because there's no code pointers or methods of attack that allow you to perform a radius attack which deals DamageType damage. Not sure how trivial this would be to implement, but it'd be pretty useful nonetheless.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_Detonate takes DamageType into consideration

Post by Gez »

Give a DamageType to the barrels themselves.
User avatar
Kyle873
Posts: 667
Joined: Thu Jun 28, 2012 11:48 am
Location: Ontario, Canada

Re: A_Detonate takes DamageType into consideration

Post by Kyle873 »

Already done that. It appears to have no effect.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: A_Detonate takes DamageType into consideration

Post by XutaWoo »

Why are you using A_Detonate instead of A_Explode.

While it probably shouldn't make a different, you're using a deprecated function, so it's entirely a possibility.
User avatar
Kyle873
Posts: 667
Joined: Thu Jun 28, 2012 11:48 am
Location: Ontario, Canada

Re: A_Detonate takes DamageType into consideration

Post by Kyle873 »

There was nothing stating that A_Detonate was deprecated in the wiki, so I'll try A_Explode instead.

Edit:
Still not having the intended effect, here's what I've got in case I'm just messing up somehow:

Code: Select all

// Ice Barrel
actor IceBarrel : ExplosiveBarrel
{
	Damage 100
	DamageType Ice
	
	Translation Ice

	States
	{
	Death:
		BEXP A 5 BRIGHT
		BEXP B 5 BRIGHT A_Scream
		BEXP C 5 BRIGHT
		BEXP D 5 BRIGHT A_Explode
		BEXP E 10 BRIGHT
		BEXP E 1050 BRIGHT A_BarrelDestroy
		BEXP E 5 A_Respawn
		Wait
	}
}
In theory this should freeze and shatter the player, but it does not do this, even if the Damage puts the player below 0 Health.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: A_Detonate takes DamageType into consideration

Post by Blue Shadow »

This's how I got around this issue in a mod of mine:

Code: Select all

ACTOR NC_ExplosiveBarrel : ExplosiveBarrel replaces ExplosiveBarrel
{
  States
  {
  Death:
    BEXP A 5 Bright
    BEXP B 5 Bright A_Scream
    BEXP C 5 Bright
    BEXP D 5 Bright A_SpawnItemEx("NC_BarrelBoom", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
    BEXP E 10 Bright
    BEXP E 1050 Bright A_BarrelDestroy
    BEXP E 5 A_Respawn
    Wait
  }
}

ACTOR NC_BarrelBoom
{
  DamageType "Boom"
  DeathSound "world/barrelx"
  Height 34
  Obituary "$OB_BARREL"
  Projectile
  Radius 10
  +OLDRADIUSDMG
  States
  {
  Spawn:
  Death:
    TNT1 A 0
    TNT1 A 0 A_Explode
    Stop
  }
}
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_Detonate takes DamageType into consideration

Post by Gez »

So, it works when it's a projectile?

You could try using [wiki]A_ChangeFlag[/wiki] to set the MISSILE flag just before it explodes.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_Detonate takes DamageType into consideration

Post by NeuralStunner »

Or you could use the more functional [wiki]A_Explode[/wiki] instead. :?

Deprecation isn't just a tag, it's a "there's a much better method" situation.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_Detonate takes DamageType into consideration

Post by Gez »

Kyle873 wrote:I'll try A_Explode instead.

Edit:
Still not having the intended effect
Blue Shadow wrote:This's how I got around this issue in a mod of mine:

Code: Select all

<snip>
    BEXP D 5 Bright A_SpawnItemEx("NC_BarrelBoom", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
<snip>

ACTOR NC_BarrelBoom
{
  DamageType "Boom"
<snip>
  Projectile
<snip>
  States
  {
  Spawn:
  Death:
    TNT1 A 0
    TNT1 A 0 A_Explode
    Stop
  }
}
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: A_Detonate takes DamageType into consideration

Post by Blue Shadow »

Gez wrote:So, it works when it's a projectile?
I wasn't sure whether adding the projectile combo flag on the "BarrelBoom" actor was needed or not, but it seems to function fine without it.
You could try using [wiki]A_ChangeFlag[/wiki] to set the MISSILE flag just before it explodes.
I tried that, but it didn't seem work. :?
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_Detonate takes DamageType into consideration

Post by Xaser »

This is probably a symptom of "A_Explode (and variants) don't work well with non-projectiles." They never have -- remember the early versions of Doom where enemies that injured themselves with barrels would proceed to commit suicide? :P

It's generally safe practice to spawn a projectile and have that explode instead. That usually takes care of issues like this.
NotAGoodName
Posts: 17
Joined: Wed Jun 20, 2012 6:18 pm

Re: A_Detonate takes DamageType into consideration

Post by NotAGoodName »

Barrels inherit the damagetype that killed them, so that's probably related.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: A_Detonate takes DamageType into consideration

Post by Blue Shadow »

I'm inclined to say that it's related; I did a test where I killed myself with a barrel using a weapon that its projectile does ice damage. I died as if I, myself, was killed with an ice-type attack.
User avatar
Kyle873
Posts: 667
Joined: Thu Jun 28, 2012 11:48 am
Location: Ontario, Canada

Re: A_Detonate takes DamageType into consideration

Post by Kyle873 »

I implemented Blue Shadow's method and it appears to work the way I'd like it to, thank you for that. Although I'm still in the belief that we need a more flexible way to do this instead of the current behavior.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: A_Detonate takes DamageType into consideration

Post by Ed the Bat »

The exploding barrel transfers a lot of properties from the killer's attack into its own explosion, doesn't it? Things such as damage thrust, among others. I played an old DeHackEd mod which had a monster that exploded as soon as it saw the player, using the barrel's codepointers. The explosion used the properties of whatever weapon the player was holding (even if the player didn't actually attack it) because the player was the barrel's target when it exploded.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”