OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Maclav 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 (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.
-
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...
-
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:
(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
-
(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 :(
-
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.
-
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 (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=9376;start=0)