Tutorial 01: Basic CTF
Capture the Flag is the simplest form of Q3F map.It can be easily implemented with just a few entities. Normally there are two teams, but thats not a requirement - 4 team CTF can be just as fun and a lot more hectic.
For the purposes of this tutorial I'm going to assume you have already created your map and just want to add the Q3F elements. All the entities listed here can be found in this example map. Open it with an ascii editor (eg. textpad) to see the ents.
The first thing we need to do is declare the teams. Lets assume we want two, called 'Red Devils' and 'Blue Giants'. Create a info_player_start in your map as normal (right click->info->info_player_start). You then need to give it the 'allowteams' field - set this to 'red':
Create another info_player_start and repeat for the blue team: 'allowteams' 'blue'
Thats enough to let Q3F know what teams are available, and where they are allowed to spawn. Next we have to specify their names so they show up properly on the team selection menu. Open the entity editor again and this time select the worldspawn entity:
Simply set the team_"color"_name fields to whatever you want. Note also the use of the 'message' field to record the map name and version - this information is displayed when the map loads.
The next stage is to introduce the flags. This is done with the Q3F custom entity func_goalitem. Look at this example and I'll walk you through the fields and what they do:
{
"classname" "func_goalitem"
"carried_sound" "sound/misc/q3f_alarm.wav"
"carried_all_sound" "sound/misc/q3f_alarm.wav"
"carried_message" "~You got the ^1red^* flag! Run for it!"
"carried_all_message" "%N nabbed the ^1red^* flag!"
"groupname" "redflag"
"allowteams" "blue"
"model" "models/flags/r_flag.md3"
"inactive_all_message" "The ^1red^* flag returned to base!"
"active_all_message" "The ^1red^* flag was dropped in the field!"
"flags" "showcarry,revealspy"
"active_flaginfo" "The ^1Red^* flag has been dropped in the field!"
"inactive_flaginfo" "The ^1Red^* flag is at base."
"carried_flaginfo" "%N is carrying the ^1Red^* flag!"
"wait" "60"
"_color" "1.000000 0.392157 0.392157"
"light" "150"
}
Appears fairly ugly I'm afraid - but its not as hard as it looks. You can copy this ent and use it in your own map, or adjust it to how you want.
|
classname
|
- as mentioned above, this is a func_goalitem.
|
|
carried_sound/carried_all_sound
|
- the noise the carrier and the everyone else hear when the flag is picked up.
|
|
carried_message/carried_all_message
|
- just like the sounds, but text. Note the use of '~' which forces the text to centre print. ^* is used to 'escape' from the color specified (in this case ^1, red).
|
|
groupname
|
- the name(s) given to the item.
|
|
allowteams
|
- the teams allowed to pick up the item
|
|
model
|
- the model to display, in this case the standard ID red flag.
|
|
"state"_all_message
|
- displays the specified message when the entity moves into "state"
|
|
flags
|
- showcarry displays the flag model with the person carrying it, revealspy un-disguises a spy if he picks up the item.
|
|
"state"_flaginfo
|
- this information is displayed when a player uses the 'flaginfo' command.
|
|
wait
|
- the flag will wait this long when dropped before returning. Normal CTF wait time is 30-60 seconds depending on map size.
|
|
_color/light
|
- just like a point light in a map, the item will glow 'light' brightness in colour _color
|
*phew* - quite a bit to take in in one go there. Read over it again, think it through and make sure you understand.
Now that we have our teams and our flags we need something to do with them. This is where the func_goalinfo is used. In a normal CTF map when you have the flag you take it to a 'capture point' to score points. Heres an example capture point, again I'll walk you through it line by line:
{
"classname" "func_goalinfo"
"holding " "blueflag"
"give" "health=+100,armor=+300,ammo_shells=+100,ammo_bullets=+100,
ammo_rockets=+100,ammo_cells=+100,gren1=+2,gren2=+1,
ammo_medikit=+100,ammo_detpack=+1"
"teamscore" "10"
"active_team_sound" "sound/teamplay/flagcap_red.wav"
"active_all_message" "~%N CAPTURED the ^4blue ^*flag!"
"active_sound" "sound/teamplay/flagcap_red.wav"
"activetarget" "blueflag=~inactive"
}
|
classname
|
- this is a func_goalinfo
|
|
holding
|
- this ent will only activate if person who touches it is holding the blueflag.
|
|
give
|
- it is customary to give the capper full health, armour and ammo. Its not required, but is a nice touch :)
|
|
teamscore
|
- reward the capturers team with 10 teampoints. Again 10 is customary for CTF maps, but not required.
|
active_team_sound/active_all_message/ active_sound
|
- play appropriate sounds and display messages.
|
|
activetarget
|
- finally return the blueflag to its home. Note the ~ to force a non-standard state change (carried->inactive).
|
And thats it! Well, almost. You'll need to create a blue flag item and a capture point for the blue team - this is easily done by changing a few fields. The example map included has all the ents you'll need if you prefer to copy and paste.
Last but not least, the icing on the cake. You may have noticed in our maps that a little flag appears on your display when you are carrying the flag. This effect is achieved with the func_hud:
|
model
|
- the model to display.
|
|
holding
|
- display when to the person holding this item. (if no holding field everyone will see the model.
|
|
slot
|
- the slot to display the model in, numbered from 1-10. In this case both func_hud's use slot 1; this is safe beacause no one can ever be holding both flags.
|
And thats it! Everything you need to have a fully working Q3F CTF map.
- by Steve 'MrChumble' Batham