cyanicide Posted March 22, 2017 I have a scenario where I have a button that spawns in 6 demons that I've given each the TID "6" at at a mapspot that I have placed in my map. like this.. script 6 (void) { Floor_LowerToLowest(4,16); Light_ChangeToValue(6,148); delay(40); for(int demon = 0; demon <6;demon++) { delay(40); Thing_SpawnFacing(5,T_DEMON,FALSE, 6); } } first it lowers the floor that the button is on then sets the brightness of a sector, and then spawns the demons. my trouble is that I want to make it so that if you kill all these demons a door opens up. However, because the demons don't exist anywhere in the map before they spawn the script below won't trigger. I think that's what the problem is but I do not know for sure. script 4 OPEN { while (ThingCount(T_NONE,6)<0) { delay(30); Floor_LowerToNearest(5,16); } } If anyone has any idea how to fix this, let me know. 0 Share this post Link to post
scifista42 Posted March 22, 2017 (edited) Try this (note the changes in both scripts, including the change in the type of script 4): script 6 (void) { Floor_LowerToLowest(4,16); Light_ChangeToValue(6,148); delay(40); for(int demon = 0; demon <6;demon++) { delay(40); Thing_SpawnFacing(5,T_DEMON,FALSE, 6); } SetThingSpecial(6, ACS_ExecuteAlways, 4); } script 4 (void) { if (ThingCount(T_NONE,6)==0) { delay(30); Floor_LowerToNearest(5,16); } } EDIT: I've just realized this code is not foolproof: If you kill the first 5 demons before the 6th one spawns, and the 6th one won't spawn due to something obstructing the landing spot, the Floor_LowerToNearest won't activate. Edited March 22, 2017 by scifista42 2 Share this post Link to post
cyanicide Posted March 22, 2017 1 hour ago, scifista42 said: Try this (note the changes in both scripts, including the change in the type of script 4): script 6 (void) { Floor_LowerToLowest(4,16); Light_ChangeToValue(6,148); delay(40); for(int demon = 0; demon <6;demon++) { delay(40); Thing_SpawnFacing(5,T_DEMON,FALSE, 6); } SetThingSpecial(6, ACS_ExecuteAlways, 4); } script 4 (void) { if (ThingCount(T_NONE,6)==0) { delay(30); Floor_LowerToNearest(5,16); } } EDIT: I've just realized this code is not foolproof: If you kill the first 5 demons before the 6th one spawns, and the 6th one won't spawn due to something obstructing the landing spot, the Floor_LowerToNearest won't activate. There is a problem I've been having with the demons spawning in, even without the kill condition. I think it has something to do with the fact that they are all coming out of the same spot, and with a random rotation angle, which means from time to time one of the demons wont' see you and will block the next one from coming in. 0 Share this post Link to post
jdagenet Posted March 23, 2017 (edited) You can actually check if a spot is free or big enough to spawn a monster by doing something along the lines of: script 777 (int x, int y, int z) { int tempTID = UniqueTID(); int canSpawn = Spawn("Cacodemon", x, y, z, tempTID); if (canSpawn) // Checks the location given by x, y, & z { Thing_Remove(tempTID); /*Put stuff here that you want to happen if the monster can spawn in the map*/ } else { /*If he can't? Do whatever you want here*/ } } Adapt this into your already existing code however you may need. 2 Share this post Link to post