Jump to content
Sign in to follow this  
Praxtor

Eventhandlers and If??

Recommended Posts

I want to know if is posible put inside of one Eventhandler one waituntil or while sintax like this;

Quote[/b] ]

pilotillo addEventHandler ["killed",{

Helii SETDAMMAGE 0;

deletevehicle pilotillo;

"SoldierWPilot" createUnit [position leader group player, trip_HeliAU_W,"pilotillo=this;pilotillo moveindriver HeliAU", 1, "corporal"];

deletegroup trip_HeliAU_W;

HeliA removeEventHandler ["killed", 0]}

];

This code works normaly but the problem if is i put one waitunitl inside of the code, it allways return error.

Quote[/b] ]

pilotillo addEventHandler ["killed",{

waituntil {

dammage choper_1 < 0.5;

};

deletevehicle pilotillo;

deletegroup trip_HeliAU_W;

HeliA removeEventHandler ["killed", 0]}

];

In wait until i allways get one error. Is the same if i put Sleep 5; i get error.

Some idea?

Share this post


Link to post
Share on other sites

Let me try to explain.

The stuff put in inits of units and triggers and the like can not be paused in any way.

Because, what thread will it be pausing?(I may be wrong here, but I think its something like that)

Same goes with you calling an function directly from an init, that function can not be paused either.

My suggestion would be to do something like this

pilotillo addEventHandler ["killed",{[_this] execVM "myScript.sqf"}];

myScript.sqf

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

dammage choper_1 < 0.5;

};

deletevehicle pilotillo;

deletegroup trip_HeliAU_W;

HeliA removeEventHandler ["killed", 0]

It could be rewritten to be more dynamic ofcourse as you have stuff passed to the script by using [_this] execVM.

Share this post


Link to post
Share on other sites

;-)

Thanks a lot for your time.

I put a new Script like your example.

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  

×