Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: AV8R on February 08, 2015, 07:58:54 pm

Title: First Attempt at FREDing Part 3
Post by: AV8R on February 08, 2015, 07:58:54 pm
Ok, so I'm starting to get the hang of this FREDing thing and discovering SEXP is not so scary (provided that I'm using the built-in editors - other than that I'd be lost). Now I'm starting to add Events to my mission so I can add Comms and other stuff, but there is one thing that still eludes me.

There is only one waypoint in the mission and that is right in the middle of the jump node. The only ship that is using that waypoint is the Sathanas so it knows how to get to the jump node to escape. The other ships - 6 corvettes as well as bombers and fighters - do not use any way points. Their movements are governed by the Sathanas as it moves toward the jump node (although they all stay near the Sathanas since they are all ordered to destroy it).

The problem I have is this: since the attacking corvettes are not using any waypoints - how can I adjust their speed? It's easy when a ship is using a waypoint as you can use the "cap-waypoint-speed" command to make adjustments. I've tried to set the corvettes' speed in the Initial Status box in the Ship Editor, but that value gets ignored and they end up going "full speed ahead" (35) after jumping in. This eventually causes them to bunch up closely around the sides of the Sathanas (just behind the forward arms) where they can't use their forward beam cannons anymore. It's only at this point does the corvettes' AI slow the ships to match the Sathanas' speed.

I'd like the corvettes to kind of "hang back" behind the Sathanas while letting loose with their forward beam cannons - but to do this, I would have to find a way to either initially slow them down or get the corvettes to match speed with the Sathanas sooner than when it's too far ahead of the Sathanas to do any good.

Any suggestions?   :confused:
Title: Re: First Attempt at FREDing Part 3
Post by: karajorma on February 08, 2015, 08:08:44 pm
Use waypoints for them. You really can't do this sort of thing with the ai.
Title: Re: First Attempt at FREDing Part 3
Post by: niffiwan on February 08, 2015, 08:14:40 pm
I think there's some way you can set a dynamic waypoint, so that each corvette follows a waypoint that's positioned relative to the Sathanas.   Unfortunately I don't know how to implement such a thing, maybe someone else has more experience with it?
Title: Re: First Attempt at FREDing Part 3
Post by: X3N0-Life-Form on February 09, 2015, 06:54:46 am
I think there's some way you can set a dynamic waypoint, so that each corvette follows a waypoint that's positioned relative to the Sathanas.   Unfortunately I don't know how to implement such a thing, maybe someone else has more experience with it?
The easiest way to do that is to use a waypoint path with a single waypoint, order a ship to follow it, then move the waypoint around using set-object-position, get-object-position and arithmetic operators (+, -) to set it where you want your ship to go relative to the target.

Here is a sample SEXP I'm using to update a waypoint's position every 5 seconds.
Code: [Select]
( when
    ( true )
    ( set-object-position
         "Apep path:1"
         ( get-object-x "Sathanas" )
         ( - ( get-object-y "Sathanas" ) 3500 )
         ( get-object-z "Sathanas" )
    )
)
Title: Re: First Attempt at FREDing Part 3
Post by: Lepanto on February 09, 2015, 09:02:31 pm
But yeah, just give the attacking corvettes waypoints and use cap-waypoint-speed. When you want capships to move around, they should usually be following waypoints. There are some places you can get away with just giving them attack orders, like when you're sure a particular attacking capship will destroy its target or be destroyed before it reaches turning-fight range. Otherwise, the capship AI is too clumsy to do much on its own, so you need to hold its hand with waypoints.

Save the fancy waypoint tricks until you've got basic FREDding down, unless you really need them for a specific mission.

And keep at it! (Almost) all the greatest FREDders in this community probably had amateurish first missions.
Title: Re: First Attempt at FREDing Part 3
Post by: procdrone on February 09, 2015, 09:16:46 pm
Have you read the tutorials, and such? Read what SEXP's do on the Wiki, read everything you can from the Wiki http://www.hard-light.net/wiki/index.php/Portal:FRED (http://www.hard-light.net/wiki/index.php/Portal:FRED) - It clears a lot, really, a lot.

If you are after more serious solutions, or any tricky examples... just take out some missions from ready campaigns, and look into their event chains, sexp, and all.

Yea. everybody starts a newbie, but only few persisted... keep at it, and eventually you will find that your campaigns are praised by HLP members!
Title: Re: First Attempt at FREDing Part 3
Post by: AV8R on February 10, 2015, 05:13:11 pm
The easiest way to do that is to use a waypoint path with a single waypoint, order a ship to follow it, then move the waypoint around using set-object-position, get-object-position and arithmetic operators (+, -) to set it where you want your ship to go relative to the target.

Here is a sample SEXP I'm using to update a waypoint's position every 5 seconds.
Code: [Select]
( when
    ( true )
    ( set-object-position
         "Apep path:1"
         ( get-object-x "Sathanas" )
         ( - ( get-object-y "Sathanas" ) 3500 )
         ( get-object-z "Sathanas" )
    )
)

Why would you want to move the waypoint constantly? It seems a little counter-productive. Yet, there has to be a good reason why you're doing this though.
Title: Re: First Attempt at FREDing Part 3
Post by: AV8R on February 10, 2015, 05:21:04 pm
But yeah, just give the attacking corvettes waypoints and use cap-waypoint-speed. When you want capships to move around, they should usually be following waypoints. There are some places you can get away with just giving them attack orders, like when you're sure a particular attacking capship will destroy its target or be destroyed before it reaches turning-fight range. Otherwise, the capship AI is too clumsy to do much on its own, so you need to hold its hand with waypoints.

This may be difficult since the corvettes come in at random jump points. They come in anywhere around the Sathanas and move in from there (I don't have jump points programmed in - I just tell them to jump in 6000m from the Sathanas and the game just does the rest). That's why I really can't set waypoints for each ship - I don't know where they're gonna jump in. I'd have to set jump-in coordinates for each of the 6 corvettes if I want to have them follow a specific waypoint that won't cross over or intersect with the Sathanas.

Title: Re: First Attempt at FREDing Part 3
Post by: AV8R on February 10, 2015, 05:24:05 pm
Have you read the tutorials, and such? Read what SEXP's do on the Wiki, read everything you can from the Wiki http://www.hard-light.net/wiki/index.php/Portal:FRED (http://www.hard-light.net/wiki/index.php/Portal:FRED) - It clears a lot, really, a lot.

If you are after more serious solutions, or any tricky examples... just take out some missions from ready campaigns, and look into their event chains, sexp, and all.

Yea. everybody starts a newbie, but only few persisted... keep at it, and eventually you will find that your campaigns are praised by HLP members!

I'm really trying to learn - although the finer points of this exercise are still difficult to absorb. I'm not trying to build a fabulous campaign - I'm just trying to build a fun single-mission time-waster that makes me feel good.
Title: Re: First Attempt at FREDing Part 3
Post by: Lorric on February 10, 2015, 06:13:44 pm
Why would you want to move the waypoint constantly? It seems a little counter-productive. Yet, there has to be a good reason why you're doing this though.
The idea there is that the waypoint moves with the Sathanas, so the ships you want to follow the Sathanas will follow the Sathanas.
Title: Re: First Attempt at FREDing Part 3
Post by: AV8R on February 10, 2015, 06:30:23 pm
I get that, but why not just set a waypoint way far away (like I already have in my mission - 10,000m away) and have all ships follow that? The only issue I see is the eventual convergence of all ships toward the waypoint (thus mashing them all together as they reach the waypoint).
Title: Re: First Attempt at FREDing Part 3
Post by: Lorric on February 10, 2015, 06:46:13 pm
Well if it keeps them following behind the Sathanas where you want them, then it's fine. And if the waypoint is far enough away, then you should have no issue with the ships all crushing together.
Title: Re: First Attempt at FREDing Part 3
Post by: mjn.mixael on February 10, 2015, 10:21:30 pm
Depending on what ships you have following the Sath, you may need to cap-waypoint-speed so they don't pass up the Sath while they are trying desperately (like all good AI pilots) to reach the waypoint.
Title: Re: First Attempt at FREDing Part 3
Post by: X3N0-Life-Form on February 11, 2015, 02:59:14 am
I get that, but why not just set a waypoint way far away (like I already have in my mission - 10,000m away) and have all ships follow that? The only issue I see is the eventual convergence of all ships toward the waypoint (thus mashing them all together as they reach the waypoint).
Well, that way you are sure that any ship will be going towards the Sathanas wherever he is from whatever angle. A bit overkill for your mission perhaps, but my answer was more of a followup on niffi's post anyway.

And in any case, mjn is right, you might want to have your capships match the Sathanas' speed once they get in range.
Title: Re: First Attempt at FREDing Part 3
Post by: AV8R on February 12, 2015, 03:23:05 pm
How about this: I create a second waypoint (waypoint2) just behind the Sath and have the 6 corvettes head toward it. But before they all meet at waypoint2 and crash head-on, I can have an event occur a couple of minutes into the battle that changes the corvettes' direction from waypoint2 behind the Sath to waypoint1 in the jump node ahead of the Sath. This way the corvettes will turn around and head in the same direction as the Sath after they've all made some progress toward the rear of the Sath. I can then cap their speed to keep them there.

What do you all think? Is this idea feasible? Can you change a ship's waypoint before it actually reaches it by using an event? Like "if-whatever-occurs" then have each corvette "head-to-waypoint1".

Thanks for all of your input.   :yes:
Title: Re: First Attempt at FREDing Part 3
Post by: crizza on February 12, 2015, 05:18:17 pm
Honestly? Do X3nos suggestion... It looks easy and will do the job way more efficently...
Title: Re: First Attempt at FREDing Part 3
Post by: niffiwan on February 12, 2015, 07:32:40 pm
Can you change a ship's waypoint before it actually reaches it by using an event? Like "if-whatever-occurs" then have each corvette "head-to-waypoint1".

Yes, that's possible, for instance you could use something like "when distance from waypoint 1 < 1000 metres, clear orders, set orders to fly to waypoint 2"