It all works very well thanks to the help of community members.
The player accepts the mission to go to a station, accept supplies from that station and deliver them to the owner station (Fleet settlement).
There is, however, no check against available cargo space in the playership hold. This could lead to the playership being overfilled.
I currently have the 'destID' station showing a different dockscreen if the player cannot fit all of the supplies. This dockscreen tells the player "you don't have enough room, come back later". Unfortunately pressing the "Continue" action in this screen does nothing, the same screen still shows. Another second press of "Continue" will undock the playership.
Ideally the "Continue" action would show the station's normal main dockscreen. This is what happens when the player does have enough room and collects the supplies. This would allow the player the option to sell some cargo to that station to make more room.
If the player did sell some items to the station it would require an undock and redock to get the supplies but this is acceptable IMO.
Is there a way to show another dockscreen in the destID station and then access the standard station's dockscreens using <OnDeliveryMissionCompleted>?
A search of other missions shows the <OnPaneInit> event in 'paneInitMissions. There is also the <OnGetNextScreen> event. Possibly one of these could be used instead?
Relevant code:
Code: Select all
<OnDeliveryMissionCompleted>
;This code runs when the mission has been accepted and the playership
; docks with the 'destID' station.
;If the player cannot fit all the supplies we tell them - show
; 'descFitNone' - to have more cargo space available.
;Once they have enough room, we add the supplies to the playership.
;We set 'msnData 'destID' to Nil to stop a special dockscreen from
; showing again.
;And we change 'msnData 'status' to 'gotSupplies' to reset the player
; target and allow us to check for mission completion when the
; playership docks with the owner station.
;The screen description 'descGotSupplies' shows on docking with the
; destination station, then the standard station dockscreen.
(block (
(fitCount (objGetFitCount gPlayerShip (msnGetData gSource 'supplies)))
)
(switch
(eq (msnGetData gSource 'status) 'needSupplies)
(switch
(geq fitCount 4)
(block Nil
(objAddItem gPlayerShip (msnGetData gSource 'supplies))
(msnSetData gSource 'destID Nil)
(msnSetData gSource 'status 'gotSupplies)
(msnSetPlayerTarget gSource)
(msnTranslate gSource 'descGotSupplies)
)
{
desc: (msnTranslate gSource 'descFitNone)
forceUndock: Nil
}
)
)
)
</OnDeliveryMissionCompleted>