Jump to content
Sign in to follow this  
Derty

Fired event handler working for satchel charges also....

Recommended Posts

So I found this script somewhere here on these forums. It basically runs a script that changes all the players setcaptive status to false if any of them fire their weapons. I have it in each players init.

FiredH = this addEventHandler ["fired", {EHScrtp = _this exec "SetCaptive.sqf"}];

That works fine. The problem is that if a player drops a satchel charge on the ground that also causes the script to run. Is it possible to make it only run if the player fires his primary weapon or sidearm?

Thanks in advance

Share this post


Link to post
Share on other sites

FiredH = this addEventHandler ["FIRED", { if ((_this select 5) == "pipebomb") exitWith {};EHScrtp = _this exec "SetCaptive.sqf"; }];

try this - not tested :)

Share this post


Link to post
Share on other sites
FiredH = this addEventHandler ["FIRED", { if ((_this select 5) == "pipebomb") exitWith {};EHScrtp = _this exec "SetCaptive.sqf"; }];

That's an occasion where exitWith does not work (beeing used in the code part of an eventhandler, fine in called functions from the EH code though).

if (_this select 5 != "pipebomb") then {...

Xeno

Share this post


Link to post
Share on other sites

ok so I changed it but it still doesn't seem to work. As soon as you drop a satchel charge OPFOR goes hostile

FiredH = this addEventHandler ["FIRED", { if (_this select 5 != "pipebomb") then {};EHScrtp = _this exec "SetCaptive.sqf"; }];

Share this post


Link to post
Share on other sites

Looks, like there are corrections needed, maybe this will be fine:

FiredH = this addEventHandler ["FIRED", { if (_this select 5 != "pipebomb") then {EHScrtp = _this [color="#FF0000"]execVM [/color]"SetCaptive.sqf"}[color="#FF0000"]}[/color]];

Share this post


Link to post
Share on other sites

Still no go. As soon as I place a charge OPFOR goes hostile.

Share this post


Link to post
Share on other sites

Try

unit init line:

this addEventHandler ["Fired", {_this execVM "checkfired.sqf";}];

checkfired.sqf

_unitfired = _this select 0;
_ammo = _this select 4;
_projectile = _this select 6;

_nonvalid = ["pipebomb"];

if (!(_ammo in _nonvalid)) then {
nul = _unitfired execVM "SetCaptive.sqf";
};
}

Or something like that... just doing this quickly so may have made minor mistakes but that should work.

You may have to check the pipebomb classname (for ammo)

http://community.bistudio.com/wiki/ArmA:_Event_Handlers#Fired

Share this post


Link to post
Share on other sites

I followed the instructions in the last post and it would not work. Turns out, the class needs to be case-sensitive (pipebomb needs to be PipeBomb)

That script is excellent and with a few tweaks could be used to not detect SD weapons and the like

Share this post


Link to post
Share on other sites

II would need a solution to trigger kill report and scoring when using satchels charges in ACE 2 mod.

Share this post


Link to post
Share on other sites

 Im asking same for Arma3 -basically Satchel is considered Ammo not Weapon so there is no parameter for it in the Killed eventHandler. Thats what we need....

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×