Serge Jkn Posted July 17, 2018 Hi everyone! I've been looking into some scripting tutorials but I seem to be stuck with this one. I'd like to spawn some additional monsters when the monster with TID 16 has reached 50% health. When I start fighting the creature and eventually kill it, nothing happens. The creature has a total of 3000 health points. Every TID has been assigned correctly in the map. I'm not sure what I'm doing wrong here. Any help would be greatly appreciated! script 6 OPEN { while(1) { if(GetActorProperty (16, APROP_Health) <= 1500) { Thing_Spawn (12, 6, 0); Delay (35); Thing_Spawn (13, 6, 128); Delay (35); Thing_Spawn (14, 6, 192); Delay (35); Thing_Spawn (15, 6, 64); Terminate; } } } 0 Share this post Link to post
StormCatcher.77 Posted July 18, 2018 There is not enough "Delay (1);" after "While". Due to its absence, the While loop becomes infinite and GZDoom automatically stops its execution. Try this at first: Script 6 Open { While(True) { Delay (1); If (GetActorProperty (16, APROP_Health) <= 1500) { Print (s:"-------------"); Terminate; } } } 0 Share this post Link to post
Serge Jkn Posted July 19, 2018 I tried it but unfortunately it doesn't work... 0 Share this post Link to post
Aquila Chrysaetos Posted July 19, 2018 How about this while loop: script 1 OPEN { while (GetActorProperty (6, APROP_HEALTH) >= 1501) { Delay (1); //Do nothing } { //Do stuff after his health drops to 1,500 or below } } This checks about 35 times per second if the monster's health is above 1,500, and if it returns true, it will hit that delay and check again until it returns false, in which case it will execute everything in between the second set of braces. You don't have to write terminate at the end, because the script will terminate itself upon hitting a closing brace outside the while/until/if-else loop. 0 Share this post Link to post