OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: sgtGunneryHighway on 18 Mar 2003, 03:45:55
-
How can i check (in a condition field) what weapon is fired?
ex :(i want to activate a trigger when the guy shoot with an ak and only an ak how can i do that?)
-
I'm not an expert, but I suspect you want the event handler "fired". Check it out in the command ref (look under one of the topics as well as the command addEventHandler) and FAQ, there is some stuff there.
The event handler activates when the loon fires. That in turn activates a little script that you have written/borrowed which will check and see if it was an AK. If it was then your variable goes to true and your trigger fires.
-
lol SGH - i've been playing around with that yesterday and
guess where - Mogadishu island ;D
OK, what you need to do is, put the code below into the
unit's init field:
this addEventHandler ["FIRED", {_this exec "script.sqs"}]
Now create the script and put following into:
?(_this select 1 == "AK47"): whatever you want to do then here
exit
If you want to check the contents of _this, then you can display
the whole array aswell by:
hint format ["%1", _this]
:note - i've choosen an AK47 - you need to alter it to exactly that weapon, you want or if it's AK in general, you will need
more conditions in a row.
~S~ CD
-
great m8 your script work well
but tbh i used to use it with the BAS_satcom and he dont work with it :'(
i know there was a tread about that radio somewhere but i cant find it :-\
-
Well, when firing with the radio (shall it be BAS or SEB_nam),
the eventHandler fired doesn't get hot (how the hell you
pointed out what i was trying on mogadishu isle yesterday :o)
Instead of using an eventHandler when firing the weapon "radio", i changed to use the condition:
"_x hasweapon ""BAS_satcom""" count (units mygroup) > 0
That way, you can check if any member of the group "has"
the radio (works in multiplayer aswell).
But it was an AK, you were asking for first - wasn't it? ;)
~S~ CD