OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ProudPotter2490 on 24 Apr 2005, 21:49:25

Title: When unit is dead, exit!
Post by: ProudPotter2490 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:
Title: Re:When unit is dead, exit!
Post by: Baddo 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
Title: Re:When unit is dead, exit!
Post by: ProudPotter2490 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:
Title: Re:When unit is dead, exit!
Post by: ProudPotter2490 on 24 Apr 2005, 22:05:24
Hey!
My apoligies! It did work, it was just down to timing ;)! Thanks Baddo :D.
ProudPotter2490 :afro: