Jump to content
Sign in to follow this  
kolpo

Letting 2 things happen from 1 event

Recommended Posts

Hello I want 2 things to happen from one event, the only way I have found that works is using 2 event handlers for the same event:

this addEventHandler["killed", {obj1 setTaskState "succeeded"}];

this addEventHandler["killed", {taskHint ["The civilians no longer need to fear that sniper!\nWell done Bob!", [1, 1, 1, 1], "taskDone"]}];

But can this be done with one eventHandler without having to use extern files?

Especially because I later might add even more stuff to that event like:

this addEventHandler["killed", {obj1 setTaskState "succeeded"}];

this addEventHandler["killed", {taskHint ["The civilians no longer need to fear that sniper!\nWell done Bob!", [1, 1, 1, 1], "taskDone"]}];

this addEventHandler["killed", {obj2 setTaskState "assigned"}];

this addEventHandler["killed", {taskHint ["That APC is endagering civilians!/nTake it out Bob!", [1, 1, 1, 1], "taskAssigned"]}];

Share this post


Link to post
Share on other sites

Multi-line

this addEventHandler["killed", {
obj1 setTaskState "succeeded";
taskHint ["The civilians no longer need to fear that sniper!\nWell done Bob!", [1, 1, 1, 1], "taskDone"];
obj2 setTaskState "assigned";
taskHint ["That APC is endagering civilians!/nTake it out Bob!", [1, 1, 1, 1], "taskAssigned"];
}]; 

One line

this addEventHandler["killed", {obj1 setTaskState "succeeded"; taskHint ["The civilians no longer need to fear that sniper!\nWell done Bob!", [1, 1, 1, 1], "taskDone"]; obj2 setTaskState "assigned"; taskHint ["That APC is endagering civilians!/nTake it out Bob!", [1, 1, 1, 1], "taskAssigned"];}]; 

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  

×