Docking event question
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.
-
- 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).
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).
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.
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.
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>
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
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.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.
Sorry about that.