Introduction to map courses (co-op and single player missions)

Fistful of Frags4 · 34 ratings1.6k views34 favorites7 min readby FoF devUpdated Apr 9, 2018View on Steam ↗

What is a “map course”

A course is a script that spawn bots, weapons/whiskey/props, text messages and gameplay elements as capture zones at given locations and time. It can be edited manually by looking at txt files but I recommend to use our in-game editor (press F5 once a map is loaded)


Any course usually begins by creating a player spawn, followed by some on screen text / instructions, then some weapons and other items are spawn and finally enemies begin to show.

How it works

A course script is similar to a computer program, it contains instructions. It's run from the top and finish when reaching bottom (last instruction) but order may or may not be linear depending what instruction types are used later as there exist jumps and conditional instructions.

Instruction structure

Available instructions can be selected from right side menu. Use number keys to select them, mouse wheel scrolls between all available instructions.

Press left mouse button to place an instruction over the map, wherever the pointer was placed.

Press right mouse button to edit instructions. Each instruction panel has several elements (from top-left to bottom):

[O] move button: click it to place this instruction at some other location
[>] reorder button: changes the inner order in the instruction chain, this allows to insert instructions or rearrange them at whatever time you need them to be
[X] delete button: just removes the instruction forever

( LABEL ) Either a number or a text string.
A label named with an integer number adds delay to its execution. Instruction is executed after these many seconds from previously executed one. Connection between numbered labels is shown as a continuous line.

A label named with any text string (no number in its first character) disables its automatic execution so is only run when called explicitly by another instruction's output. Connection between outputs and its triggered instruction are displayed as green/lime lines.

Field 1
Bot script names to spawn, text to display, etc. Varies depending the instruction.

Field 2
Usually integer based input as seconds to capture an objective, distance radius, etc

Output
Label name for instruction target to be executed. This works in 2 ways, normal instructions call its output always while "checks" only call it if their check condition becomes true eventually.

Instruction types

player spawn
(spawns players, directly or as a save point when next restart happens. Note that players can't respawn at all in course mode unless this instruction is called)
- Field 1: “autosave” parameter (optional) respawns players from this point after course restart
wave script spawn
(spawns enemies)
- Field 1: script name, runs a bot wave spawn script. Note: use in-game's AI editor to generate bot spawn scripts (close course editor and press F4 to open it)
wave spawn dynamic
(spawns enemies but ignores the coordinates where bots are supposed to spawn, this function searches for spawn spots not visible by players around the instruction origin)
- Field 1: script name, runs a bot wave spawn script. Note: use in-game's AI editor to generate bot spawn scripts
- Field 2: radius in Hammer units around instruction to look for bot spawn spots
object script spawn
(spawns weapons, whiskey, props)
- Field 1: script name, runs an object spawn script. Note: use in-game's AI editor to generate item spawn scripts
HUD message
(displays a HUD message)
- Field 1: text to display
goto
(goes to an instruction specified by its label name and continues execution from there. It allows a jump in code for non linear execution purposes or loops. Note that unlike outputs, execution order is actually affected by this instruction)
- Field 1: label name to go to, if 2 or several names separated by commas are specified it'll go to one of them randomly
- Field 2: number to count down each time this instruction is called, only will do the jump when count down reaches 0. This can be used as a break inside a loop, for instance break a loop when it has been executed 3 times
stop
(halts linear course execution. This is used to ensure next instruction is only executed after certain condition is met. Requires a goto instruction to restart automatic execution. No additional parameters)
check enemies
(think function, creates an output only when condition is met)
- Field 1: executes output when alive enemies is lower than specified
check location
(think function, a location based check for players, executes output when its trigger zone detects a player. Also displays custom messages at its origin when required)
- Field 1: text to display near marker, optional.
- Field 2: trigger radius, If 0 is set then trigger will be 64 units and an outlined circle will show. Any other number won't show this circle model. If no text is displayed then it'll become invisible for players
check capture
(think function, similar to check_location but it accepts a capture time. It's default trigger area is 512 units and can't be changed)
- Field 1: capture time in seconds
check timer
(think function, creates a HUD timer and sends output key when timer reaches 0)
- Field 1: text to display near count down
- Field 2: count down time in seconds
check wait
(think function, halts execution during specified time amount)
- Field 1: amount of seconds, intervals separated by comma are also accepted (as 3,8 for instance). In that case a random time in chosen
entity IO
(sends inputs to map entities using the engine entity IO subsystem, same way you would in Hammer)
- Field 1: data to input to entity as "target entity name,target input,input parameter,delay". Example: "back_door,Unlock,0,3" (without quotes) unlocks an entity door named "back_door" after 3 seconds. Note that input parameter can be anything if not needed but it's mandatory to write something
Check singleplayer
(displays text in HUD until player does requested actions as picking weapons, killing enemies, drinking whiskey, reach a place, etc)
- Field 1: text1;text2;count, example: Whiskey restores your health;Drink whiskey to continue;2 displays those messages and requires player to execute requested action 2 times. If text1 and text2 parameters are set as 'null' then message window won't show but check still will detect player actions. Leaving this field empty will cause a similar effect except this check will close any other message window when tested true
- Field 2: check type (list)
Check bot orders
(forces bots inside its radius to do certain actions)
- Order: freeze (bots do not move at all), magnet (bots stay near instruction's center), magnet only ranged (same as previous but only affects ranged bots)
Give equipment
(gives weapons and perks to players. This instruction must be called by a Check Location so there's a target player to assign equipment to)
- Field 1: item list separated by commas as for instance weapon_coltnavy,boots,skill_right
- Field 2: "just add" adds requested items, "strip previous" removes any item player may have and adds requested items, "strip and avoid retry" same as strip previous but prevents player to receive more items from this instruction
game_end
(ends the course as specified, with either failure or success)
- Field 1: end state "failed" or "succeed"

Commented example

A practical example should be the best way to familiarize yourself with courses. Next picture shows a course that spawns player and a weapon, then instructs player to wait until a timer ends. Enemies spawn after timer finishes countdown, a few seconds later player is instructed to go to a place to reunite with his lost father. So much in so little!

Here's a more detailed explanation. If you look at the instruction order (number between [O] and [>] symbols):

  1. player spawns
  2. resupplies spawn 3 seconds later (note label as a number indicates delay in execution)
  3. a HUD message informs player to wait (in this case delay from previous instruction is 5 seconds). Note that it also executes instruction nr. 4 (timer countdown) by output
  4. execution is halted by a stop instruction, this is important because we don't want instruction nr. 5 and up to be executed until the "check timer" (yellow) finishes countdown. Without this stop check timer wouldn't work as supposed in the example.
  5. timer countdown is 10 seconds, when 0 is reached output to next instruction is sent
  6. this goto instruction serves no other purpose than restarting execution after next instruction because course got halted at 3
  7. Spawns enemies
  8. Check location, sends output to end course upon player's arrival, note that same output name calls two different instructions
  9. congratulatory message
  10. effectively ends the course as "success"

Conclusion

Courses are a very powerful tool to create your own single player missions and co-op experiences. Open existing courses in the editor to learn more about them, also ask whatever you feel necessary.

May the whiskey be with you.

This guide was created by its original author on the Steam Community. Are you the author and want it removed? Request removal.