Jump to content

GetDead not working as expected in Actor script


peadar1987

Recommended Posts

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 000debuginitialise3
showmessage 000Debuggingmessage timer
if (timer2>5)
KittyTopsRef.resurrect 0
KittyTopsRef.resethealth
player.resethealth
showmessage 111winbyknockout
setstage 131Rhythm 255
Set DoOnce0 to 0
Set DoOnce1 to 0
set acakittyboxing to 0
endif
endif
Any helpful advice would be much appreciated!
Link to comment
Share on other sites

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

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

 

you know when you get attached to a certain way of doing things


All 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 == 1


Any 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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...