OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Zombie on 12 Nov 2003, 01:09:41

Title: !alive problem
Post by: Zombie on 12 Nov 2003, 01:09:41
I have a script that detects when a certain unit(not a player) is not alive which works just fine.  The unit is respawned after 10 seconds, but the detection script still detects it as being not alive.  HBow can I get the script to recognize the unit has been respawned and is alive again?
example:
?!(alive bb2):goto "next"
This works just fine the first time, so I'm guessing the respawned unit isn't named bb2 anymore?
Title: Re:!alive problem
Post by: Terox on 12 Nov 2003, 17:21:28
when you respawn ai, you actually create a brand new ai, so basically what you have to do is attach a variable name to the newly created ai, this would be done in the ai creation script that you have used

 = BB2
Title: Re:!alive problem
Post by: Zombie on 12 Nov 2003, 17:36:37
Ok, I tried this by adding the _vcl = bb1 line, but it still doesn't work properly.  Am I missing something obvious?  This is an excerpt from the script that is run by the unit named bb1
@!(alive _vcl)
~_respawndelay
deleteVehicle _vcl
_vcl = _type createVehicle _position
_vcl setdir _dir
_vcl setdammage .73
_vcl = bb1
Title: Re:!alive problem
Post by: Zombie on 12 Nov 2003, 19:04:11
OK, I was able to solve my problem by changing the detection of BB1 not alive to !bb.  I manipulate bb like this:
#start
?(getdammage _vcl)<.75:goto "start"
_shell = "heat125" camcreate (getpos _vcl)
_shell = "heat125" camcreate (getpos _vcl)
_shell = "heat125" camcreate (getpos _vcl)
_shell = "heat125" camcreate (getpos _vcl)
~2
bb = false
@!(alive _vcl)
~_respawndelay
deleteVehicle _vcl
_vcl = _type createVehicle _position
_vcl setdir _dir
_vcl setdammage .73
bb = true
Title: Re:!alive problem
Post by: Zombie on 13 Nov 2003, 17:59:46
I see what you mean, but I still want a slight delay between the destruction of the vehicle and the respawning of a new one. _respawndelay is set to 10 for this script.  Thanks for your help, I learned a few things hammering this out.