Chainsaw Posted September 12, 2005 If I have two monsters in a room (imps lets say) how can I check that both are dead before spawning a shotgun for example. If both the imps had TID 2 and a mapspot had TID 1, would be something like: if(ThingCount(T_IMP,2) == 0) { Thing_spawn(1, T_SHOTGUN, 0,0); } 0 Share this post Link to post
Vader Posted September 12, 2005 Try this: While(ThingCount(0, 1)) { delay(1); } Thing_spawn(2, T_SHOTGUN, 0,0); This will check every 1 tic, if there are things with tag 1 in play. If not, it will spawn the shotgun at a mapspot with tag 2! 0 Share this post Link to post
Bastet Furry Posted September 12, 2005 I do it that way: I have 4 barons in some sort of small arena. All 4 get a thing tag of 2 (for the second argument in ThingCount). Then just cnp my code and it should work. It works here so.... script 4 (void) { if (ThingCount(T_BARON, 2) == 0) { Door_Open(8,30); SetMusic("MUSMAP02",0,0); } } Just insert your Thing_spawn(2, T_SHOTGUN, 0,0); inside and delete my stuff. Dont forget to change T_BARON to T_IMP. This way you only check for Imps with id 2 and nothing else, so you can reuse id 2 for other monster groups of the same type. If you want to check for a group of different monsters just leave the T_* and insert a 0 (zero). NULL should do the same job and is better to read. And one last thing, alway comment ;) Or you need to backtrack what a function should do...... 0 Share this post Link to post