Jump to content
Sign in to follow this  
Winters

Multiple EventHandlers of same type

Recommended Posts

Hi all,

I wanted to know if there is anyway to have multiple eventhandlers of the same type.

Example:

You are trying to mark minefields but since there are different types of mines i wanted to have a marker for each type.

It works fine when i am marking only one type of mine but not when i try to mark different types of mines it ony "see's" the first one. Is it possible to have more than 1 "fired" eventhandler running at the same time?

Thanks for the help  biggrin_o.gif

Share this post


Link to post
Share on other sites

Yes it is possible, you could just change the script slightly instead of adding more than one eventhandler though.

RED

Share this post


Link to post
Share on other sites

How would i do that?

i am basing evrything off the "fired" EH.

engineer AddEventHandler ["fired", {_this exec "minemarkpers.sqs"}]; engineer AddEventHandler ["fired", {_this exec "minemarkarm.sqs"}];

when i try to mark the mines i get the same marker for both. it doesnt "see" the one for the armor mines just the personel ones.

It's fairly obvious to me that it wont work because its the same EH but how would i adapt a script to allow for the different markers to work?

Share this post


Link to post
Share on other sites

Mind posting the script here? Im sure either myself or someone else will be able to show you how.

RED

Share this post


Link to post
Share on other sites

Here ya go, thanks Red

MineMarkPers.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_engineer= _this select 0,

_minemarkpers= _this select 4,

"marker1" setmarkerpos [(getpos engineer select 0), getpos engineer select 1), 1]

"marker1" setmarkertype "dot"

engineer removeeventhandler ["fired",0]

[] exec "newmineevent.sqs"

exit

newmineevent.sqs just puts the EH back in and the second script called "MineMarkArm.sqs" works the same but is supposed to add a red dot for marker1A.

Share this post


Link to post
Share on other sites

How about something like this, just replace the type of mine with the name of the mines you are using.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_engineer = _this select 0

_minemarkpers = _this select 4

?_minemarkpers == "Type of mine": _marker = "marker1"; _type = "dot"

?_minemarkpers == "Type of mine": _marker = "marker1a"; _type = "dot"

_marker setmarkerpos [(getpos engineer select 0), getpos engineer select 1), 1]

_marker setmarkertype _type

engineer removeeventhandler ["fired",0]

[] exec "newmineevent.sqs"

exit

RED

Share this post


Link to post
Share on other sites

Multiple EH's of the same type should work, and they always have for me. However, I have heard of them not working for other people at times. Check this thread here:

http://www.ofpec.com/yabbse....start=0

So perhaps there are certain conditions where multiple EH's won't work, assuming there wasn't something else messing this stuff up.

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  

×