OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gundernak on 16 Jan 2004, 00:34:54
-
Hi all,
this Q is based on my previous '@ or loop' post.
Is there a good solution to check the unit has any weapon or to check the unit has no wepon at all.
Because now I use a script like this:
_dude = _this select 0
@ _dude hasWeapon "M16" or _dude hasWeapon "AK74SU" or _dude hasWeapon "AK74" or _dude hasWeapon "AK74GrenadeLauncher" or _dude hasWeapon "AK47CZ" or _dude hasWeapon "AK47" or _dude hasWeapon "AK47GrenadeLauncher" or _dude hasWeapon "PK" or _dude hasWeapon "SVDDragunov" or _dude hasWeapon "RPGLauncher" or _dude hasWeapon "HK" or _dude hasWeapon "M4" or _dude hasWeapon "M16GrenadeLauncher" or _dude hasWeapon "M60" or _dude hasWeapon "M21" or _dude hasWeapon "LAWLauncher"
_dude setCaptive false
exitoffcourse these are all weapon type he can have
...and I guess there is a much wiser way to check it...
thanks in advance
-
Have you tried playing with weapons unit.
Planck
-
No, I have not tryed.
Just now I have found it in the off com ref, unoff com ref does not containt this... ???
Anyway I do not know how can I build it to a check...
I have to check if a unit has ANY weapon, or has not ANY AT ALL...
Could you give me a hint on this
-
I suppose you could check if the array was empty.....null.
This would mean he had no weapons.
On the other hand if the array was not empty.........he has weapons.
Planck
-
Unofficial com ref, although excellent and worthy of consultation on every point, is rather old. A lot of commands have been added since it was written. The "new" version of it is the online command ref in the Ed Depot, which has helpful Comments added for many commands.
-
thanks Planck, I've tryed and OK :)
thanks macguba ;)