Home   Help Search Login Register  

Author Topic: How to check any weapon  (Read 451 times)

0 Members and 1 Guest are viewing this topic.

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
How to check any weapon
« on: 14 Aug 2003, 13:22:50 »
Hi!

Is there a way to check whether a unit has a weapon? I know how to check if one has a specific weapon but not any weapon, if you follow me.

If there's a way to check whether the unit has his gun on his back or no weapon at all (safe) or if he's in combat mode with the gun in his hands?

Thx guys  :)
« Last Edit: 14 Aug 2003, 13:48:03 by Wildebeest »
Weeee...

deaddog

  • Guest
Re:How to check any weapon
« Reply #1 on: 14 Aug 2003, 14:36:35 »
1.  You can experiment with the primaryweapon and secondaryweapon functions.  They both return empty strings if they have no weapon.

2.  The behaviour function will return what state the unit is in (combat, safe, etc).  A unit is safe mode should have his weapon on his back.  I don't know how that works if he is not carrying a weapon.

You'll just have to experiment with those functions.   ;)

behaviour unit
Operand types:
    unit: Object
Type of returned value:
    String
Description:
    Behaviour mode of given unit ("CARELESS","SAFE","AWARE","COMBAT","STEALTH")

Example:
    behaviour player



primaryWeapon vehicle
Operand types:
    vehicle: Object
Compatibility:
    Version 1.75 required.
Type of returned value:
    String
Description:
    Returns name of vehicle's primary weapon (empty string if none).

Example:
    primaryWeapon player


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:How to check any weapon
« Reply #2 on: 14 Aug 2003, 14:59:08 »
To save checking primary and secondary seperately, and also covering handguns I presume ... note that this returns an array not a string, but you can still check if it's empty.


weapons vehicle

Operand types:
vehicle: Object
Type of returned value:
Array
Description:
Returns array of names of all vehicle's weapons..

Example:
weapons player

You'll have to experiment with the syntax and brackets but try this:-

? count [weapons loon1] == 0: goto "whatever"
Plenty of reviewed ArmA missions for you to play