Jump to content
AdirB

Trigger - specific in-game time

Recommended Posts

Hello,

Is there a way to run a script from a trigger only in a specific in-game time?

For example I want a bomb to explode at 15:30 excatly.

Share this post


Link to post
Share on other sites

Lets say your mission start time is 15:00, then set a bomb trigger to go off with 1800 (seconds) in all three timeout boxes, the bomb will go off at 15.30. Set it to suit your mission start time. There maybe a better way of doing it, but that's how I'd do it :)

Share this post


Link to post
Share on other sites

if (time > 1) then {hint "Hi"};

 

 

This will wait for 1 second after mission starts, then execute the code.

Share this post


Link to post
Share on other sites

Using time might cause issues in Multiplayer as it is client specific. I would go with this method:

 

1. Create a trigger

2. Set the trigger condition to: true

3. Set the trigger timeout function to: Timeout

4. Set the min, avg, max values to your required timeout

5. Put your script in the onActivation field

Share this post


Link to post
Share on other sites

Don't use time, it won't be reliable in MP. Since time of day became more reliably synchronized some updates ago, you should probably use daytime.

if (daytime >= 15.5) then
{

};

Share this post


Link to post
Share on other sites

Lets say your mission start time is 15:00, then set a bomb trigger to go off with 1800 (seconds) in all three timeout boxes, the bomb will go off at 15.30. Set it to suit your mission start time. There maybe a better way of doing it, but that's how I'd do it :)

Thank you, do I need to set the trigger's settings as "bull_a" said?

 

if (time > 1) then {hint "Hi"};

 

 

This will wait for 1 second after mission starts, then execute the code.

If the time isn't synced it wont work. Thank you anyway :)

 

Using time might cause issues in Multiplayer as it is client specific. I would go with this method:

 

1. Create a trigger

2. Set the trigger condition to: true

3. Set the trigger timeout function to: Timeout

4. Set the min, avg, max values to your required timeout

5. Put your script in the onActivation field

Thank you, do I need to set the trigger's settings as you said to set the timeout?

 

 

Don't use time, it won't be reliable in MP. Since time of day became more reliably synchronized some updates ago, you should probably use daytime.

if (daytime >= 15.5) then
{

};

Thank you I'll try it aswell. :)

Share this post


Link to post
Share on other sites

Yes sorry, the condition should be true.

 

Using time might cause issues in Multiplayer as it is client specific. I would go with this method:

 

1. Create a trigger

2. Set the trigger condition to: true

3. Set the trigger timeout function to: Timeout

4. Set the min, avg, max values to your required timeout

5. Put your script in the onActivation field

I did the thing you said with the trigger, the timer works fine, but I changed the activation to BLUFOR and there's only civilians and OPFORs in the area and the trigger automatically activates itself.

Is it about the condition true?

Share this post


Link to post
Share on other sites

Don't use time, it won't be reliable in MP. Since time of day became more reliably synchronized some updates ago, you should probably use daytime.

if (daytime >= 15.5) then
{

};

I was looking for an answer like this.

But this in the Condition field of a trigger:

daytime >= 15.5

Then put the bomb part in your "OnAct" of the trigger:

if (isServer) then { /* magic happens here */ };

This should prevent localities on the client.

Share this post


Link to post
Share on other sites

I did the thing you said with the trigger, the timer works fine, but I changed the activation to BLUFOR and there's only civilians and OPFORs in the area and the trigger automatically activates itself.

Is it about the condition true?

Yes, I was under the impression the trigger was to activate at the mission start.

 

If you want the trigger to activate after a condition is met i.e. BLUFOR units are in the trigger area, then set the condition back to "this" (it's default state).

 

Then you can set the parameters in the trigger dialog box in the editor :)

Share this post


Link to post
Share on other sites

I was looking for an answer like this.

But this in the Condition field of a trigger:

daytime >= 15.5

Then put the bomb part in your "OnAct" of the trigger:

if (isServer) then { /* magic happens here */ };

This should prevent localities on the client.

There's no way to make it the "old fashion" way, with a trigger timeout?

 

daytime >= 15.5 - 15.5 means 15:05 O'clock?

 

Yes, I was under the impression the trigger was to activate at the mission start.

 

If you want the trigger to activate after a condition is met i.e. BLUFOR units are in the trigger area, then set the condition back to "this" (it's default state).

 

Then you can set the parameters in the trigger dialog box in the editor  :)

 

I'm trying this, I'll update.

 

Edit: It works thanks alot :D

Share this post


Link to post
Share on other sites

There's no way to make it the "old fashion" way, with a trigger timeout?

The timeout of a trigger is there to make aspects of a scenario "random". It tells to wait x seconds (set in the timeout) before firing off the OnAct field of a trigger.

 

daytime >= 15.5 - 15.5 means 15:05 O'clock?

15:30, BIS is strange this way.

Share this post


Link to post
Share on other sites
15:30, BIS is strange this way.
Strange? Its a float value 15.5. Half an hour (0.5) is 30mins.
  • Like 2

Share this post


Link to post
Share on other sites

trigger condition:

 

date select 3 == 15 && date select 4 == 30

or

date select [3,2] isEqualTo [15,30]

  • Thanks 1

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

×