Jump to content
Sign in to follow this  
laulau

addEventHandler trouble

Recommended Posts

i've searched in this forum to see if i can find the solution to my problem, but i didn't succeed. So here is what i want:

I'm usin the BAS_satcom weapon. I want the player to select it as a weapon and fire from it to send a radio message.

So i used it:

this addEventHandler ["Fired", {if ((_this select 1) == "BAS_Satcom") then {Radio01=true}}]

Radio01 is a public variable activating a trigger which executes a script showing a sidechat text and changing the waypoints of a plane which comes to the player to bomb a town.

I tried without giving ammo to the BAS-satcom. the BAS_satcom radio sound is played but it seems that the public variable doesn't activate the trigger cause the sidechat script is not shown and of course the plane never comes to bomb the town.

So i added BAS_Satcom ammo, thinking it could be the reason why it doesn't work. Now when the player chooses the BAS_Satcom weapon, 100 ammos are shown but when the player fires the satcom, no sound is playing and the trigger is not activated.

Does someone knows how to do what i want and could he help me?

Share this post


Link to post
Share on other sites

I dont have time to check your formats etc, but you can use the following line in the INIT line of your guy to check exactly what the fired handler is giving you.

This addeventhandler ["fired",{hint format ["%1",_this]}]

Hope that helps you a bit.

TJ

Share this post


Link to post
Share on other sites

thx. I didn't think of it. It should help me.

EDIT: Well, i just tried it and the line displays info only if i shoot with a gun. If i shoot with the satcom or the laser designator, i get nothing. Thx again for your answer even if it didn't solve my problem. If i find a way to make it work, i'll post it here. smile_o.gif

Share this post


Link to post
Share on other sites

Maybe you would be better to add an action to the unit as long as he HASWEAPON the satcom.

Share this post


Link to post
Share on other sites

yeah, it's what i've done. If he has the satcom weapon he can call radio messages, if he doesn't he can't. I stop looking for the solution about the fire eventhandler. TJ, thx to have looked at my problem. smile_o.gif

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  

×