peadar1987 Posted April 16, 2013 Share Posted April 16, 2013 Hi, another Mojave Heavyweight problem. The scripts I'm running on my boxers to enable proper tournaments check the player health, the boxer health, and run a timer. When the timer hits 60 seconds, it compares the damage taken by the player and their opponent, and judges who's won the round, best of three rounds wins. That's working no problem, but I also want it to check if the player has knocked out their opponent, which is where things get annoying. I've tried to use an if loop that uses the getdead command. I've put in debugging messages, and as far as I can tell, even if the opponent is knocked out, the script refuses to enter the loop when dealing with certain actors. Debugging messages placed in the script all the way to the top of this loop display correctly, so I don't think the script is terminating before it gets round to testing if the boxer is dead. Any helpful advice would be appreciated. Here's the text of the loop (in all its unformatted glory!), the actual script is 120 lines long, so I'm not going to subject you to it all!if (KittyTopsRef.GetDead)set timer2 to timer2 + getsecondspassed;showmessage 000debuginitialise3showmessage 000Debuggingmessage timer if (timer2>5)KittyTopsRef.resurrect 0KittyTopsRef.resethealthplayer.resethealthshowmessage 111winbyknockoutsetstage 131Rhythm 255Set DoOnce0 to 0Set DoOnce1 to 0set acakittyboxing to 0endifendif Any helpful advice would be much appreciated! Link to comment Share on other sites More sharing options...
jazzisparis Posted April 16, 2013 Share Posted April 16, 2013 Just wanting to make sure: None of the opponents has the IsEssential flag set, right? Link to comment Share on other sites More sharing options...
peadar1987 Posted April 17, 2013 Author Share Posted April 17, 2013 Just wanting to make sure: None of the opponents has the IsEssential flag set, right? No, and the same thing happens whether I kill them through the console, or the old fashioned way. Thanks for the suggestion though Link to comment Share on other sites More sharing options...
jazzisparis Posted April 17, 2013 Share Posted April 17, 2013 Then it's possible that, for whatever reason, KittyTopsRef is not registered as being dead.If KittyTopsRef uses a script, try adding this code: begin OnDeath printc "I'm dead." end If it works, you can have KittyTopsRef trigger the procedure form an OnDeath block, instead of using GetDead from the main script. Link to comment Share on other sites More sharing options...
peadar1987 Posted April 17, 2013 Author Share Posted April 17, 2013 Then it's possible that, for whatever reason, KittyTopsRef is not registered as being dead.If KittyTopsRef uses a script, try adding this code: begin OnDeath printc "I'm dead." end If it works, you can have KittyTopsRef trigger the procedure form an OnDeath block, instead of using GetDead from the main script. Thanks! I'd thought of that, but you know when you get attached to a certain way of doing things, and just want to know why it's not working?!! I'll give this way a go and see if it does the trick. Link to comment Share on other sites More sharing options...
DizzasterJuice Posted April 17, 2013 Share Posted April 17, 2013 GetDead returns 1 if true, 0 if false, therfore the first line needs to be:if KittyTopsRef.GetDead == 1 Link to comment Share on other sites More sharing options...
jazzisparis Posted April 17, 2013 Share Posted April 17, 2013 you know when you get attached to a certain way of doing thingsAll too well, my friend. I suffer from the same disorder. I'm very curious myself why it doesn't work. There doesn't seem to be any immediately apparent reason.GetDead returns 1 if true, 0 if false, therfore the first line needs to be:if KittyTopsRef.GetDead == 1Any variable/condition function is treated as a boolean when no equality/inequality is specified, and will return True for any value other than zero. Link to comment Share on other sites More sharing options...
DizzasterJuice Posted April 17, 2013 Share Posted April 17, 2013 Yeah you're right...sometimes I speak before I think. :confused: I had this problem once before and I remember it was an easy fix but don't remember exactly what it was other than it had something to do with the way I was using getdead and resurrect. Link to comment Share on other sites More sharing options...
Recommended Posts