OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Milwot on 25 Apr 2004, 17:18:58
-
I'm making a mission where there's a civilian (set as a west unit using deletevehicle) and I want the resistance soldiers to open fire on him when he has a weapon (any weapon), using perhaps "setcaptive true/false"
Any ideas?
-
Can't you just set Resistance friendly to east, or nobody?
Planck
-
Greetings,
Planck, if you did that, the resistance would always fire at him, whether he had a weapon or not!
Milwot, you may want to try the canFire command in conjunction with setCaptive. I haven't actuaaly tried it myself, but in theory you could use it to check if your civilian is able to fire (i.e. has weapon and ammo), and then set setCaptive to false.
Sorry, that's completely wrong. According to the COMREF, it only checks for damage, not ammo (and so should always return true for a living soldier).
Instead, you could use the hasWeapon command to see if he has a specific weapon. Unfortunately, AFAIK, you cannot use the command to check if the unit has any weapon, just for a specific one. However, if there is only one weapon that the civilian can pick up, (say AK74), you could check for that weapon:
? civ1 hasWeapon "AK74": civ1 setCaptive false.
Here's the COMREF entry:
unit hasWeapon weaponName
Operand types:
unit: Object
weaponName: String
Type of returned value:
Boolean
Description:
Check if unit has given weapon.
Example:
player hasWeapon "M16"
-Supreme Commander PsyWarrior
-Psychic Productions Studios