Jump to content
Sign in to follow this  
jimm

run script from trigger ?

Recommended Posts

Hi I have a few scripts that work great if i put the code in the ini line of the units.

what i have been trying to do is have these scripts launched from a trigger.

for example i have a trigger that is activated by east present .

i list all units within the trigger radius then try running the script for each unit in the list.

i have spent many hours trying many things but have had no luck so far.

any help appreciated.

cheers

Share this post


Link to post
Share on other sites

I'm guessing

{0 = [_x] execVM "yourscript.sqf"} forEach thislist

In the script,

_unit = _this select 0;

would be the unit sent.

However, I would prefer

0 = [thislist] execVM "yourscript.sqf"

instead. In the script,

_list = _this select 0;

would be the whole list.

Running scripts on each unit creates a lot of unwanted overhead, naturally depending on the complexity of the script. If you can get away with looping over only group leaders, you can reduce a lot of overhead.

Share this post


Link to post
Share on other sites

thanks for your help :)

this is what i have spent 4 or 5 hours over the last few nights trying to do.

thanks also for the tip on keeping overhead expense low makes sense :)

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  

×