Jump to content
Sign in to follow this  
SpecOp9

Time events

Recommended Posts

Alright,

Here is my question:

Ingame at 5:00 PM, I want a chopper to lift off. It's as simple as that.

Other examples would be, at 3:00 PM I want a group of soldiers to wake up, and run into a boat and do whatever, drive around aimlessly let's say.

I just need to know how to make scripts go off depending on what time it is ingame.

Share this post


Link to post
Share on other sites

Use the daytime command:

?Daytime > 20: hint "The time is 8pm"

RED

Share this post


Link to post
Share on other sites

There are several ways you can call the time in OFP.

As Red says, "daytime" gives you the real time.

You can call that day/date/hour/second by using the

"missionstart".

You can also work with time elapsed during the mission, that is, since "missionstart", as the game sets up a global variable named "TIME".

So to make an event happen 5 minutes after the mission starts, you could do;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (TIME >=300): Truck setdammage 1

Finally, you can call the amount of time that has elapsed in a script. In a script a reserved variable called "_time" is setup.

So for example, you could have a script start, and then have it wait for a minute etc. Maybe for a scud launch etc, you could set off the various stages after specific timed stages.

The only thing to watch is that you dont look for a definite time, eg.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_time ==200: do thus

As there is the chance that the game will miss it. So use

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?_time >=200: do this

Hope that helps a little.

TJ

Share this post


Link to post
Share on other sites

Missionstart is available only in MP, at least in 1.75 that's what I found.

Share this post


Link to post
Share on other sites

is there any way to do this with a trigger in game?

Can I add this to any existing script, (just copying and pasting the line). or do I have to make a new sqs file, then have something in the init file refer to it?

I want a trigger / script that ends the mission in a half hour after mission start.

Could someone give me an example please?

Share this post


Link to post
Share on other sites

Make a trigger type End1 or what ever you need, then put this in the condition field:

time == (60 * 30)

That will end the mission 30 mins after the start of the mission.

RED

Share this post


Link to post
Share on other sites

wow I didn't know _time was built in. You know how many times I've wanted to run timed events and tried

_time = time

@ (time - _time > 20):do something

and of course _time changed right along with time so now I use _myTime to store a time.

Anyhow, I wanted to ask what some tricky things you could do with _time?

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  

×