This article's documentation is for anything that uses the Source engine. Click here for more information.

The Ship Single-Player: Adding a Mission to a Map

From Valve Developer Community
Jump to: navigation, search



English (en)
... Icon-Important.png

Note.pngNote:For the sake of this article, MODDIR represents your mod's directory name.

Examples

Download this example mission to see examples of what it takes to make a mission.

Note.pngNote:The only file in scripts that's worth noting is scripts/sp/mission_obj.txt.

Creating the Script

Before adding a mission to a map, you must add it first to scripts/sp/mission_obj.txt. The following is a short example of what goes in this file. Remember to add all referenced localized strings to resource/MODDIR_english.txt (and/or other languages).

// Template Mission Objective Definition:
// (use this to create new objectives in this file)
//
// 	============================
// 	"SP_Mission_<mis_num>"
// 	{
// 		"SP_Mission_<mis_num>_Obj_<obj_num>_<obj_name>"
// 		{
// 			"text" "#sp_mission<mis_num>_obj<obj_num>"
// 			"hint"
// 			{
// 				"text" "<local token>"
// 				"time" "<time in secs after which to display>"
// 			}
// 		}
// 	}
// 	============================

"Missions"
{
	"SP_Mission_1_KillQuarry"
	{
		"SP_Mission_1_Obj_1_KillQuarry"
		{
			"text" "#sp_mission1_obj1"	  
			"hint"
			{
				"text" "sp_mission1_hint2"
				"time" "10"
			}
			"hint"
			{
				"text" "sp_mission1_hint1"
				"time" "30"
			}
		}
		"SP_Mission_1_Obj_2_TalkToBellboy"
		{
			"text" "#sp_mission1_obj2"
		}
	}
}

Adding It to a Map

Create a ship_mission entity for each objective in the mission.

  • The entity should be given a targetname that corresponds to its mission number and objective number.
  • Be sure to set the mission and objective keyvalues correctly to the name of the entry in the missions file.
  • The hud_location keyvalue should be set to the ship_trigger_room the objective can be completed in.
  • If there is to be no image to represent the objective, leave the hud_model keyvalue blank. Otherwise, the keyvalue should be set to an entry in scripts/hud_textures.txt and resource/MODDIR_english.txt (and other languages) that represents the target person/object for the objective.
    • See scripts/hud_textures.txt in the ship common.gcf and scripts/ship_sp_english.txt in the ship single player content.gcf for examples.
  • When the entity gets the OnCompleted output, it should either trigger the Enable input on the next ship_mission entity or a choreographed scene that triggers the Enable input.
  • When the entity gets the OnFailed output, it should trigger the Trigger input on a logic_relay entity that will reset the map to the start of the mission. Decompile maps/cotopaxi_sp.bsp for an example of what to do.