Page 1 of 1
Barrel Damage Type Randomisation - Best Way?
Posted: Sun Feb 24, 2013 8:41 pm
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?
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Sun Feb 24, 2013 10:53 pm
by NeuralStunner
Sounds like the *only* method, short of an actual function to change damage type at will.
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Mon Feb 25, 2013 2:59 am
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.
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Mon Feb 25, 2013 4:45 am
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]
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Mon Feb 25, 2013 8:11 am
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.
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Mon Feb 25, 2013 7:23 pm
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.
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Wed Feb 27, 2013 12:49 pm
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).
Re: Barrel Damage Type Randomisation - Best Way?
Posted: Wed Feb 27, 2013 5:01 pm
by Enjay
In my situation, that wouldn't particularly bother me.