Home   Help Search Login Register  

Author Topic: When unit is dead, exit!  (Read 737 times)

0 Members and 1 Guest are viewing this topic.

ProudPotter2490

  • Guest
When unit is dead, exit!
« on: 24 Apr 2005, 21:49:25 »
Hey everyone!
I've made the following script for a fixed position:-
Quote
_unit = _this select 0

#loop
_unit setBehaviour "COMBAT"
_unit switchMove "CROUCH"
_unit setUnitPos "UP"
~0.5
goto "loop"

exit
Simple, eh? But if you'd care to test it, once the unit the script is applied to dies he just keeps falling.

To help avoid this pesky problem, I wanted to use a code that cuts the script once the unit dies. I've tried "not (alive_unit) : exit" in addition to "(getDammage _unit = 0.25)", but typically it wont work. Does anyone have a suggestion?
Thanks!
ProudPotter2490 :afro:

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:When unit is dead, exit!
« Reply #1 on: 24 Apr 2005, 21:55:39 »
Code: [Select]
_unit = _this select 0

#loop
_unit setBehaviour "COMBAT"
_unit switchMove "CROUCH"
_unit setUnitPos "UP"
~0.5
? alive _unit : goto "loop"

exit

ProudPotter2490

  • Guest
Re:When unit is dead, exit!
« Reply #2 on: 24 Apr 2005, 22:00:42 »
Hey Baddo!
Thanks for the tip but the unit doesn't fire on the enemy any more. Cheers anyway.
ProudPotter2490 :afro:

ProudPotter2490

  • Guest
Re:When unit is dead, exit!
« Reply #3 on: 24 Apr 2005, 22:05:24 »
Hey!
My apoligies! It did work, it was just down to timing ;)! Thanks Baddo :D.
ProudPotter2490 :afro: