OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mostly on 17 Jan 2009, 14:49:50

Title: Unit is alive/dead command in script?
Post by: Mostly on 17 Jan 2009, 14:49:50
I basically want to add a line to the start of a script which detects if a particular unit is alive. If he is alive the script continues, if he's dead then the script ends.

I can't use a trigger to do this, it must be included in the script.

Any help would be appreciated.
Ta.
Title: Re: Unit is alive/dead command in script?
Post by: Planck on 17 Jan 2009, 15:10:26
Maybe something like:

? !(alive particularunit) : exit


Planck
Title: Re: Unit is alive/dead command in script?
Post by: Mostly on 18 Jan 2009, 14:04:58
Yep, that works a treat.

Thanks.

Without posting another thread, I've got another quick question. Lights on vehicles, how do I disable them completely? I've searched the forum and have found a few similar posts but a few years old and they claim that it's not possible. Has anyone discovered a way to do it? Maybe by editing something in the vehicle's config file?
Title: Re: Unit is alive/dead command in script?
Post by: Planck on 18 Jan 2009, 15:17:14
You can certainly switch off an AI vehicles lights but the AI driving it will just switch them back on again.

You can loop the command I suppose, but the effect would probably be something like a strobe.

I believe that if you switch the Ai into 'combat' mode they will keep the lights off:

unitname setbehaviour "combat"


Planck
Title: Re: Unit is alive/dead command in script?
Post by: Mostly on 18 Jan 2009, 15:53:54
Yeah, switching them to combat mode does work but if I order a man to take up the gunner position without a driver in the vehicle then the lights come on! The lights also come on at certain times, like when the men are getting in or out of the vehicle. Just for realism I want to stop that. It's hardly a good military practice to keep flashing your lights when trying to remain undetected!
Ideally I want to completely disable the lights. I've played around with scripts to keep checking if the lights are on and to turn them off but this creates a little bit of a drag on the system and like you say can have a strobe light effect.
Are vehicle lights buried deep in the actual games coding or can I find them somewhere else eg. config file or a script?
Title: Re: Unit is alive/dead command in script?
Post by: Raptorsaurus on 17 Feb 2009, 22:51:37
This is really a question for the addons forum, but you could modify the config of a vehicle to eliminate the lights. You could make a new addon of the vehicle that uses all the original BIS stuff, but only has a different config for your new vehicle. I think you should re-post this question on the addons forum to get better help from people experienced in doing this kind of thing.