Author Topic: Varying Ship Arrival Location  (Read 1259 times)

0 Members and 1 Guest are viewing this topic.

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Varying Ship Arrival Location
Hi all,

I have recently started FREDing again and after re-reading some great tutorials (particularly Axem's) I have become relatively more confident using Prompt Boxes, SEXPs like when-arguments, counting and using random variables, using dynamic waypoints (which are friggin awesome!) and other fun things like that. One mission aspect I want to incorporate more is random location arrivals. Thus I wanted to describe how I am creating that and ask if anyone else could provide some feedback or experience on doing something like this (especially since there are many very, very talented FREDers here!). 

For an example, in one of my missions I have a space station with three hangars and I wanted to have three transports escaping from the hangars. I wanted each of the three transports to randomly pick a hangar to leave from then fly in a straight line for 300 m and then jump out. The way I did this was to make three ships in each hangar. For example, in Hangar A I added ships Transport 1#A, Transport 2#A, Transport 3#A and ect for Hangar B and C. To pick the location of Transport 1 I had a variable added to a random number between 1-3. If variable PickTransport1 was =1 then Transport 1#A would spawn. Then I set up a SEXP with a when-argument that stated when Transport 1#A, #B, or #C arrived that two waypoints from Transport Path 1 would be moved to be in front of the ship (with the get coordinates function) at 10 and 300 meters. Then the AI was told to follow the path, and with a similar when-argument told to jump out when one of the 3 (Transport 1#A, #B, or #C) ships had completed that path.


This method worked well, but one caveat is that for any future events with the ship, I would likely have to use a when-argument SEXP (which isn't really a big deal). I also thought of using three small objects like hyperspace buoys as a way to have three possible locations for a ship to jump in. I created a variable and added a random number between 1-3, and then made three events after that that triggered according to the new variables number where each number corresponds to one of the three hyperspace buoys. For example if the variable became a 1, then the buoy 1 event would trigger and change the ship's arrival cues to in front of the chosen buoy.

One method I thought would be completely random would be to literally randomly choose the x, y, z coordinates randomly. So for example I made three variables (RandomX, Y, and Z) that have random numbers chosen from a very large negative number to a very large positive number. The three numbers comprise the coordinates to move a hyperspace buoy with a chained event. The ship then jumps nearby buoy. This was a bit too random though...

What I mainly wanted to ask is if the community had any recommendations, tweaks to the methods I described, tricks they were willingly to share, and/or advice about which might be the overall most efficient and least cumbersome method for making a random ship arrival. Thus, any comments or criticisms would be greatly appreciated.

Thanks!
« Last Edit: July 12, 2015, 11:15:42 am by wookieejedi »

 

Offline Axem

  • 211
Re: Varying Ship Arrival Location
For your first situation, you could store the actual arrived ship's name in a variable and always refer to that for future events. Just make sure the default value you use refers to an actual present ship since FRED looks at that for validating certain sexps. It might cut down on your complexity a bit.

I have been in your situation before and there's not much else to add to your own ideas. Like you, the only trick I've used is to use invisible points as an Near Ship anchor for arrivals. I place the invisible points either at semi-predetermined locations (I lay down waypoints and then set-object-position on the point from a randomly selected waypoint point) or just completely random. The problem with completely random is, like you said, it can be too random!

  

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Varying Ship Arrival Location
Thanks for the quick reply! Wow the legend himself!

For your first situation, you could store the actual arrived ship's name in a variable and always refer to that for future events. Just make sure the default value you use refers to an actual present ship since FRED looks at that for validating certain sexps. It might cut down on your complexity a bit.

Oh that's a nice idea...thanks!

Cool, I'm glad there wasn't some sort of glaring obvious solution that I hadn't seen to random location arrival...I very much appreciate your help!