Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: 666maslo666 on May 19, 2011, 03:48:01 pm

Title: Event problem
Post by: 666maslo666 on May 19, 2011, 03:48:01 pm
I tried to make a freighter (Abydos) ferry passengers from and installation (Elpis) to a Drydock and back continuously. Here is the event:

Code: [Select]
$Formula: ( when
   ( <
      ( distance
         "Abydos waypoint:1"
         "GVFr Abydos"
      )
      200
   )
   ( clear-goals "GVFr Abydos" )
   ( add-goal
      "GVFr Abydos"
      ( ai-dock
         "Drydock"
         "docking point"
         "blahblah"
         89
      )
   )
   ( add-goal
      "GVFr Abydos"
      ( ai-undock 79 )
   )
   ( add-goal
      "GVFr Abydos"
      ( ai-dock
         "Elpis Installation"
         "docking point"
         "topside docking"
         69
      )
   )
   ( add-goal
      "GVFr Abydos"
      ( ai-undock 59 )
   )
   ( add-goal
      "GVFr Abydos"
      ( ai-waypoints-once
         "Abydos waypoint"
         55
      )
   )
)
+Name: Abydosjourney
+Repeat Count: 1
+Trigger Count: 99999
+Interval: 60


Proximity to Abydos waypoint should trigger Clear Goals for Abydos, and add Dock with Drydock, Undock, Dock with Elpis Installation, Undock, and Waypoint once to Abydos waypoint goals. Then the cycle repeats.

Instead the freighter only docks and undocks with the Drydock in a loop, it wont dock to the Elpis installation nor proceed to the waypoint.
Title: Re: Event problem
Post by: General Battuta on May 19, 2011, 03:49:26 pm
If the Abydos is still within 200 meters of the waypoints after 60 seconds, it will begin the whole cycle from the top as the event repeats again.

Do you just need to increase the interval time?
Title: Re: Event problem
Post by: 666maslo666 on May 19, 2011, 04:01:59 pm
If the Abydos is still within 200 meters of the waypoints after 60 seconds, it will begin the whole cycle from the top as the event repeats again.

Do you just need to increase the interval time?

Nope, I already tried to increase it up to 600 seconds with no effect, and the Abydos is obviously much further than 200 meters even by 60 seconds.
Title: Re: Event problem
Post by: General Battuta on May 19, 2011, 04:05:32 pm
Try removing the trigger count and see if it can execute the entire cycle successfully just once.
Title: Re: Event problem
Post by: 666maslo666 on May 19, 2011, 04:20:46 pm
Try removing the trigger count and see if it can execute the entire cycle successfully just once.

No change, just endless cycle of dock and undock.. 
Title: Re: Event problem
Post by: 666maslo666 on May 19, 2011, 04:43:53 pm
Test mission with similar event attached. The same problem is present.

[attachment deleted by ninja]
Title: Re: Event problem
Post by: karajorma on May 19, 2011, 05:59:00 pm
Interesting. I think I'm going to have to step through this and see exactly which orders the ship is getting in the end.

I'm pretty sure your problem is that you're trying to do everything in one event and hoping that the priorities you've given will make things work properly.
Title: Re: Event problem
Post by: ReeNoiP on May 20, 2011, 08:25:23 am
I think the problem is that the freighter still have the goal to dock once it undocks (you clear goals, then give it a bunch of new goals).

It docks ->dock goal is complete but still "in effect"->second highest priority undock triggers->it undocks, meaning the dock goal (which is still in effect) is no longer completed so->it docks

Repeat forever.

You could try setting up two sexps  which tells the ship what way to go. Something like:

Code: [Select]
SEXP 1
when delay
whatever time you want
ship is docked with target 1
clear goals
add goal
undock
dock with target 2

SEXP1
when delay
whatever time you want
ship is docked with target 2
clear goals
add goal
undock
dock with target 1
Title: Re: Event problem
Post by: 666maslo666 on May 23, 2011, 04:59:48 am
I have broken up the event into two with three add-goals each. Now it works correctly. Too many orders for one ship in a single event is thus probably not a good idea..  :nono: