Home   Help Search Login Register  

Author Topic: condition: unit has any weapon or he has not weapon at all?  (Read 483 times)

0 Members and 1 Guest are viewing this topic.

gundernak

  • Guest
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:

Code: [Select]
_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

exit
offcourse these are all weapon type he can have

...and I guess there is a much wiser way to check it...

thanks in advance

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:condition: unit has any weapon or he has not weapon at all?
« Reply #1 on: 16 Jan 2004, 00:43:55 »
Have you tried playing with weapons unit.


Planck
« Last Edit: 16 Jan 2004, 00:52:44 by Planck »
I know a little about a lot, and a lot about a little.

gundernak

  • Guest
Re:condition: unit has any weapon or he has not weapon at all?
« Reply #2 on: 16 Jan 2004, 00:52:28 »
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

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:condition: unit has any weapon or he has not weapon at all?
« Reply #3 on: 16 Jan 2004, 00:55:21 »
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
I know a little about a lot, and a lot about a little.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:condition: unit has any weapon or he has not weapon at all?
« Reply #4 on: 16 Jan 2004, 01:46:48 »
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.
Plenty of reviewed ArmA missions for you to play

gundernak

  • Guest
Re:condition: unit has any weapon or he has not weapon at all?
« Reply #5 on: 16 Jan 2004, 02:08:16 »
thanks Planck, I've tryed and OK :)

thanks macguba ;)