Home   Help Search Login Register  

Author Topic: eventhandler fired  (Read 3966 times)

0 Members and 1 Guest are viewing this topic.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: eventhandler fired
« Reply #15 on: 18 Apr 2007, 08:53:03 »
Should be..

Make an array of the silenced ammo or weapon names, you can find them here, and check whether the used ammo/weapon is in the array

Ammo (if ammo used is not SD ammo)
Code: [Select]
this addEventHandler ["fired",{if (!(_this select 4 in ["B_556x45_SD","B_556x45_SD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "script.sqs"}]Weapon (if weapon used not silenced)
Code: [Select]
this addEventHandler ["fired",{if (!(_this select 2 in ["M4A1SD","MP5SD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "script.sqs"}]
The ammo thing is not very usefull because in ArmA you can use SD and non-SD ammo in silenced weapons and they are still silenced so you can't tell whether the weapon used was silenced with just the ammo..
I just thought I'd post it as an example, it might very well fit some other situation.. :scratch:

Oh, and that myvar_akfired is just an example of a variable name  :D
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline sharkattack

  • Former Staff
  • ****
Re: eventhandler fired
« Reply #16 on: 18 Apr 2007, 18:29:24 »
cheers h ... yeah i figured about variable name .. 
and youre right
Quote
Back you will be for more questions sense I.. 

thanx again mate  :good:
"HOLY SARDINE" - see Shark-Attack meet his match

Offline sharkattack

  • Former Staff
  • ****
Re: eventhandler fired
« Reply #17 on: 31 Dec 2007, 13:16:59 »

i am using the following to detect gunfire from un suppressed weapons

this addEventHandler ["fired",{if (!(_this select 2 in["M4A1SD","MP5SD","M9SD","AKS74UN","Makarov
SD"]) && !myvar_akFired) then {myvar_akFired=true; _this exec "detected.sqs"}}]


it works fine  ... if the player  fires anything but a silcenced weapon the enemy will react ..
however if i manage to avoid detection and go to place a charge at the target .. as soon as i put the satchel down the event handler fires

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

can anyone help with this issue

many thanx  and best wishes for the new year to all ...
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: eventhandler fired
« Reply #18 on: 31 Dec 2007, 14:24:03 »
The satchel charge is called "PipeBomb" (AMMO) and is fired by "Put" (WEAPON) using the "PipeBombMuzzle" (MUZZLE). (_this select 1) is the WEAPON, (_this select 2) is the MUZZLE, and (_this select 4) is the AMMO (see the weapons COMREF for all the possible muzzles for each weapon).

works a treat with every weapon ... apart from M4A1GL ... i can get it to react to the flare or grenade
just not the main gun ..

this addEventHandler ["fired",{if (_this select 2 == "M4A1GL" && !myvar_akFired) then {myvar_akFired=true; _this exec "script.sqs"}}]   
dosnt fire the script !  any one know the answer  have tried all obvious solutions but to no avail ??
many thanx...

In this event handler, (_this select 2) is the name of the muzzle used, not the weapon. In all weapons that only have one muzzle, the name of the muzzle is the same as the weapon though. For the M4A1GL, the muzzles are the "M4Muzzle" and the "M203Muzzle". If you just want to know which weapon has been fired, then you might as well use the weapon, rather than the muzzle (i.e. use _this select 1)).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline sharkattack

  • Former Staff
  • ****
Re: eventhandler fired
« Reply #19 on: 31 Dec 2007, 14:54:38 »
thanks very much spooner

PipeBombMuzzle  done the trick for the satchels   :)

all the best
« Last Edit: 31 Dec 2007, 14:58:19 by shark attack »
"HOLY SARDINE" - see Shark-Attack meet his match