Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: IPAndrews on April 07, 2003, 09:50:35 am

Title: FRED problem
Post by: IPAndrews on April 07, 2003, 09:50:35 am
I have a shuttle and 2 freighters. I want the shuttle to do the following:

1. dock freighter 1
2. undock freighter 1
3. dock freighter 2
4  undock freighter 2.

I want it to repeat this a very large number of times (for the sake of argument lets say 1,000,000). How can I achieve this in FRED without writing 1,000,000 * 4 events?

Be warned, I do not think this is a trivial problem. I have been looking at it for a number of days and cannot find a solution.
Title: FRED problem
Post by: diamondgeezer on April 07, 2003, 10:27:39 am
Er... repeats not going to work?
Title: FRED problem
Post by: KARMA on April 07, 2003, 10:28:06 am
i'm not a fredder but i think that if there isn't a solution, it is something that should be reported to scp since it sound important... maybe allowing something like -dock freighter group- to have docking with all the ships in a wing
Title: FRED problem
Post by: karajorma on April 07, 2003, 01:07:18 pm
Um. Is there something you`re not telling us? I got this one to work using two events in 5 mins.

Take the two ships and time how long it takes to do the run between them (in both directions cause it might take longer in one direction)

I set up to Argos with a 40 second run.

Event 1 : Repeats  Interval Time 120

when
-true
-add-goal (ai-dock Argo 1 etc)

Event 2 : Repeats Interval Time 120

when
-has-time-elapsed
--60
--add-goal (ai-dock Argo 2 etc)

Since the interval time is half the time before event 2 goes of the two are exactly out of phase. One event is always in it's interval time while the other is being executed.

EDIT : Don`t try using had-docked-delay or you`ll be there all night :D Since you can't pass a variable to it as an arguement there is no way to increase the number of times the ship has docked so the event becomes immediately true every time it's interval time is up regardless of if the ship is docked or not. :)
Title: FRED problem
Post by: Goober5000 on April 07, 2003, 01:19:56 pm
Quote
Originally posted by karajorma
Since you can't pass a variable to it...


You can using the SCP. ;)

I don't know how much it would help, though.  That two-event system is what I was thinking of as well.  Seems the simplest and most efficient way to solve the problem.
Title: FRED problem
Post by: karajorma on April 07, 2003, 01:28:44 pm
Quote
Originally posted by Goober5000


You can using the SCP. ;)


Really? I`ll give that a go. Using has-docked would be better because it eliminates the possibility of error due to a ship being knocked off course. I didn`t test to see what would happen if something delays the ship so that it doesn`t make it to the docking point.
 Most likely it would just turn around and head back the way it came when the other event kicks in.
Title: FRED problem
Post by: Goober5000 on April 07, 2003, 01:31:35 pm
Yeah, I went through and replaced all the straight test-the-argument checks with evaluate-the-argument checks.  The previous way prevented any sexps from being used as values.

Not sure what version it's in, though.  Try the 3.5.1 unofficial update.
Title: FRED problem
Post by: Petrarch of the VBB on April 07, 2003, 02:14:09 pm
And what update is this? Does it have your new ultra-SEXPs?
Title: FRED problem
Post by: IPAndrews on April 09, 2003, 07:05:17 am
Well I was trying to do it the has-docked-delay way. The time dependant method will work for one mission where this activity is happening in the background and is unimportant. What I've been told about has-docked-delay not using variables does scupper another nice mission I was doing though where shuttles on opposing sides are flying around capturing and recapturing freighters.
Title: FRED problem
Post by: karajorma on April 09, 2003, 07:25:17 am
Quote
Originally posted by IPAndrews
Well I was trying to do it the has-docked-delay way. The time dependant method will work for one mission where this activity is happening in the background and is unimportant. What I've been told about has-docked-delay not using variables does scupper another nice mission I was doing though where shuttles on opposing sides are flying around capturing and recapturing freighters.


I assume this is for TBP. Just write the mission and when TBP gets it's own source code version you can bring it in :)