Thing isn't spawning with script
Posted: Tue May 27, 2014 4:51 am
So I was adding in the mystery box from another map on my WAD. The weapon cycling works perfectly, but the randomly selected weapon isn't spawning.
"Thing_SpawnFacing(13, randomweapon[newRand], 0, 994); " <- this has worked on other maps but not in the current one I'm working on. There is no Thing Deactivate or anything that messes with the TID (Which is 13) of the MapSpot. Script 70 is just the box closing animation, so there's no need to worry about that
Code: Select all
script 56 (void)
{
//random numbers
int newRand = Random(0, 17);
int lastRand = newRand;
for(int i = 0; i<=17; i++)
{
//ensure the new random number isn't the same as the last
while(newRand == lastRand)
{
newRand = Random(0, 17);
}
lastRand = newRand;
Thing_SpawnFacing(1, randomweapon[newRand], 1, 994);
delay(4);
Thing_Remove(994);
}
//change the random number one last time
while(newRand == lastRand)
{
newRand = Random(0, 17);
}
//show, remove, then spawn the randomly selected weapon
Thing_SpawnFacing(1, randomweapon[newRand], 1, 994);
delay(35);
Thing_Remove(994);
Thing_SpawnFacing(13, randomweapon[newRand], 0, 994);
boxActive = 0;//box no longer in progress
acs_execute(70 ,0 ,0, 0, 0);
}