Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: AV8R on December 22, 2014, 07:27:43 pm
-
So I finally got up the gumption to create a simple scenario in FRED - and I found how un-simple it really is. It seemed like it would be easy but there are so many variables in the SEXP language that you'd have to be a C++ programmer to get things to happen the way you want.
The Scene: A Sathanas is trying to escape to a jump node but a coalition of Terran and Vasudan corvettes intercepts it and attempts to destroy the juggernaut before it reaches the jump node (while I watch in a stealth fighter).
The problem: I can't get the Sathanas to move toward the jump node, even though I set the speed at 10 in the editor - it starts at 0 and stays at 0. If I give it an initial command to warp out after 900 seconds (15 minutes) it either jumps out immediately or never jumps.
What am I doing wrong? :banghead:
-
Have you tried the FRED2 walk-through? It should explain the concepts you're trying to execute here.
-
Do the FRED walkthrough.
Use waypoints.
beam-free-all
-
If you're talking about the web-based walk-through in the Help menu, it was little help to the layman. Talk of SEXP dependencies with little or no examples and most of the variables greyed-out in the menu make it difficult to comprehend. Based on the information in the Advanced Walk-Though, I still can't figure out how to make/construct a waypoint or series of waypoints.
There has to be an easier way. :confused:
-
Select way point from the drop down menu, drop it on the grid the same way you'd put down a ship (aka, holding down ctrl). Any nav point you drop after you have one selected will create a path. Then in the ship editor, give your sathanas the order to follow a nav point once.
-
So I would have to create 2 waypoints? One by the Sathanas and another in the Jump Node so the Sathanas will follow it? I saw in the documentation something about using the Jump Node as a waypoint but couldn't figure out how to do that. I tried to find it, but there was no easy way to tell the Sathanas "Go to the Jump Node and warp out". :D
The problem with the design I chose is the Sathanas is 7500m away pointing at 90 degrees from the player's entry point. The Jump Node is 7500m Z and 10,000m X from the player. This means the Sathanas has to travel 10,000 on a perpendicular course from the player to reach it's goal. And while I can drop a waypoint close to the player's entry point, I found no way to edit it once it's on the grid so it is within the Jump Node - unlike editing ship locations which is quite easy.
I'm just not getting it with these waypoints. :sigh:
-
I think you just need a single waypoint located at the jump node. Then give the Sathanas initial orders of "ai-waypoints-once" with the waypoint as the argument
(ps, I'm not sure how to move a waypoint after its been placed either.. but I've hardly used FRED and have done most of my mission "creation" with a text editor)
-
You don't need to move the waypoint for this. All you need to do is this.
1. Place a waypoint in or near the jump node.
2. Give the sathanas ai-waypoints-once orders
3. Create a SEXP that measures the distance between the waypoint (or the jump node) and the Sathanas, and tells it to ai-warpout once it gets that close. (Or you could ignore the ai-warpout and simply make that the departure cue for the sathanas).
That should be all you need to do in order to make the Sathanas move towards the jump node and jump out once it gets there.
-
Ok, I got step 1 down (I created a waypoint and now it magically allowed me to edit it's position which I made in the center of the jump node). Since the waypoint is now established, they became options to choose in the Initial Orders; "Behavior" and "Object" drop downs (there are obvious dependencies to unlock these options).
Step 3 is going to problematic - while I know the distance from the Sathanas' original position and the jump node (approx. 10,000m), I have no idea how to write that in a SEXP statement. In the Edit Ship dialog box, I'm surprised that the jump node is not an option in the Departure Cue target dropdown. Seems logical, no?
-
Well that worked - sort of. The Sathanas now moves to the Jump Node but moves at its top speed (25). So it makes it to the jump node way before the 15 minutes is up. I imagine to slow it down is gonna take SEXP programming, right?
I just don't get SEXP from the walk-through. And why are most of the selections greyed-out? I know they are not all relevant at any given time but If I can't see the selections, how I can know what to choose? :mad:
-
You want to use "cap-waypoint-speed", and I think you need to create a separate event and use that as the Sathanas arrival cue. Probably something like:
( when
( has-arrived-delay "Sathanas" 0 )
( ai-waypoints-once "Sathanas" "Waypoint" 89 ) (89 is the order priority, higher values will be done before lower values)
( cap-waypoint-speed "Sathanas" 10 ) (10 is the speed you want to cap the ship to)
)
and the arrival cue becomes:
( is-event-true-delay "event name" 0 )
As for why most of the sections are greyed out? As you've guessed, probably because those sexps are not relevant at that time or in that place. If you go to the events editor, practically everything should be available there *somewhere*. i.e. only when or when-argument will be available for the 1st part of the event because that's practically all that's ever valid to put there.
If you want a (mostly) complete list of sexps, run FSO with the "-output_sexps" command line parameter. This will drop a file (sexps.html) in your FSO directory that should have documentation on most of the available sexps.
-
ninja'd by Niffiwan but I might as well post. :)
when
- <=
-- distance
--- Sathanas
--- Waypoint 1
- add-ai-goal
-- ai-warpout
-- 89
That should work from the Event Editor. You could also use the first half as a departure cue from Ship Editor.
Slowing the ship down is pretty easy too. You need to use the cap-waypoints-speed SEXP (I think that's what it's called, I don't have FRED with me here). Simply set the maximum speed to 15 and the Sathans will respect that (initial speed is just that, the speed of the ship when the mission starts).
As for the greyed out SEXPs, FRED will automatically grey out SEXPs you can't use. So all the change SEXPs will stay greyed out until you right click on do-nothing. All the status SEXPs only work when you right click on true. After a while it becomes second nature actually, but if you want a list of SEXPs you can actually set an option in the launcher to output them to a html file. Look in the troubleshooting section.
You want to use "cap-waypoint-speed", and I think you need to create a separate event and use that as the Sathanas arrival cue. Probably something like:
( when
( has-arrived-delay "Sathanas" 0 )
( ai-waypoints-once "Sathanas" "Waypoint" 89 ) (89 is the order priority, higher values will be done before lower values)
( cap-waypoint-speed "Sathanas" 10 ) (10 is the speed you want to cap the ship to)
)
and the arrival cue becomes:
( is-event-true-delay "event name" 0 )
You could actually use
when
-true
if you want the Sathanas present at mission start. What you've got will make the Sathanas actually jump in (which may or may not be what AV8R wants).
-
The way the mission is currently constructed, the Sathanas is already in system and heading for the jump node. 3 Vasudan Corvettes warp in 5 seconds after the mission starts and 3 Terran Corvettes jump in 10 seconds after mission starts - all ships are then beam free (all of this was somewhat simple to set up when I found where all of the options were by poking around in the various editors - and all without using SEXP).
It's just the frakkin' Event Editor - while being the most powerful part of FRED, it is in no way easy to understand/learn. I have written many complex DOS-based batch files in my life using many if/then dependencies and, while I get that the Event Editor kind of works in the same way, I just can't wrap my head around the construction of the statements.
Now I understand why Niffiwan may like to do this in a text editor - once you know the specific commands it's probably easy enough to string together a list of events without the Event Editor's UI getting in the way. :ick:
-
Take a step back and breathe.
The Event Editors is not that hard. Any event basically boils down to:
when <- "If this happens..."
do-nothing <- "... do everything listed here."
You right-click and replace the "when" with whatever "if" conditions you want. When a ship has arrived, when its waypoints are done, when it has undocked, etc. Use operators like and/or/not the same way you'd use &&, || and ! when making an if statement.
Then, you right-click and replace the "do-nothing" with whatever you want to do as a result of the above conditions. Send some messages, give some AI orders, change the waypoint speed, etc. You can right-click "Add Operator" to do more than one thing.
The actual right-click menu is an exhaustive list of sexps. Not everything is relevant, which is why it grays out what isn't. As with programming language conditionals, you wouldn't put an assignment in the "when" statement. For example, it makes no sense to say "if (sendmessage("hello world")) {i++;}" :nod:
-
You could actually use
when
-true
if you want the Sathanas present at mission start. What you've got will make the Sathanas actually jump in (which may or may not be what AV8R wants).
Good point, I'm still learning the intricacies of FREDing myself :)
Now I understand why Niffiwan may like to do this in a text editor - once you know the specific commands it's probably easy enough to string together a list of events without the Event Editor's UI getting in the way. :ick:
Well, I use a text editor because I primarily run Linux and therefore have issues running FRED ;) Although when I recently acquired an old Windows laptop and tried some FREDing on it, the event editor did seem a bit awkward to use at first, especially when using an unfamiliar trackpad.
-
Wine doesn't run FRED well? I'd be surprised. FRED doesn't strike me as a particularly complicated program, and Wine has certainly improved by leaps and bounds over the years. Heck, the last time I was on Linux, I used Wine to play all the way through Borderlands 1. In multiplayer. With voice chat! :D
-
Take a step back and breathe.
The Event Editors is not that hard. Any event basically boils down to:
when <- "If this happens..."
do-nothing <- "... do everything listed here."
You right-click and replace the "when" with whatever "if" conditions you want. When a ship has arrived, when its waypoints are done, when it has undocked, etc. Use operators like and/or/not the same way you'd use &&, || and ! when making an if statement.
Then, you right-click and replace the "do-nothing" with whatever you want to do as a result of the above conditions. Send some messages, give some AI orders, change the waypoint speed, etc. You can right-click "Add Operator" to do more than one thing.
The actual right-click menu is an exhaustive list of sexps. Not everything is relevant, which is why it grays out what isn't. As with programming language conditionals, you wouldn't put an assignment in the "when" statement. For example, it makes no sense to say "if (sendmessage("hello world")) {i++;}" :nod:
Thanks. I get the concept of how it's supposed to work, I just don't know what exactly to enter to make things happen the way I want. So here goes the FRED noob asking for how make proper statements that FRED can understand.
So when I create a new event in the Event Viewer it gives me:
New Event
when
true
do-nothing
So I should replace that with:
New Event
when
Sathanas reaches Jump Node 0
Jump out
It can't be that simple. The trouble is, I don't see those as choices anywhere in the right click menus. Just a lot a various operand choices.
The problem here is I don't know how to tell the Event Editor what I want it to do because I don't speak it's language. This is what I need help with. Once I learn this relatively simple task from this first try, it'll probably come easier next time. The first time is always going to be a leaning curve.
So to reiterate, what I'm trying to accomplish in this simple exercise is:
1) Have the Sathanas (which is already in system) travel to the jump node (waypoint) and jump out.
2) Reduce the speed of the Sathanas to 10 (because it defaults to 25)
So what selections do I make in the Event Editor and what exactly to I type in the data fields to make this work?
-
Well, I got my mission working the way I wanted - and I didn't use a single line of SEXP. :p
Seems you can do quite a bit just using the Ship Editor Initial Orders dialog box as well as the Wing Editor Initial Orders. You can make ships and wings do pretty much anything you want. Is it the best way to handle multiple dependencies or very complex scenarios? Well, probably not. But for a straight-forward, somewhat linear missions, it works quite well.
How I got around my 2 issues mentioned earlier were to start the Sathanas twice as far away from the jump node than I initially designed. This way it could travel at its default 25 and not get to the jump node too soon. The second issue was right in front of my face in the Ship Editor Initial Orders box. For the first order I simply told it to head for the waypoint using the Waypoint Once order with a high priority (80). I then used the second order to tell it to Warp with a lower priority (50) so it would jump when it reached the jump node. Piece of cake! :yes:
The rest of the mission just took a little tweaking - and during gameplay, a little luck (I have 6 corvettes swarm the Sathanas from all directions at close range. But if any of the corvettes jump in facing the Sathanas they're toast - those 4 huge beams will destroy the corvette in seconds!) But that's ok, being a corvette down just makes it a little more challenging to stop the Sathanas before it reaches the jump node. Great fun!
Thanks everyone for your input. I'm sure that in the future if I want to create more complex missions I'll have to learn SEXP, but for now I just wanted to keep it simple. Mission accomplished. ;)
So, is there a repository here (or elsewhere) where members can share single Fredded missions for others to try/enjoy? I'd like to try some of your standalone missions.
-
Single missions aren't very popular here, I'm afraid. You could post yours though, as an attachment or something.
Beginner FREDders often face headaches; don't get discouraged if FRED doesn't quite make sense yet! :D
-
Wine doesn't run FRED well? I'd be surprised. FRED doesn't strike me as a particularly complicated program, and Wine has certainly improved by leaps and bounds over the years. Heck, the last time I was on Linux, I used Wine to play all the way through Borderlands 1. In multiplayer. With voice chat! :D
When I've previously tried it (3.6.14 - 3.6.18) most things seemed to work except saving, which kinda makes it entirely useless :) When I tried it just now (3.7.2 RC2 & RC4), the main window didn't even draw properly, just had random-seeming stuff from my other windows; so yeah, not sure exactly what's quirky about it but I haven't had much luck, even though (as you say) many other games & programs run well under Wine.
-
When I've previously tried it (3.6.14 - 3.6.18) most things seemed to work except saving, which kinda makes it entirely useless :) When I tried it just now (3.7.2 RC2 & RC4), the main window didn't even draw properly, just had random-seeming stuff from my other windows; so yeah, not sure exactly what's quirky about it but I haven't had much luck, even though (as you say) many other games & programs run well under Wine.
There may be a valid reason for this. Even in a Windows 7 environment with a fast processor and a pro-series video card, I noticed that clicking and dragging open dialog boxes around in FRED causes the box to "smear" (the same effect when you win a game of Windows Solitaire and the cards fall from the top of the screen leaving trails behind). That's either caused by the program taking up so much processor priority that screen redraws become a lesser priority or poor interaction between FRED and the video driver - maybe instead of using the video card's optimized renderer, FRED is using a software renderer instead? I don't know. I'm just guessing. But it's pretty clear that the FRED program/renderer isn't working like it should in Windows which is probably why it's not to behaving properly in your Wine emulator.
-
I really want to say that I've seen that kind of "smearing" behavior before in Vista or XP, but I don't remember. That problem sounds familiar. I'm talking about the old school retail FRED more than the improved FSOpen one, though.
So when I create a new event in the Event Viewer it gives me:
New Event
when
true
do-nothing
So I should replace that with:
New Event
when
Sathanas reaches Jump Node 0
Jump out
It can't be that simple.
For that case specifically, you already found that Departure Cues can do this and that would be the preferable solution. If you wanted to express this in an Event, however, it would look like this:
Sathanas Departure
when
are-waypoints-done-delay //(right-click on "true" and Replace Operator -> Objectives -> are-waypoints-done-delay)
Sathanas //(right-click, select the Sathanas)
Waypoint1 //(right-click, select the name of the waypoint you want this to happen at)
0 //(optional: right-click and replace with the time delay, in seconds, between the Sathanas reaching the waypoint and making this event true)
add-goal //(right-click on "do-nothing" and Replace Operator -> Change -> add-goal)
Sathanas //(right-click, select the Sathanas)
ai-warp-out //(right-click on "ai_chase," which is the default, and Replace Operator -> Ai goals -> ai-warp-out)
89 //(priority of this order - leave it at 89 since you really want this to happen)
As you probably saw if you did the above example, the "if" parts of your "if-then" conditional are kind of scattered, but are mostly located in Objectives, Status and Events/Goals. The "then" parts are mostly located in Change. The different sub-menus become relevant or grayed-out as needed. For example, Ai Goals is only relevant when you're doing something related to changing the goals, such as the add-goal command.
So yes, the end result is almost "that simple," but remembering where the different commands are located is just something you have to get used to through practice. It eventually becomes second nature. Most events are constructed along these lines, and get combined with stuff in the Logical menu (and, or, not, etc) as needed to form more complex conditional statements.
Now, let's say for a moment that you had two Sathanas (Sathanases?) and wanted them to warp out. Using the above sexp, you can right-click on the "when" and do Add Operator -> Change -> add-goal. This adds another add-goal which you can fill in however you want. Now, your event does two things when the waypoints are done. It's like saying, "If this is true, then do that and that."
-
Just a minor point. I strongly suggest checking the distance from the waypoint rather than actually using are-waypoints-done-delay. Occasionally a capship will miss a waypoint by a metre or two. Without any other orders the ship will then swing round and try to hit it again. This can result in a capship reaching the end of its run only to start breakdancing around on the spot.
This behaviour might have been fixed in FSO by now but even if it hasn't, I still find the distance thing to just as easy to do.
-
This can result in a capship reaching the end of its run only to start breakdancing around on the spot.
You mean, this isn't what you want? :lol:
-
Well maybe if you're programming JAD or DEM. For a serious campaign, probably not so much. :p
-
Axem actually made a GEDDAN effect, didn't he? :D
-
Nope, that was Goober! (DEM:Interlude)
-
Too much craziness to keep track of :nervous:
-
Without any other orders the ship will then swing round and try to hit it again. This can result in a capship reaching the end of its run only to start breakdancing around on the spot.
I'd imaging it'd probably be breakdancing to this little ditty I saw elsewhere on the board... :lol:
I like Gas Miners and I cannot lie
You other pilots can't deny
When miner walks in with an itty bitty front and that canister in yo face you get SPRUNG
Wanna get out yo guns
Cuz you noticed that miner was stuffed
Deep in the indicator that's leadin'
On the trigger and you can't stop squeezin'
Oh Rahu, I wanna get with ya
And blow yo canista
My flyboys tried to warn me
But that gas you got make me so angry
Oh is that Maxim? You say you wanna get in my ship?
Well I'll use you, and use you, because you aint that average pew pew!
Now that Rahu's dancin...
To hell with romancin'!
It's no sweat
Feeling stronger than a pimped Corvette!
I'm tired of the other wings,
Saying sentry guns are the thing
Take the average Vasudan and ask him that, it's gotta pack much gas!
So pilots! (YEAH!) Pilots! (YEAH!) Has your target got the gas?
(HELL YEAH!) Then shoot it! Shoot it! Shoot that healthy gas.
Rahu got gas.