Home

Module misn

Mission Lua bindings. An example would be:
 misn.setNPC( "Keer", "empire/unique/keer" )
 misn.setDesc( "You see here Commodore Keer." )
 

Functions

misn.accept () Attempts to accept the mission.
misn.cargoAdd (cargo, quantity) Adds some mission cargo to the player.
misn.cargoJet (cargoid) Jettisons the mission cargo.
misn.cargoRm (cargoid) Removes the mission cargo.
misn.claim (systems) Tries to claim systems.
misn.factions () Gets the factions the mission is available for.
misn.finish (properly) Finishes the mission.
misn.markerAdd (sys, type) Adds a new marker.
misn.markerMove (id, sys) Moves a marker to a new system.
misn.markerRm (id) Removes a mission system marker.
misn.npcAdd (func, name, portrait, desc, priority) Adds an NPC.
misn.npcRm (id) Removes an NPC.
misn.osdActive (n) Sets active in mission OSD.
misn.osdCreate (title, list) Creates a mission OSD.
misn.osdDestroy () Destroys the mission OSD.
misn.setDesc (desc) Sets the current mission description.
misn.setNPC (name, portrait) Sets the current mission NPC.
misn.setReward (reward) Sets the current mission reward description.
misn.setTitle (title) Sets the current mission title.


Functions

misn.accept ()
Attempts to accept the mission.

Usage:

if not misn.accept() then return end

Return value:

true if mission was properly accepted.
misn.cargoAdd (cargo, quantity)
Adds some mission cargo to the player. He cannot sell it nor get rid of it unless he abandons the mission in which case it'll get eliminated.

Parameters

  • cargo: Name of the cargo to add.
  • quantity: Quantity of cargo to add.

Return value:

The id of the cargo which can be used in cargoRm.
misn.cargoJet (cargoid)
Jettisons the mission cargo.

Parameters

  • cargoid: ID of the cargo to jettison.

Return value:

true on success.
misn.cargoRm (cargoid)
Removes the mission cargo.

Parameters

  • cargoid: Identifier of the mission cargo.

Return value:

true on success.
misn.claim (systems)
Tries to claim systems. Claiming systems is a way to avoid mission collisions preemptively. Note it does not actually claim the systems if it fails to claim. It also does not work more than once.

Parameters

  • systems: Table of systems to claim or a single system.

Usage

  • if not misn.claim( { system.get("Gamma Polaris") } ) then misn.finish( false ) end
  • if not misn.claim( system.get("Gamma Polaris") ) then misn.finish( false ) end

Return value:

true if was able to claim, false otherwise.
misn.factions ()
Gets the factions the mission is available for.

Usage:

f = misn.factions()

Return value:

A containing the factions for whom the mission is available.
misn.finish (properly)
Finishes the mission.

Parameters

  • properly: If true and the mission is unique it marks the mission as completed. If false it deletes the mission but doesn't mark it as completed. If the parameter isn't passed it just ends the mission (without removing it from the player's list of active missions).
misn.markerAdd (sys, type)
Adds a new marker.

Parameters

  • sys: System to mark.
  • type: Colouring scheme to use.

Usage:

my_marker = misn.markerAdd( system.get("Gamma Polaris"), "low" ) Valid marker types are:
- "plot": Important plot marker.
- "high": High importance mission marker (lower than plot).
- "low": Low importance mission marker (lower than high).
- "computer": Mission computer marker.

Return value:

A marker ID to be used with markerMove and markerRm.
misn.markerMove (id, sys)
Moves a marker to a new system.

Parameters

  • id: ID of the mission marker to move.
  • sys: System to move the marker to.

Usage:

misn.markerMove( my_marker, system.get("Delta Pavonis") )
misn.markerRm (id)
Removes a mission system marker.

Parameters

  • id: ID of the marker to remove.

Usage:

misn.markerRm( my_marker )
misn.npcAdd (func, name, portrait, desc, priority)
Adds an NPC.

Parameters

  • func: Name of the function to run when approaching, gets passed the npc_id when called.
  • name: Name of the NPC
  • portrait: Portrait to use for the NPC (from GFX_PATH/portraits*.png).
  • desc: Description associated to the NPC.
  • priority: Optional priority argument (defaults to 5, highest is 0, lowest is 10).

Usage:

npc_id = misn.npcAdd( "my_func", "Mr. Test", "none", "A test." ) -- Creates an NPC.

Return value:

The ID of the NPC to pass to npcRm.
misn.npcRm (id)
Removes an NPC.

Parameters

  • id: ID of the NPC to remove.

Usage:

misn.npcRm( npc_id )
misn.osdActive (n)
Sets active in mission OSD.

Parameters

  • n: Element of the OSD to make active.
misn.osdCreate (title, list)
Creates a mission OSD.

Parameters

  • title: Title to give the OSD.
  • list: List of elements to put in the OSD.

Usage:

misn.osdCreate( "My OSD", {"Element 1", "Element 2"})
misn.osdDestroy ()
Destroys the mission OSD.
misn.setDesc (desc)
Sets the current mission description. Also sets the mission OSD unless you explicitly force an OSD, however you can't specify bullet points or other fancy things like with the real OSD.

Parameters

  • desc: Description to use for mission.
misn.setNPC (name, portrait)
Sets the current mission NPC. This is used in bar missions where you talk to a person. The portraits are the ones found in GFX_PATH/portraits without the png extension. So for GFX_PATH/portraits/none.png you would just use "none".

Parameters

  • name: Name of the NPC.
  • portrait: Name of the portrait to use for the NPC.

Usage:

misn.setNPC( "Invisible Man", "none" )
misn.setReward (reward)
Sets the current mission reward description.

Parameters

  • reward: Description of the reward to use.
misn.setTitle (title)
Sets the current mission title.

Parameters

  • title: Title to use for mission.

Valid XHTML 1.0!