Jump to content
Sign in to follow this  
pele93

addeventhandler not returning correct values?

Recommended Posts

I have a fairly simple trigger that has this in its on act line :

eh1 = player addEventHandler ["Fired", {null = execVM "smoke.sqf"}]

And in the smoke.sqf:

_ammotype = _this select 5;
hint format["%1",_ammotype];
if (_ammotype == "SmokeShellred") then { _this execvm "myscript.sqf"};

The hint was for debugging purposes as I wasn't getting the desired result, basically on the detection of a red smoke grenade I want it to exec my script. I've changed the _ammotype = _this select 5 to all numbers from 1-5 and all return "any" no matter what weapon I use.

Is there something I'm doing wrong:confused:

Share this post


Link to post
Share on other sites
I have a fairly simple trigger that has this in its on act line :

eh1 = player addEventHandler ["Fired", {null = execVM "smoke.sqf"}]

you forgot to pass "_this" to the script.

should be:

eh1 = player addEventHandler ["Fired", {null = _this execVM "smoke.sqf"}]

Share this post


Link to post
Share on other sites

thanks for tip will try now

---------- Post added at 07:52 PM ---------- Previous post was at 07:47 PM ----------

Thanks worked a charm, I'm still learning scripting and ArmA 2 editor :)

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  

×