modding:xml:missiontype
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
modding:xml:missiontype [2014/12/27 04:40] – external edit 127.0.0.1 | modding:xml:missiontype [2017/01/31 22:22] – Fixed links to functions xephyr | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | NOTE: MissionType elements were introduced in preview form in 1.08g; they will be improved an modified in 1.08h. | ||
- | |||
=====Overview===== | =====Overview===== | ||
- | < | + | < |
A mission object contains all of the state for a mission, including the goals of the mission, the player' | A mission object contains all of the state for a mission, including the goals of the mission, the player' | ||
==== Mission Lifecycle ==== | ==== Mission Lifecycle ==== | ||
- | To create a mission, the developer should call [[msnCreate]] with the UNID of the MissionType to create and the owner object. Missions are generally associated with an //owner// object (such as a station) which gives the mission and the reward on completion. When created, the OnCreate event is called on the MissionType. The event should gather all the information necessary to describe the mission (for example, it may pick a target for the mission) and store information as data in the mission object. If for some reason, the mission cannot be created (e.g., imagine that a proper target could not be found), the code should call msnDestroy inside of OnCreate. You may also register notification events with functions such as [[msnRegisterForEvents]] and [[msnAddRecurringTimerEvent]]. | + | To create a mission, the developer should call [[modding: |
- | When first created, a mission is //open//. An open mission is a mission that has been defined (e.g., a target has been chosen) and is available for the player to accept. You may obtain a list of open mission with the [[msnFind]] function. For example: | + | When first created, a mission is //open//. An open mission is a mission that has been defined (e.g., a target has been chosen) and is available for the player to accept. You may obtain a list of open mission with the [[modding: |
(msnFind gSource " | (msnFind gSource " | ||
Line 17: | Line 15: | ||
(scrShowScreen gScreen & | (scrShowScreen gScreen & | ||
- | Where // | + | Where // |
If the player accepts the mission, the mission' | If the player accepts the mission, the mission' | ||
- | In certain cases you may want a mission to proceed without the player. In that case, you may call [[msnSetUnavailable]]. msnSetUnavailable may only be called when a mission is //open//; it calls OnStarted and removes it from the list of open missions. Once unavailable, | + | In certain cases you may want a mission to proceed without the player. In that case, you may call [[modding: |
Use the OnStarted event to begin mission actions that should only happen after the mission is running (either because the player accepted or because the mission started without the player). For example, in an escort mission, a freighter might leave the station in the OnStarted event. | Use the OnStarted event to begin mission actions that should only happen after the mission is running (either because the player accepted or because the mission started without the player). For example, in an escort mission, a freighter might leave the station in the OnStarted event. | ||
Line 27: | Line 25: | ||
The OnSetPlayerTarget event is called at various points to allow the mission to set ship orders for the player. The event is called when the player accepts a mission, when the player completes a mission, and after the player is debriefed (to allow you to cancel orders). This event is also called when the player enters a system. | The OnSetPlayerTarget event is called at various points to allow the mission to set ship orders for the player. The event is called when the player accepts a mission, when the player completes a mission, and after the player is debriefed (to allow you to cancel orders). This event is also called when the player enters a system. | ||
- | If a mission succeeds (e.g., the target was destroyed) you should call the [[msnSuccess]] function. This will call the OnCompleted event, which you may use to clean up the mission, if necessary. If a mission fails, you should call the [[msnFailure]] function, which also calls OnCompleted. Note that the engine automatically unregisters | + | If a mission succeeds (e.g., the target was destroyed) you should call the [[modding: |
If a mission has completed but the player has not yet been debriefed, docking with the mission owner station will automatically bring up the dsRPGMission screen and debrief the player. The OnReward event will be triggered, which allows you to (e.g.) pay the player for completing the mission. | If a mission has completed but the player has not yet been debriefed, docking with the mission owner station will automatically bring up the dsRPGMission screen and debrief the player. The OnReward event will be triggered, which allows you to (e.g.) pay the player for completing the mission. | ||
Line 194: | Line 192: | ||
* id=" | * id=" | ||
* id=" | * id=" | ||
+ | |||
+ | |||
+ | ==== See Also ==== | ||
+ | |||
+ | [[modding: | ||
+ | |||
+ | [[Modding: |
modding/xml/missiontype.txt · Last modified: 2017/02/07 01:26 by 0xabcdef