Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Mpez on March 20, 2011, 07:02:40 am

Title: has-time-elapsed in miliseconds?
Post by: Mpez on March 20, 2011, 07:02:40 am
I've been working on a cutscene in slow-mo and I need events to happen in, for example, a half of a second, or less so I've been wondering if there is a way to control time more efficiently. Has-time-elapsed and the majority of other sexps have a delay in seconds. Are there sexps that let you do sth after a number in milliseconds?
Title: Re: has-time-elapsed in miliseconds?
Post by: The E on March 20, 2011, 07:17:40 am
Recent builds, accessible via the nightly builds forum, have mission-time-msecs.
Title: Re: has-time-elapsed in miliseconds?
Post by: Mpez on March 20, 2011, 07:26:11 am
Are there any workarounds using the standard builds? Also, I would be very grateful if you would post a basic example of using the mission-time-msecs sexp.
Title: Re: has-time-elapsed in miliseconds?
Post by: The E on March 20, 2011, 07:42:05 am
Workarounds for standard builds include having a stealthed ship far off in the distance travelling a set of waypoints at a known speed and using its progress as a timing method.

mission-time-msecs works just like mission-time, it returns a numeric value that you can store in a variable and compare against. Say you have an event A and an event B. You want B to start 500 ms after A started, so what you'd do is store what mission-time-msecs returns when A is evaluated in a variable, and have B's start trigger be something like
Code: [Select]
( when
    (>
       (mission-time-msecs)
       (+
            (variable_that_holds_the_stored_timeindex)
            (500)
       )
    )
)
Title: Re: has-time-elapsed in miliseconds?
Post by: Mpez on March 20, 2011, 07:46:35 am
Workarounds for standard builds include having a stealthed ship far off in the distance travelling a set of waypoints at a known speed and using its progress as a timing method.

I'm using that already. Problems occur when I want to change the camera's position in a time shorter than a second.

EDIT: Oh, wait. Didn't understand that correctly at first. That's a great idea. Thanks!

mission-time-msecs works just like mission-time, it returns a [...]

Thanks :) I'll download one of the recent builds and try it tomorrow.