Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: killface on August 19, 2008, 07:28:21 pm
-
Alright...I need some guidance. How would one design a recurring event in Fred 2? Basically, I want my pilot to have to remain within a 500 meter sphere of a damaged communication beacon to be able to hear the transmissions coming through it. If the pilot moves to 500-1000 meters away, the messages get scrambled. If he moves 1000+ meters away, no messages at all. I'm imagining that there's a looping SEXP that allows for "every time" events that could pull this off, I just need an example of how to use one.
-
every-time SEXP should do that, or just set it to loop like 9000 times or more.
-
Don't use every-time. Simply specify a very large number of repeats and a repeat delay of 1 (The options are in the events editor by the side of the main box where you make the SEXPs).
-
So when do you use every-time? :confused:
-
Most people use every-time when what they really ought to be using is when with a repeat delay of 0. Every-time is a specialist SEXP that you only should need once in a blue moon. Basically certain SEXPs mark themselves as SEXP_KNOWN_TRUE or SEXP_KNOWN_FALSE. When that happens the SEXP will never be evaluated again. The game has basically replaced that SEXP with the true one.
Every-time forces the game to re-evaluate the SEXP. An occasion when you actually do need every-time escapes me at the moment. But I'm sure you'd bump into them if you started using the ship-create SEXP for instance. As many SEXPs will mark themselves FALSE or TRUE the second they think that they are being used for a ship which doesn't exist in the mission file.
-
One place I've found every-time to be useful is getting rand-multi and rand-multiple-of to behave like you would expect them to. Have it constantly evaluating and storing to a variable so when you need to grab the value it won't show any type of pattern. Even rand-multi by itself isn't all that random and tends to pull the same values when missions are replayed.
-
You're not seeding it by any chance? If you supply the optional argument it WILL give you the same set of numbers every time you play the mission. That's actually the entire point of seeding. :D
-
Nope. We had this discussion before and came to the conclusion that it probably doesn't work quite right but random events were the "bane of your existence" http://www.hard-light.net/forums/index.php/topic,53198.0.html
-
I only have the vaguest recollection of that. Any idea why I said I wouldn't touch it?