Docking event question

Freeform discussion about anything related to modding Transcendence.
Post Reply
Burzmali
Militia Commander
Militia Commander
Posts: 395
Joined: Tue Aug 15, 2006 12:14 am

george, when a ship that has been tagged for events via (objRegisterForEvents) docks, a pointer to the ship is stored as aObjDocked. Is the object that the ship is docked to accessible directly?
Last edited by Burzmali on Thu Jan 25, 2007 5:12 pm, edited 1 time in total.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

You're talking about the <OnObjDocked> event?

Unfortunately, that event only fires for the station that the ship docked with (and only if you register for events).

In the next version, I've changed that so that it will fire for all stations that it docks with (and in that case, there will be a new variable with the station that the ship docks with).
Burzmali
Militia Commander
Militia Commander
Posts: 395
Joined: Tue Aug 15, 2006 12:14 am

Hmmm, looking at the "CommonwealthFleet.xml" file lead me to believe otherwise. However, if the <OnObjDocked> only fires when a tagged ship docks at the station with the event description, the following code from CommonwealthFleet won't work as intended.

Code: Select all

<OnObjDocked>
(if (eq (objGetData gSource "MissionStatus") "inprogress")
  (block (missionID)
    (setq missionID (objGetData gSource "MissionID"))
    (switch
        (and (eq missionID "mission2a") (eq aObjDocked (objGetObjRefData gSource "Target")))
          (block Nil
            (plyMessage gPlayer "Mission failed")
            (objSetData gSource "MissionStatus" "failure")
            (objUnregisterForEvents gSource aObjDocked)
            (shpCancelOrders gPlayerShip)
            )
        (and (eq missionID "mission3a") (eq aObjDocked (objGetObjRefData gSource "Target")))
          (block Nil
            (plyMessage gPlayer "Mission complete!")
            (objSetData gSource "MissionStatus" "success")
            (objUnregisterForEvents gSource aObjDocked)
            (shpCancelOrders gPlayerShip)
            )
        )
      )
    )
</OnObjDocked>
Since in mission 2a an Ares Freighter is trying to dock with an Ares station and not the CSC, aObjDocked would never equal the target freigther.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Burzmali wrote:Hmmm, looking at the "CommonwealthFleet.xml" file lead me to believe otherwise. However, if the <OnObjDocked> only fires when a tagged ship docks at the station with the event description, the following code from CommonwealthFleet won't work as intended.
I'll check again, but I believe that the code in CommonwealthFleet.xml is in error--the mission will never fail. That is one reason why I've changed the behavior in the next version.

Sorry about that.
Post Reply