Home   Help Search Login Register  

Author Topic: handgun ID  (Read 604 times)

0 Members and 1 Guest are viewing this topic.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
handgun ID
« 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
« Last Edit: 01 Jan 2006, 13:31:30 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Plenty of reviewed ArmA missions for you to play

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:handgun ID
« Reply #2 on: 01 Jan 2006, 13:42:12 »
I'm making a script, checking if the player is armed. This is the code sample I'm having trouble with:
Code: [Select]
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.
« Last Edit: 01 Jan 2006, 13:43:23 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:handgun ID
« Reply #3 on: 01 Jan 2006, 13:49:47 »
just use the weapons command

it returns an array of all weapons a unit is carring.

weapons player


and also,

Quote
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

Code: [Select]
_rifles = primaryWeapon player
_bazookas = secondaryWeapon player

? player hasWeapon _rifles or player hasweapon _bazookas: goto "playerIsArmed"

goto: "playerIsNotArmed"

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:handgun ID
« Reply #4 on: 01 Jan 2006, 14:22:51 »
In case it is not clear from all the above try something like:

Code: [Select]
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.
« Last Edit: 01 Jan 2006, 14:26:30 by THobson »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:handgun ID
« Reply #5 on: 01 Jan 2006, 18:04:43 »
A count command. Brilliant. Thanks Thobson. Problem solved  :D
OFPEC | Intel Depot
RETARDED Ooops... Retired!