Barrel Damage Type Randomisation - Best Way?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Enjay
 
 
Posts: 27158
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Barrel Damage Type Randomisation - Best Way?

Post by Enjay »

I have an explosive barrel and, if it kills someone, it has a chance of setting the victim on fire. The way I am doing this is to have the barrel spawn an explosion actor and the explosion does the damaging, not the barrel. I have defined two different explosion actors: one burning; one not burning. The barrel uses a jump in its death state sequence to either spawn a normal explosion or a burning one.

My question is, is this the best way to do it? It works just fine and it may be the best way but, initially, I was looking at ways of doing everything from within the barrel actor. However, as far as I can tell, there is no way to specify damage type in A_Explode and there is no way to change an actor's damage type on the fly either. Am I correct?
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: Barrel Damage Type Randomisation - Best Way?

Post by NeuralStunner »

Sounds like the *only* method, short of an actual function to change damage type at will.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Barrel Damage Type Randomisation - Best Way?

Post by Gez »

You can use a RandomSpawner to replace barrels with different types of barrels that have different damage types; or your barrel can spawn a randomspawner which will spawn one of many explosion types.
User avatar
Enjay
 
 
Posts: 27158
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Barrel Damage Type Randomisation - Best Way?

Post by Enjay »

OK thanks for the input, It seems that some sort of actor spawning randomisation (rather than randomisation within an actor) is required so I guess that my solution is as good as any. I'm actually using a few barrel variations (mainly different appearances) so getting them all to spawn the same actor which then spawns a random explosion would be the best bet because that would minimise code changes (ie the barrels could all be the same) but I'd already started to change all the barrels. Perhaps I will go back in and re-do that.

[edit] Which I have now done and it does simplify things. Thanks again. [/edit]
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: Barrel Damage Type Randomisation - Best Way?

Post by zrrion the insect »

You could give the barrel +FIREDAMAGE and use A_ChangeFlag("FIREDAMAGE",random(1,0)) to toggle it.
it's a deprecated flag, but it should still work.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Barrel Damage Type Randomisation - Best Way?

Post by XutaWoo »

Probably not. When you kill something, it changes its damage type to the damage type of the projectile/hitscan/etc used to kill it. This means anything that uses +SHOOTABLE. And I have my doubts +FIREDAMAGE would override the internal damage type unless it was set to normal.
User avatar
Popsoap
Posts: 43
Joined: Wed Jun 30, 2010 1:18 pm

Re: Barrel Damage Type Randomisation - Best Way?

Post by Popsoap »

Gez wrote:You can use a RandomSpawner to replace barrels with different types of barrels that have different damage types; or your barrel can spawn a randomspawner which will spawn one of many explosion types.
There is a minor difference between those two though. The latter will be less consistent across saved games (destroying a barrel, reloading a saved game, then destroying it again can produce a different result).
User avatar
Enjay
 
 
Posts: 27158
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Barrel Damage Type Randomisation - Best Way?

Post by Enjay »

In my situation, that wouldn't particularly bother me.
Locked

Return to “Editing (Archive)”