I remember saying to Cetanu after he posted his Advanced FRED tutorial that as soon as I had released a mission I'd make one of my own. Well it's rather embarrassing to have only been able to get around to it 4 years later but here goes.
Since Birth of a Legend from BtRL is about the only released mission I've made which is really complex I'll be using that as the example. I suppose I might cull a few things out of King of the Hill for another tutorial one day but that mission has much less advanced FREDding in it. DRADIS Distance
The original plan for the mission called for ships to be invisible over a certain distance away from the player. The distance would get smaller depending on the difficulty level you were playing on. This proved to be a complete nightmare as far as playability was concerned cause often enemy ships would wander off after your wingmen and you'd never be able to figure out where either of them were.
However once I had set up the idea of a decreasing distance within which things would happen I found it useful to keep it for other events in the mission. For some strange reason which was necessary at the time I took a very long and complicated method of setting up the distance in the mission. Here's how I should have done it.
Notice how the name of the variable starts with CONST. I frequently use this if I'm setting up a variable to be used as a constant in the rest of the mission. It's slightly naughty cause I'm actually altering the value of the constant but it's done at t=0 and it's never touched again. Why would you set up a variable as a constant I hear the non-programmers amongst you ask? Quite simply if I've got a value of 340 dotted throughout my mission the easiest way to change that later is with a search & replace in notepad. If instead I've used CONST-WeaponRange instead I only need to change the default value of the variable. Avoiding problems with Gauntlet and Slingshot
One of the main ideas of the mission was that the two pilots Gauntlet and Slingshot would be on point duty but would run into Scar and quickly get out of their depth. The player was meant to be distracted in the meanwhile dealing with more Cylon Raiders. However there is always the chance that during the battle with the Raiders the player would stumble into Gauntlet and Slingshot and notice that they were quietly sitting there sending panicked messages. For this reason once the player is out of range of their wing both ships are transported way out of range of the player
Of course quite a lot had to be done to prevent them from further messing up the mission. Both ships are made stealthy and friendly stealthy, invisible (for good measure), are moved 1,000km away, given orders to play dead, given orders to remain silent and finally protected.
And I still suspect that one day I'll hear a bug report that one of the Cylon Raiders went after them. Anti-Cheating
At one point in the mission the remainder of the players wing is meant to remain behind and guard a mining vessel. The player will head off to investigate a crippled fighter and end up in a 1 on 1 combat with the infamous Cylon ace Scar. The problem was that some method was needed of checking that the player didn't decide to bring his wingmen along with him to help out. However if the player was smart enough to lead Scar back to his wingmen he shouldn't be penalised for this even if the AI later decided to follow Scar away from the mining ship it should have been guarding.
The first thing to do was to check if the player was ordering his wingmen to follow him. This was done using the little used Order SEXP. In an event before this one the reset-orders SEXP was used to make sure that only orders given after the wingmen were told to remain behind were counted. (Don't bother looking for Reset-Orders in 3.6.9. It was only added after it came out. CVS builds and 3.6.10 will have it).
A similar event was needed for Blue 2 and Blue Wing (Different events were used cause the messages were different for Blue 2 and Blue 3).
If any of those events were triggered then a nasty trap was set for the player in the form of an additional wing of ships which would go after the mining vessel. However the trap wouldn't automatically spring shut. The player had to actually be guilty of getting his wingmen to abandon their duty. If he relented and sent them back to guard the miners the trap might be avoided.
First thing that had to be checked was if the player had dragged his wingmen too far away from the ship they were supposed to be guarding.
Notice the reappearance of that CONST variable? As you can see the harder the difficulty level you play on the shorter the distance you have to drag the wingmen away before they trigger the arrival of the extra wing of Raiders. Similar SEXPs were used to check for the same thing with Blue 3 or Blue wing.
Once Scar had arrived the player could order his wingmen to abandon their post and attack him directly. So this needed to be checked for too
Again the distance from the mining vessel was also checked as the second part of that AND SEXP to check that the player had dragged his wingmen out of range.
Now the entire event could be used as the arrival cue for the extra enemy wing.Double Scars
One problem with the mission was that there were two possible ways to encounter Scar. If you chose to disobey Gauntlet's orders you could follow her and encounter Scar together with the other Raiders in his wing. If you obeyed her orders you would encounter him later on in the mission on his own in a completely different area of space.
This did raise a problem. There had to be two ships in the mission with the same name. Fortunately there is an old trick to get around this. Freespace can't display certain characters that FRED can. Therefore a ship named Fractalÿ4 will appear in-game as Fractal 4 but will be treated by FRED as a completely different ship. This allowed me to give the illusion of having a ship appear to be a member of a wing which didn't actually appear during that particular run through the mission. Special music for Scar
A rather easy one this but Scar's appearance in the mission demanded the use of his own special theme tune from the show rather than the music that was being used for the rest of the mission. Use of the change-soundtrack a little earlier on in the mission allowed Scar to appear with his own distinctive theme and leave the players who knew the shows soundtrack in little doubt just who they was facing.