OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: nominesine on 01 Jan 2006, 13:27:42
-
Is there a comand that lets me check what handgun a player is carrying in the pistol slot, similar to the commands pimaryWeapon and secondaryWeapon???
I would like to create a string, consisting of all weapons the player is carrying at the moment, but I cannot include the handguns in the string.
EDIT: The command weapon does not work. I need to get the name of the handgun separate from the other weapons
-
http://www.ofpec.com/editors/comref.php?letter=W#weapons
-
I'm making a script, checking if the player is armed. This is the code sample I'm having trouble with:
rifles = primaryWeapon player
bazookas = secondaryWeapon player
? player hasWeapon rifles or player hasweapon bazookas: goto "playerIsArmed"
goto: "playerIsNotArmed"
This allows me to check if the player is carrying any weapon in the first two slots. But I cannot check if the tricky bastard has hidden a handgun somewhere. Any suggestions?
EDIT: syntax above from memory, not the actual script code. It works in the script.
-
just use the weapons command
it returns an array of all weapons a unit is carring.
weapons player
and also,
rifles = primaryWeapon player
bazookas = secondaryWeapon player
? player hasWeapon rifles or player hasweapon bazookas: goto "playerIsArmed"
goto: "playerIsNotArmed"
you need the line things on a variable
_rifles = primaryWeapon player
_bazookas = secondaryWeapon player
? player hasWeapon _rifles or player hasweapon _bazookas: goto "playerIsArmed"
goto: "playerIsNotArmed"
-
In case it is not clear from all the above try something like:
if (count weapons player < 1) then {goto"PlayerNotArmed"}
;he has a weapon if the script gets here.
It gets slightly more complicated if you need to know what weapon he has.
-
A count command. Brilliant. Thanks Thobson. Problem solved :D