OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: sharkattack on 27 Dec 2007, 12:47:15
-
me again
is it possible to add an event handler to all units within a trigger area ?..
many thanx in advance ... :good:
-
Yes, just get the units with the "list" of the trigger and add the corresponding handlers.
{
_x addEventHandler blah blah blah blah;
} forEach list trigger_name;
-
rodger that mate
will try asap
many thanx mandoble :good:
edit
=====
im doing somthing wrong
this is the EH ( detect gunfire) i m trying to add to all units within a trigger called badlands
this addEventHandler ["fired",{if (!(_this select 2 in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs"}}
-
if you are doing that inside the forEach, then it should be _x addEventHandler ... instead of this addEventHandler
-
me again :whistle:
please forgive my noobishness :-[
i tried with the below code but keep getting an error message missing }
any one help me get the correct the syntax
{_x addEventHandler ["fired",{if (!(_this select 2 in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs"}} forEach list badlands;
many thanx in advance
-
yes, I see 3 { and 2 }, try with "gunshots.sqs"}}}
-
new error
foreach : type string expected code ???
===========================
also
the EH works on player unit if called from his init
this addEventHandler ["fired",{if (!(_this select 2 in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs"}}
however if i add pipebomb to the weapons which will not activate the trigger ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD";"PipeBomb"]) it fails to recognize them
so if a player places a charge the EH is fired .. have tried with timeBomb no change .. anyone no of a solution ?? :good:
-
";"PipeBomb" --> ","PipeBomb"
there is a ; there instead of a ,
-
:-[
thanx a lot mate
edit
===
still dosnt work after correcting
-
also, try changing
(_this select 2 ...
by ( (_this select 2) ...
-
sorry to be a pain in the arse :P
but im still unable to get it to work ...
i tried with this
{_x addEventHandler ["fired",{if (!((_this select 2) in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs"}}} forEach list badlands
same error returned
foreach : type string expected code ???
-
where are you executing that code? inside sqs or sqf? if sqf, there is a missing ; at the end.
Also you are missing the end ] of the addEventHandler command.
-
hi mate
im executing the command from init sqs ..
i tried
{_x addEventHandler ["fired",{if (!((_this select 2) in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs"}}}] forEach list badlands
error missing ; ???
many thanx for your help ...
-
{_x addEventHandler ["fired",{if (!((_this select 2) in ["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "gunshots.sqs";}}];} forEach list badlands;
-
excellent .... thanx a million mandoble ... works a treat :good:
now to get the EH to recognize satchel charges ...
any ideas on how to add satchels to the weapons array
have tried adding "Put" (weapon class name)
and both PipeBomb and TimeBomb (magazine classname)
to weapons array but still everytime i set a charge the handler is fired
all the best for new 2008
-
Is not that what you were looking for? To have the EH active when you set a charge?
-
no ...
i just want the EH to react to un-silenced gunfire or maybe when a satchel is blown up .. at the min the EH fires as soon as the charge is placed
so .. a player may take his time in a stealthy approach to objective engaging the enemy with silenced weapons. Only for the alarm to be raised as soon as the player set s his charge
not when it is touched off ..
has me stumped ???
-
This is an exact repeat of your thread (http://www.ofpec.com/forum/index.php?topic=28963.0) in the general forum. Please don't duplicate questions, or we have to duplicate answers (MP answers are more complex and will usually work in SP too, but SP answers rarely work in MP; thus, if something is going to be used in both MP and SP, please just ask in MP).
-
Many appologies .. :-[
and thanks very much spooner
PipeBombMuzzle done the trick for the satchels :)
all the best