Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Cyborg17 on February 06, 2015, 10:48:41 pm
-
So, I've been slowly freding a campaign over the past ... who knows how long ... during my spare time. However, I cannot seem to get any configuration of an important event to work as designed. However, according to everything I know about sexps, it should be firing just fine.
Here is the event in question:
$Formula: ( when-argument
( random-of
"a"
"b"
"c"
"d"
"e"
"f"
"g"
"h"
"i"
"j"
"k"
"l"
"m"
"n"
"o"
"p"
"q"
"r"
"s"
"t"
)
( or
( = 1 @myleto[0] )
( has-arrived-delay 0 "GTT Leto" )
)
( ship-unstealthy "<argument>" )
( invalidate-argument "<argument>" )
( modify-variable @myleto[0] 1 )
)
The letters are hostile ships that are hidden from sensors but also start off stealthy. They are basically there to simulate sensor errors, but whenever I run the mission, no matter what repeat and trigger count I use, I can only get the event to fire once (I think). If it fires with invalidate-argument included, only one ship is made unstealthy. If I try it without invalidate argument, they all appear at the same time. I want them to appear one ship at a time, and I'm not sure what I'm doing wrong. Anyone have an idea?
-
random-of picks the same argument every time it's evaluated; if you want a new random item each time, you need to use random-multiple-of. If everything seems to be showing up at once, then you need to make sure the interval is set high enough so that it won't just re-evaluate every frame and effectively unstealthy all of them simultaneously.
-
If it fires with invalidate-argument included, only one ship is made unstealthy. If I try it without invalidate argument, they all appear at the same time.
Are you sure that's not the other way round? Cause if you invalidate the current argument, it should then pick a new one. Random-of is meant to pick the same argument repeatedly and only pick a new one if the currently selected argument is invalid.
-
The interval is set to the default of 1. The only way I could see that I would make a mistake with that is if the interval is by frame or by millisecond. I will post the mission, since it's still in such an early stage. I tediously made a chain of events last time, but I wanted to learn a better way of doing it, since I will probably be repeating this process at least a couple times.
Also, if I use any-of, the senor dots also appears all at once.
The way I see it, the event should
1 Make one of them visible
2 Invalidate that one
3 Wait a second
4 Repeat until all 20 are visible on the radar
[attachment deleted by nobody]
-
Nevermind. Random-Multiple-Of does work. Turns out Random-Of only works for the first argument it chooses, even if the argument is invalidated.
-
Also, if I use any-of, the senor dots also appears all at once.
That's not surprising. Your event doesn't contain <argument> anywhere in the trigger, you only use it in the action part of the event.
If you use <argument> in the trigger somewhere (for instance in a has-arrived-delay <argument> SEXP) the game checks which arguments the trigger evaluates to true for. Without that, any-of and every-of do the same thing, trigger for every single argument on the list.