I am currently attempting to use DECOHack in order to replace every imp on a given map with one of 2 other things. Sort of similar to the RandomSpawner actor from ZDoom.
Here is my script
thing MTF_IMP free states
thing MTF_IMP "ImpRandomizer"
{
health 1
speed 1
clear states
States
{
Spawn:
TROO AB 1 A_RandomJump(Caco, 127)
TROO AB 1 A_RandomJump(Baron, 127)
Loop
Caco:
TROO EF 1 A_SpawnObject(15)
Stop
Baron:
TROO EF 1 A_SpawnObject(16)
Stop
}
}
In theory, when an imp is spawned it has a chance to either spawn a cacodemon or baron and then stop. Which sort of works but for some reason it spawns two of that monster. I assume this is just a simple state timing error or something that I don't understand but I'm not sure how to fix this.
Secondary question: is there a way to effectively have more than two random states be selected at equal chance? Right now how it's set up it will have a 50% chance to spawn a cacodemon or to have another 50% chance to spawn a baron or to loop. Which if my simple understanding of probability serves me, will mean that if I add a third A_RandomJump in the spawn label, the third will have a smaller chance to occur than the first or second one. I assume there is some sort of equation I can use to solve this, however I am not mathematically inclined enough to figure it out.
Question
Firebert
I am currently attempting to use DECOHack in order to replace every imp on a given map with one of 2 other things. Sort of similar to the RandomSpawner actor from ZDoom.
Here is my script
thing MTF_IMP free states thing MTF_IMP "ImpRandomizer" { health 1 speed 1 clear states States { Spawn: TROO AB 1 A_RandomJump(Caco, 127) TROO AB 1 A_RandomJump(Baron, 127) Loop Caco: TROO EF 1 A_SpawnObject(15) Stop Baron: TROO EF 1 A_SpawnObject(16) Stop } }
In theory, when an imp is spawned it has a chance to either spawn a cacodemon or baron and then stop. Which sort of works but for some reason it spawns two of that monster. I assume this is just a simple state timing error or something that I don't understand but I'm not sure how to fix this.
Secondary question: is there a way to effectively have more than two random states be selected at equal chance? Right now how it's set up it will have a 50% chance to spawn a cacodemon or to have another 50% chance to spawn a baron or to loop. Which if my simple understanding of probability serves me, will mean that if I add a third A_RandomJump in the spawn label, the third will have a smaller chance to occur than the first or second one. I assume there is some sort of equation I can use to solve this, however I am not mathematically inclined enough to figure it out.
Share this post
Link to post
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.