Remilia Scarlet Posted November 20, 2002 Ok, I've been playing around with this for a while, but I just can't figure it out. Anyone know of a way to script a level (with FraggleScript) to where something will happen when all the monsters (or all monsters of a certain kind, whichever) are dead? But only if the monsters are dead, not if only half or so are dead. I tried a loop once, but it seemed to slow Legacy down so far that it was going at 0 fps. Am I going the wrong direction with a loop? 0 Share this post Link to post
Remilia Scarlet Posted November 22, 2002 I must have stumped people. Found a way in ACS, yes, but no way in FS... 0 Share this post Link to post
boris Posted November 22, 2002 Try to ask this question in the Eternity forum (on the very bottom of the forum index). There should be some people who can answer your questions. 0 Share this post Link to post
Quasar Posted November 22, 2002 The only way to do this in FraggleScript would be write down the mapthing numbers of every thing of the type whose death you want to monitor, and do something like this: int num = <first mapthing number here>; int num2 = <second mapthing number here>; ... int numN = <Nth mapthing number here>; script 1 { while(1) { if(objhealth(num) == 0 && objhealth(num2) == 0 && ... && objhealth(numN) == 0) { /* do something in here */ } wait(1); } } // this starts script 1 at the beginning of the level startscript(1); The wait(1) call is critical -- without it, the game will hang permanently as it'll never exit out of running your script. Be aware, however, the possible problems with this approach. I wrote a somewhat similar loop for Nimrod to implement falling damage, and it caused save game corruption. This is a known problem with the FraggleScript system, and there are no workarounds available. 0 Share this post Link to post
kristus Posted November 27, 2002 That turned out to be a corruption with how the loading of the savegame dealt with the wait(); command being in action however. according to hurdler anyways. In some cases it worked fine and in some cases it didn't. and it was a problem with loading the savegame, not the saving. 0 Share this post Link to post
Kaiser Posted November 28, 2002 legacy has a new function called objdead for Legacy you can have something like script 1 { while(1) { if((objdead(mobj#) && (objdead(mobj#))) //checks of two of those monsters are dead { "enter action" break(); } wait(1); } } I believe this will work even if you save and load while this script is in action and if you want to count more monsters, just add another "&& (objdead(#))" for eternity, you have to use objhealth() that so far is pretty much the quickest way to do this.... 0 Share this post Link to post