Home   Help Search Login Register  

Author Topic: Detect if unit holds a weapon  (Read 547 times)

0 Members and 2 Guests are viewing this topic.

Maclav

  • Guest
Detect if unit holds a weapon
« on: 19 Apr 2004, 18:25:55 »
Is there any way to detect if a unit holds any weapon in hands (or on his back)?? I`ve found 1 post (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=16013;start=0 and no1 knew how to do that. But in CWC campaign (training) officer tells to stand in line and put the weapon on back so there has to be a way to check it (when I do it, a cutscene starts). Also, OFP has to check if weapon is already in hand coz it displays "weapon on back" when it is in player`s hands and "weapon in hand" when it is in hand. If someone knows what to do to detect it, plz help.

wamingo

  • Guest
Re:Detect if unit holds a weapon
« Reply #1 on: 19 Apr 2004, 20:17:37 »
I checked the training mission's source and I'm afraid I must disappoint you.. there is no check for weapons, not even hasweapon or ammo check, nothing.
It gives you a moment or so to figure it out before continuing and should you chose to do nothing it continues anyway...

the "put gun on back" / "put gun in hands" option is like an addAction scripted command, you can't actually check what state you're in...

won't say it's not possible, but I doubt it very much...

j-man

  • Guest
Re:Detect if unit holds a weapon
« Reply #2 on: 19 Apr 2004, 21:33:14 »
To detect if the player has a weapon in his hand, you just need to check if his behaviour is COMBAT, AWARE, or STEALTH. Create a trigger, any size, activated repeatedly, and activated by anyone. The put this line in the "CONDITION" field:

Code: [Select]
(behaviour player == "COMBAT") || (behaviour player == "AWARE") || (behaviour player == "STEALTH")
And put what ever you want in the "ON ACTIVATION" field

This method should work, but i'm not 100% sure

Maclav

  • Guest
Re:Detect if unit holds a weapon
« Reply #3 on: 20 Apr 2004, 14:25:00 »
Quote
(behaviour player == "COMBAT") || (behaviour player == "AWARE") || (behaviour player == "STEALTH")

i tried this but trigger worked even when my unit was holding the gun on his back....... Maybe it would work with AI, coz they hold weapons on backs only in "careless" or "safe" mode....

I wrote this script:

~0.1
behav = format ["%1",behaviour pl]
~0.5
titletext [behav,"plain down"]

pl is the player`s name. OFP always displays "aware"

It seems that there`s is no way to check it :(
« Last Edit: 20 Apr 2004, 14:34:01 by Maclav »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Detect if unit holds a weapon
« Reply #4 on: 20 Apr 2004, 14:38:54 »
afaik this method can't work as player unit doesn't return any behaviour values like AI does...it's logic, how should OFP see if you're in COMBAT or AWARE mode.

maybe reversed logic could work...did you tried the same trigger with NOT behaviour SAFE and NOT behaviour CARELESS?

:edit:
bulls**t...now as i'm reading my own post i see it can't work either. Behaviour has nothing to do with the weapon...only with how a unit reacts.
« Last Edit: 20 Apr 2004, 14:41:21 by myke13021 »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Detect if unit holds a weapon
« Reply #5 on: 20 Apr 2004, 14:47:58 »
i think i found something which could help you...probably OFP can't check directly IF you have weapon on back...but i think it will know if you performed an ACTION...maybe this thread can help you further.

http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=9376;start=0