Skip Navigation
Resources
Group Information

Checkpoints

This is an example for 3-checkpoint capture the flag map. First build a simple room with an info_player_start and a script-entity (right click and choose script > multiplayer_script). then place 3 team_wolf_checkpoint entities in it. do this by right clicking and then choose them in directory team. Now your map should be like this:





Now select the first of the checkpoints and press 'N'. Enter all settings like I did. The model is the normal flagpole that is used in every official map for checkpoints/spawnpoints.




Repeat this for all the 3 checkpoints of course with other scriptnames - these are cp2 and cp3. That's it for the map, now here comes the script, no fear it looks like a lot of work but it's just copy and paste all the time. If you don't understand what is going on then have a look at the scripting tutorial.

//checkpoint_tutorial
//Map: checkpoint_tutorial.map
//done by the muffinman
//

game_manager
{
spawn
{
wm_axis_respawntime 30
wm_allied_respawntime 30

wm_number_of_objectives 4
wm_set_round_timelimit 10

// Nazi's control objective #1 at the start

wm_setwinner -1

wm_set_objective_status 1 -1
wm_set_objective_status 2 -1
wm_set_objective_status 3 -1

// Accum 1-3 will be the state of the checkpoints, -1 means nobody controls the flag
accum 1 set -1
accum 2 set -1
accum 3 set -1

// Accum 4 tracks the tide of battle
accum 4 set 0
}

// The following functions are called from the checkpoints when either team takes control of it

trigger cp1_blue
{
// Allied takes control of checkpoint #1
wm_set_objective_status 1 1

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_blue

// Change the variable within the script so that we can check if someone wins the round
accum 1 set 1

// Some kind of UI pop-up to alert players
wm_announce "Allies take the checkpoint 1!"

// Call function to check if the round has been won
trigger game_manager checkgame_blue
}

trigger cp1_red
{
wm_set_objective_status 1 0

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_red

// Change the variable within the script so that we can check if someone wins the round
accum 1 set 0

// Some kind of UI pop-up to alert players
wm_announce "Axis take the Checkpoint 1!"

// Call function to check if the round has been won
trigger game_manager checkgame_red
}

trigger cp2_blue
{
// Allied takes control of checkpoint #1
wm_set_objective_status 2 1

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_blue

// Change the variable within the script so that we can check if someone wins the round
accum 2 set 1

// Some kind of UI pop-up to alert players
wm_announce "Allies take the checkpoint 2!"

// Call function to check if the round has been won
trigger game_manager checkgame_blue
}

trigger cp2_red
{
wm_set_objective_status 2 0

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_red

// Change the variable within the script so that we can check if someone wins the round
accum 2 set 0

// Some kind of UI pop-up to alert players
wm_announce "Axis take the Checkpoint 2!"

// Call function to check if the round has been won
trigger game_manager checkgame_red
}

trigger cp3_blue
{
// Allied takes control of checkpoint #1
wm_set_objective_status 3 1

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_blue

// Change the variable within the script so that we can check if someone wins the round
accum 3 set 1

// Some kind of UI pop-up to alert players
wm_announce "Allies take the checkpoint 3!"

// Call function to check if the round has been won
trigger game_manager checkgame_blue
}

trigger cp3_red
{
wm_set_objective_status 3 0

// First update winner based on number of flags held by both teams
trigger game_manager adjustwinner_cp1_red

// Change the variable within the script so that we can check if someone wins the round
accum 3 set 0

// Some kind of UI pop-up to alert players
wm_announce "Axis take the Checkpoint 3!"

// Call function to check if the round has been won
trigger game_manager checkgame_red
}


// Keep winner set to team with most flags

trigger checkwinner
{
wm_setwinner -1
accum 4 abort_if_equal 0
wm_setwinner 1
accum 4 abort_if_greater_than 0
wm_setwinner 0
}

trigger adjustwinner_cp1_blue
{
accum 4 inc 1
trigger game_manager checkwinner
accum 1 abort_if_not_equal 0
accum 4 inc 1
trigger game_manager checkwinner
}

trigger adjustwinner_cp1_red
{
accum 4 inc -1
trigger game_manager checkwinner
accum 1 abort_if_not_equal 1
accum 4 inc -1
trigger game_manager checkwinner
}

trigger adjustwinner_cp2_blue
{
accum 4 inc 1
trigger game_manager checkwinner
accum 2 abort_if_not_equal 0
accum 4 inc 1
trigger game_manager checkwinner
}

trigger adjustwinner_cp2_red
{
accum 4 inc -1
trigger game_manager checkwinner
accum 2 abort_if_not_equal 1
accum 4 inc -1
trigger game_manager checkwinner
}

trigger adjustwinner_cp3_blue
{
accum 4 inc 1
trigger game_manager checkwinner
accum 3 abort_if_not_equal 0
accum 4 inc 1
trigger game_manager checkwinner
}

trigger adjustwinner_cp3_red
{
accum 4 inc -1
trigger game_manager checkwinner
accum 3 abort_if_not_equal 1
accum 4 inc -1
trigger game_manager checkwinner
}


// Check for game-winning condition

trigger checkgame_blue
{
// Check all for checkpoints and see if they have been set to '1' - allied
accum 1 abort_if_not_equal 1
accum 2 abort_if_not_equal 1
accum 3 abort_if_not_equal 1

// Set the round winner: 0 == AXIS, 1 == ALLIED
wm_setwinner 1

// End the round
wm_endround
}

trigger checkgame_red
{
// Check all for checkpoints and see if they have been set to '0' - axis
accum 1 abort_if_not_equal 0
accum 2 abort_if_not_equal 0
accum 3 abort_if_not_equal 0

// Set the round winner: 0 == AXIS, 1 == ALLIED
wm_setwinner 0

// End the round
wm_endround
}
}

cp1
{
trigger axis_capture
{
trigger game_manager cp1_red
}

trigger allied_capture
{
trigger game_manager cp1_blue
}
}

cp2
{
trigger axis_capture
{
trigger game_manager cp2_red
}

trigger allied_capture
{
trigger game_manager cp2_blue
}
}

cp3
{
trigger axis_capture
{
trigger game_manager cp3_red
}

trigger allied_capture
{
trigger game_manager cp3_blue
}
}

click here to download the script and map

Problems, Comments, Queries > Forum

Tutorial by Muffinman
Surface mini-logo Surface mini-logo