Jump to content

Recommended Posts

Guys I need help with another script ...

 

I created a trigger zone where I want to have a aircraft spawn every time a BLUFOR unit gets within its radius with the following structure:

 

Type: None

Act: BLUFOR

Repeatedly

Condition: this

On Act: _null = ["flyBy1_Start", "flyBy1_End", 300, "NORMAL", "LIB_Ju87", WEST] execvm "scripts\FlyBys\Flyby.sqf"

 

and the script:

_flyByStart =  _this select 0;
_flyByEnd = _this select 1;
_alt = _this select 2;
_mode = _this select 3;
_type = _this select 4;
_side = _this select 5;


ambientFly = [getmarkerpos _flyByStart, getMarkerPos _flyByEnd, _alt, _mode, _type, _side] call BIS_fnc_ambientFlyBy;

All is working fine but I want to be able to add a cool down timer to it, so it doesnt activate every time a unit comes within the radius of the trigger. Can anyone help with this one?

Share this post


Link to post
Share on other sites

Ok I read the information guide about timeout and countdown but it's not quite what I want. I want the trigger not to fire again if less then a certain amount of time has not passed. This would prevent the aircraft from flying by every time a BLUFOR unit comes in its radius ...

Share this post


Link to post
Share on other sites

change trigger condition from

this

to

this && time > (missionNamespace getVariable ["timeNext", 0])

then set timeNext every time trigger activates to desired interval for example

missionNamespace setVariable ["timeNext", time + 60];

this means trigger will only activate after at least 60 seconds passed since prrevious activation.

Share this post


Link to post
Share on other sites

Thxs for the repply Killzone ...

 

So I changed the condition this to this && time > (missionNamespace getVariable ["timeNext", 0])

 

but where do I put the missionNamespace setVariable ["timeNext", time + 60];?

In the script per se?

Share this post


Link to post
Share on other sites

You can put it on OnAct before: _null = ["flyBy1_Start", "flyBy1_End", 300, "NORMAL", "LIB_Ju87", WEST] execvm "scripts\FlyBys\Flyby.sqf"

...or after it

Share this post


Link to post
Share on other sites

Ha I can't really tell if it works yet cause I just realised that my trigger only activates once even when I go back to it ... I've set it to repeatedly but I think the condition true makes it stay permanent?

 

EDIT: So I figured out how to truly make it repeat itself. I followed this post here: https://forums.bistudio.com/topic/87907-repeating-triggers/ to make it repeat whenever the condition is met and send the command again after the specified period of time, so now i have two triggers:

 

First one:

 

Timeout: 0, 0, 0
Condition: conditiontime<time
On act: hint _null = ["flyBy1_Start", "flyBy1_End", 300, "NORMAL", "LIB_Ju87", WEST] execvm "scripts\FlyBys\Flyby.sqf";  conditiontime=time+1800;

 

And the other:

 

Condition: true
On act: conditiontime=time 

 

Finally working properly!

 

Thank you killzone_kid for ur help and patience. Merry Christmas to u!

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

×