Example map: ch_tutorial.vmf
You;ll have to download the files [www.dropbox.com]
and put the "ch_tutorial" folder here: "contagion\addons\"Note: The example map covered in this tutorial is not built for actual gameplay but for a functional game mode only.
Each game mode comes with a prefix before the map name itself. This is to determine what game mode is associated with your map. So if you name your map "deadcell" or something and it's a hunted map, the full name of your map should be "ch_deadcell". This is all determined in the game's code, so there's no way around it.
Before anything the first thing you should do when you get to playtest your map is to create a navmesh. Without it players will spawn at 0.0.0. coordinates even if you've added a "info_survivor_position". To do this just load up your map in-game and turn on cheats in the console. Then type in "nav_edit 1. If you're stuck then noclip your way to one of the playable areas and make sure you're facing towards the ground.
Now you have to create a point of reference for the navmesh generator. Simply type "nav_mark_walkable" into the console while facing the ground and hit enter. You should see a marker on the floor like this one:
You're almost there, next you type "nav_generate" into the console and the game will run through a series of processes to generate the navmesh. After that you're set, well, at least for now. Navmeshes need a lot of cleanup. You can find out more here
. You should be able to start the map and have no issues spawning into the map anymore.
Now that we've got all that out of the way let's start with actually implementing our entities. We'll start with making zombies appear in our map. Go to your "SteamApps\common\Contagion\bin" folder (or "SteamApps\common\ContagionBeta\bin" if you have the game installed since Early Access) and double click "ContagionSDK.exe" This will start up the Contagion SDK where you'll find all the tools you need like hammer for instance.
Open your map and determine which area(s) you want to spawn your zombies. Then, simply create a brush covering the desired area and cover the brush with the tools/toolszombiespawn texture as shown in the image below.
Once you created your brush you hit Ctrl+T to create a brush entity. By default this should be a "func_detail". Once you created the brush entity seach for and select the "trigger_zombie_spawns" under the class tab.
Now that you've created the zombie trigger you have to name it. As a rule of thumb during game creation you have to stick to solid and logical naming conventions that make sense and are coherent so that when you make a new map your basis is already laid out. In this case we go for "zspawn_start". The name of the zombie trigger will be directly referenced in the VScript itself but we'll get there shortly.Note: Zombie triggers use the navmesh to determine if and where zombies can spawn.Note: Be aware that zombie spawns use player visibility so that no zombies will spawn inside any players line of sight.
Next you want to add a "logic_script" and give it a name: script_zombiespawns is a good naming convention. Now you'll need a an actual VScript associated with your map. For this tutorial I created a script called "ch_tutorial_zombiespawns.nut" which should be located in "contagion\addons\ch_tutorial\scripts\vscripts"(see the download link on top of this section). Use this script name for the VScripts without the extension. (See image below)
For the final part to make the zombies spawn you'll need to call a script command. We'll need a "logic_auto" for that. So go ahead and create one. Then give it the following outputs:
I'll go over the VScript itself very briefly.
As you can see you're able to control how many zombies spawn for each difficulty and depending on the size of your map you should set it to an acceptable number. This will require playtesting to make sure each game mode is properly set up. Note: The number of zombies in this game mode are constant. If one dies another one will pop up. This is to keep the pressure on the survivors so they won't be able to stay in one place for too long.
Now take a look at line #8 and #9, it reads the following:
// Enable the spawns for the zombies.
DoEntFire( "zspawn_start", "enable", "", 0, 0, 0 );
You should notice the zombie trigger name "zspawn_start" so it means that the "logic_auto" will run the "DoEntFire" command which points to the "zspawn_start" brush. Now save your map, compile and test it out. Again, make sure you created a navmesh for your map otherwise, nothing will happen.
info_random_weapon & info_random_ammo
What are zombies in your game without additional firearms and melee weapons, right? So let's fix that.
We've already created a "logic_script" inside the map for our zombie spawns, now we need to create another one for our weapon and ammunition spawns. Create one and once again use a good naming convention. I went with "script_weapons". I also created a VScript for this tutorial called "ch_tutorial_weapons.nut" also located inside the "contagion\addons\ch_tutorial\scripts\vscripts" folder. So choose that script name in the "logic_script" properties to reference the correct script. Then open up the "logic_auto" again and set it up like so:
Now browse though the available list of entities and search for "info_random_weapon" and start placing them in logical places around the map. Don't try to hide them too much and make sure that most of them are easily found. You can hide some of them a bit more cleverly as to (potentionally) reward exploring players.
After that you can search for the "info_random_ammo" entity and also start adding these to the map. You should end up with a lot more of these, since ammunition is more common then actual weaponry.
Once that is done the script should be set up and you have actual spawn positions for all your weapons and ammo. Compile your map again and go test it out. Make sure you think about weapon and ammo balance so that there is no abundance or lack of the amount of weapons players will find.
On some of our maps we've sectioned off entire areas that have weapon and ammo spawns. Our system is incredibly random but will never spawn weapons in one place only. So just make sure it's all evened out and it should be fine.