Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Axem on September 13, 2005, 09:58:37 pm
-
Sigh...
I'm trying to time events exactly to something, however FRED will only let me set delays or chains to whole numbers. I've tried inputting it as a decimal number (47.5), as a fraction using the divide operator (95/2), even going into notepad and working behind FRED's back, but alas none of it works.
Anyone have any ideas how to get around this?
-
The only time I've had fractions work for me is in send-message-list, but otherwise, I don't think there is a way around. Sorry bro.
-
SEXPs are built to work on intergers. I don't think there's much of a way round this.
-
Would it be possible to use variables for these figures? Then you could calculate the decimal figure you want and store its value in a variable, and use that. Is that possible?
-
AFAIK variables also use integers. You can try it but I doubt you'll have much success.
Even if you could get an integer into a variable though FS2 would simply cast it to an integer as soon as it's used in a SEXP anyway and you've be back to square one.
-
there was once a discussion in the scp about changing the entire system over to ms instead of seconds......but if that happens...so much for backward compatability.
-
Couldn't there be some extra sexps, for example, has-time-elapsed and has-time-elapsed-ms?
-
The entire sexp system is based around integers. Period. You can't use decimal numbers without rewriting part or all of the sexp system.
-
I suspect that a situation that requires such precise timing is likely to break once the player gets in there and starts mucking around anyway.
-
What I was thinking to trick by finding something that takes half a second to do (or some fraction of a second), and then use the event delay so it fires off at a whole number of seconds later. I would just need to find something that takes a half second to do, or is almost everything based on whole seconds?
I should add this is for a cutscene, not a player controlled enviroment, so what the player does, doesn't matter.
-
Do this then. Create a ticker timer with an event like this
Timer - Provides half seconds
When
-is-event-true-delay
--Some event half a second before what you want.
-modify-variable
--TickerTimer(0)
-- +
---TickerTimer(0)
---1
Give it 30 repeats and a delay of 0
Then simply used this
Trigger Event
When
- =
--TickerTimer(0)
--30
Problem with this is that the speed at which TickerTimer is incremented depends on the player's PC. A fast PC seems to update quicker than a slow one. But if you keep the numbers low enough you might manage to get it to work. Make sure you test on a variety of high end and low end PCs just to be sure.
-
Yay, I got it to work another way. I used Physics to trick FRED. An Amazon Advanced Drone at full speed (50m/s) will cover 25m in 0.5s. Using the distance operation and a no warp effect option, the Amazon arrives at the instance I need it, at full speed, and produces the delay needed.
Now syncing to the music will be a breeze!
-
math 4tw
-
indeed :D
Make sure you put the drone somewhere really far away and make it cloaked, so the player doesn't notice.
-
The ingenuity of FREDers never ceases to amaze me :D
-
Originally posted by Mongoose
The ingenuity of FREDers never ceases to amaze me :D
You gotta give us some credit. Sitting around all that math-related work does something to you... :D
-
Originally posted by Axem
Yay, I got it to work another way. I used Physics to trick FRED. An Amazon Advanced Drone at full speed (50m/s) will cover 25m in 0.5s. Using the distance operation and a no warp effect option, the Amazon arrives at the instance I need it, at full speed, and produces the delay needed.
Now syncing to the music will be a breeze!
That's going right into the cookbook. Far better than my solution. :D
-
Speaking of things like this, anyone remember that old FRED2 tips and tricks thread on the VBB? There was some very useful stuff in there; does anyone still have a copy of it?
-
Yep. I'll have to see about putting it up if no one else steps forward. I know that sandwich did have it up at one point but the link is dead now.