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?
Barrel Damage Type Randomisation - Best Way?
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.
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.
- 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?
Sounds like the *only* method, short of an actual function to change damage type at will.
Re: Barrel Damage Type Randomisation - Best Way?
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.
Re: Barrel Damage Type Randomisation - Best Way?
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]
[edit] Which I have now done and it does simplify things. Thanks again. [/edit]
- 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?
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.
it's a deprecated flag, but it should still work.
- 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?
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.
Re: Barrel Damage Type Randomisation - Best Way?
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).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.
Re: Barrel Damage Type Randomisation - Best Way?
In my situation, that wouldn't particularly bother me.