Topic: Basic Tutorial for Converting SP maps to COOP
Support: Coop version 1.0.0.
I was requested to do an article about converting RTCW SP maps to COOP mod. This is a really basic tutorial, I will only give you some pointers, and you'll have to figure out most yourself. You should know the basics of SP scripting before you can efficiently convert maps, this tutorial does not cover that part. If you need to ask something, ask it here... Ok gl and hf!
1. Here are the links for some info and CMDS. Also there is a full extended version of this tutorial that has anything you need to know!
https://github.com/fretn/rtcwcoop/wiki/Mapping
https://github.com/fretn/rtcwcoop/wiki/HowTo
2. Copy the custom maps pk3 into your game coopmain folder.
!!!TEST!!! THE MAP MUST RUN! IF NOT FIX IT OR DITCH IT! Nothing in this tutorial will make it run if it does not run now.
You can test your map by typing /coopdevmap mapname into the console. Using shortcut to do this can fail in 0.9.5.
3. Copy and remove the files named mapname.script and mapname.ai into "user/documents/rtcwCOOP/coopmain/maps/" (not game folder, this is the folder game edits!). Eg. If you take a screenshot it should appear in "user/documents/rtcwCOOP/coopmain/screenshots/" etc.
4. Rename these two files into mapname.coop.ai and mapname.coop.script
5. Let's create an ents file in the same folder with previous files. Copy paste existing .ents file from sp_pak_coop1.pk3. Or create one in notepad. Rename it to mymapname.ents. In this file goes every entity you want to ADD into the game, like new coop AI's, spawnpoints, flags and such.
6. Now we must add a script_multiplayer entity. Or the scripts won't work. Put this on to the top of the .ENTS file:
{
"classname" "script_multiplayer"
"scriptname" "game_manager"
}
7. Load your map in COOP. It will show you don't have any COOP spawns. Start out by using command /dumpcoopspawnpoint in your console. This will make your first intial coop spawnpoint. You must add 8 of these before moving on!
If your map fails to load with a script error. Check that any AI that spawns at map_start that if they have special actions, it starts after a wait. This is normal action for a mapper to do to be safe in any Q3 engine game, but apparently not all mappers know this. Eg.
nazi1
{
spawn
{
//Hey I spawn at mapstart
wait 50 //Add me or you will crash the coop map muaha
trigger nazi1 go //I wanna go when I born
}
....
}
8. (optional) Now let's create the second spawn place that has a flag. You MUST FIRST add a flagpole, so the game will link the flagpole to the spawnpoint operating with it. Command /dumpflagpole will add a flag. Add 8 spawnpoints around it straight after adding the flag pole.
If you need more flags, just redo these steps.
AXIS PLAYERS ARE CURRENTLY DISABLED!
9. Add a couple axis spawnpoints. Use command /dumpcoopspawnpoint. To turn these spawnpoints work for Axis, you must edit the spawnflags of these entities in .ents file! coop_spawnpoint has spawnflag stage in ents file that decides how to use the spawnpoint.
Currently:
(spawnflags: 0 = disabled; 1 enabled; 2 = allied and disabled; 3 = allied and enabled; 4 = axis and disabled; 5 = axis and enabled; 6 = axis and allied and disabled; 7 = axis and allied and enabled)
10. (optional)Adding a new AI (reinforcements). If you skip this, your map will still have the same AI's that you had in RTCW SP. Open the game again. Go to the location you want your first AI REINFORCMENT to spawn in. Use command /dumpcastai ai_soldier coop_ai_soldier_1. This will spawn ai_soldier named coop_ai_soldier_1 into the location you stand at. If you leave the name field empty, it should name it automatically, but the numbering can be buggy!
10.1. Go to the ents file. You can see that new AI appeared. Give him a skin (look at existing maps) for body and head.
10.2. You must alert AI's from a trigger of your choosing to make them spawn. Usually in the same place the regular AI's in that map stage is triggered. Example commands to add them with:
#if g_reinforce >= 1 alertentity coop_ai_soldier_1 #endif
#if g_reinforce == 2 alertentity coop_ai_soldier_2 #endif
10.3. Now we need to give the new soldiers some attributes and script. Here is a simple example script from an existing map. Go to mapname.coop.ai and add this into the bottom. You must add this for every new ai. Usually we add around 20-40 reinforment AI's per a map.
coop_ai_soldier_1 //NAME OF YOUR NEW AI!
{
attributes
{
aim_accuracy 0.6
starting_health 60
camper 1
}
spawn
{
setammo ammo_grenades 0
setammo ammo_9mm 999
statetype alert
}
}
11. Go to your mapname.coop.script. Add something like this to the start. Objective and endmap should be linked to go through this Entity!
game_manager
{
spawn
{
accum 0 bitreset 1
accum 0 bitreset 2
trigger player map_start //Prevents late players affecting the game
}
trigger checkexit
{
accum 0 abort_if_not_bitset 1
accum 0 abort_if_not_bitset 2
trigger player exitlevel
}
trigger objective1
{
accum 0 bitset 1
}
trigger objective2
{
accum 0 bitset 2
}
}
12. PLAYER SCRIPTBLOCK. Go to mapname.coop.ai. Now we need to edit the player scriptblock. This handles most of the objective and game events. This block needs quite some changes from SP. Do everything exactly like we have. Keep careful eye for new commands and where everything is located.
12.1. spawn event should provide the player with AMMO, items, and start the music. Nothing else.
12.2. All the things from playerstart event must be moved out. This is useless for COOP. However don't remove it, code still reads it, and gives you error (I think). So it will just look like this:
playerstart
{
}
12.3. Add trigger map_start. In this trigger you must place everything that loads at map start up and general objective, accums etc.. This must be triggered from game_manager spawn, code does not look for it itself (we did, see above). It will look something like this:
trigger map_start
{
//If something breaks at late player joining, move it here
objectivesneeded 2
numsecrets 1
globalaccum 0 bitreset 0 //Make a desired action
#if g_reinforce >= 1 alertentity coop_ai_soldier_1 #endif
#if g_reinforce >= 1 alertentity coop_ai_soldier_14 #endif
#if g_reinforce >= 2 alertentity coop_ai_soldier_15 #endif
}
12.4. !!!IMPORTANT!!! Player scriptblock accums does not work right. For every accum command inside player scriptblock you must add word "global" in front. Otherwise it will work only in local play.
12.5. To be extra safe, objective accums are placed inside game_manager. However, keep the objectivemet command in the old trigger (must be first command in the trigger !!!!!), then trigger the objective accum inside the game_manager.
12.6 To be extra safe, go through game_manager before ending the game, to check if the objectives are done.
12.7 New feature random respawn. Add this into your map_start:
//----------------------------------------
//Make AI reinforcements not respawn
//----------------------------------------
#if g_airespawn >= 1
wait 5
randomrespawn coop_ai_soldier_1
randomrespawn coop_ai_soldier_2
randomrespawn coop_ai_soldier_3
randomrespawn coop_ai_soldier_4
randomrespawn coop_ai_soldier_5
randomrespawn coop_ai_soldier_6
randomrespawn coop_ai_soldier_7
randomrespawn coop_ai_soldier_8
randomrespawn coop_ai_soldier_9
randomrespawn coop_ai_soldier_10
wait 5
randomrespawn coop_ai_soldier_11
#endif
Change the names and amount to your map. It's recommend to have wait 5 between every 10th command.
12.8
New feature: ability to make single ai not respawn. Useful for bosses, special ais or such ais that tend to spawn without gun (quick fix for those). Add command "norespawn" to the wanted AI's spawn. Example to make nazi1 not respawn:
nazi1
{
spawn
{
//HERE IS SOME SCRIPT
norespawn
}
//HERE IS SOME MORE SCRIPT...
}
13. Place the 3 new files back into the custom map's pk3 file (maps folder). Or better to add a second pk3 that has the coop files for example mymap_coop.pk3 if it's not your own map. Or if you want to keep it it compatible with SP, because 1.0.0 is potentially RTCW compatible. Must be alphaphetically after original pk3.
14. TEST A LOT before release. You must test the maps with many players. Many things that works when you are alone, might not work with multiple players on the server.
15. If anything goes wrong or you don't understand some stage, post it here. I'll be happy to help.
EXAMPLE MAP CONVERSION BASED ON THIS TUTORIAL.
COOP Addon file: https://bzzwolfsp.googlecode.com/svn/wi … p_sage.pk3
Original File: www.rtcwcoop.com/main/christmas_map.pk3
MAJOR UPDATE! 18.9.2013. ADDED Explanations on spawnpoint spawnflags. Added some new notes and fixed couple errors.
MAJOR UPDATE! 3.1.2014. FIXED Spawnflags of spawnpoints.
Edited 4.1.2014. Added randomrespawn and changed ai spawnflags.
Edited 5.1.2014 Added norespawn that I had forgotten to add.
Edited 14.6. Updated to 1.0.0.