Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: ARSPR on July 22, 2006, 03:51:31 am

Title: SEXP order within When
Post by: ARSPR on July 22, 2006, 03:51:31 am
I'm starting using FRED, and basically to fix some minor bugs in missions rather than building new ones.

So here is my question.

Within a When op you can put a lot of commands. I suppose that these commands are ALWAYS executed from the top one to the bottom one (in Events editor), not in a random order neither from bottom to top.

Can anyone confirm this, please?

I'm asking this because I've used it to fix a little issue in Derelict "Playing Possum" (DL4-05.fs2). In this mission there's an event (Play Dead!) where your mates get add-goal->ai-play-dead because all the ships are supposed to stay quiet to fool the shivans. The problem happens when you have given them for example a previous Escort command within game which has higher priority. In this situation the do not play dead.

I have fixed it changing add-goal->ai-play-dead to clear-goals and adding add-goal->ai-play-dead at the end of the same When. It works but I would like to be sure.
Title: Re: SEXP order within When
Post by: Starman01 on July 22, 2006, 06:40:45 am
To be honest, when I used to many when - operators, especially goal operators, then the chance that one isn't executed raise with the amount of used when-op's. Therefore, I make seperat SEXP for all vital things I want to have.

Problem is, I can't really reproduce that and it isn't equal in each builds. What isn't working in most cases (maybe it is even meant that way)
I can't make a "clear goal" and "add new goal" to the same ship in the same SEXP. Sometimes it works, but often not.

I suggest make vital goals in seperat SEXP. Since the SEXP-Nodes have been bumped, there should be no danger reaching the limit anymore.
Title: Re: SEXP order within When
Post by: karajorma on July 22, 2006, 10:10:15 am
I've never seen any evidence that things aren't executed in a top to bottom order. The senario described would certainly result in the goals being cleared and then a new one added. I've done the exact same thing many times.
Title: Re: SEXP order within When
Post by: Starman01 on July 22, 2006, 10:13:13 am
I too, and I noticed so many time that the fighter didn't go after their new goal (mostly waypoint or formation stuff), they just sit there.
When I make the clear goals and the new goal in seperate SEXP it always work. I don't have much experience with the new builds yet,
but it certainly was that way in 3.6.7 and the december 05 builds I used for quite some time.
Title: Re: SEXP order within When
Post by: karajorma on July 22, 2006, 10:59:32 am
Never had that problem. If it is happening it's a bug and you should post a mission where it occurs to Mantis so that it can be fixed.
Title: Re: SEXP order within When
Post by: Starman01 on July 22, 2006, 12:04:29 pm
It's seems to be random, and technically I have now seperated each offending SEXP. If I will stumple over it again, I post a bug.
Title: Re: SEXP order within When
Post by: ARSPR on July 22, 2006, 01:24:15 pm
Thank you for the info.

I've finally splitted it in two chained SEXPs but I'm going to retest it altogether again (and it's going to be the largest when ever made because a lot of extra additions).
Title: Re: SEXP order within When
Post by: IPAndrews on July 25, 2006, 10:10:52 am
Operations inside a when are executed top to bottom but events may not be executred top of list to bottom of list. It occasionally skips a few. So you have to assume events may be executed in any order.