This is based on a guide originally written by Enviolinador. Some points in his guide were unclear, so instead of copying it across, I have decided to re-write it.
Player models are something that can truely give a map life. Imagine a Jailbreak map where all 'prisoners' were just terrorist skins, and all 'wardens' were just counter-terrorist skins. Or a Zombie map where all 'zombies' were just a terrorist skin.
I had a chat with New Guy last night about this, and it was something he had never seen done, so we decided to play around with it a little, to see about having a map change a players model (since servers contain plugins to set the player skins, not the map). Although it can't achieve anything that a plugin can't, it does help for a few things:
1) You can choose skins to be used on your own map. Instead of having each server use different (and probably unrelated) skins, you can instead allow for skins that match your maps theme.
2) Skins will instead be packed inside the BSP, instead of being downloaded separately.
3) Midround skin changes are possible (at exact points in the map), such as for different minigames.
Anyway, you get the idea. So now on to how it is done.
Before you actually implement this into a map, you should complete the rest of the map. I will go into further detail about this, however it is to do with the modelindex, which will constantly change as you make changes.
So first you want to find propdata.txt. This will be located inside a VPK file, so use GFCScape to extract that. Alternatively, here is the text that is inside it. Just save it as propdata.txt: http://pastebin.com/zMKPvUC4
This file should be moved to your scripts folder if you do not use custom content, however if you do use custom content, place it in custom/foldername/scripts. For example:
Code:
C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\skin\scripts\propdata.txt
Open this file in notepad, and find 'BREAKABLE DATA', which is right at the bottom of the file. In here, you want to add a new scope after "MetalChunks". For my example, I will use Bauxe.
Code:
//=================================================================================
// BREAKABLE DATA. NOT PROPDATA TYPES.
//=================================================================================
"BreakableModels"
{
// Sorted in order of smallest to largest
"WoodChunks"
{
"models\Gibs\wood_gib01e.mdl" "1"
"models\Gibs\wood_gib01d.mdl" "1"
"models\Gibs\wood_gib01c.mdl" "1"
"models\Gibs\wood_gib01b.mdl" "1"
"models\Gibs\wood_gib01a.mdl" "1"
}
"GlassChunks"
{
"models\Gibs\Glass_shard01.mdl" "1"
"models\Gibs\Glass_shard02.mdl" "1"
"models\Gibs\Glass_shard03.mdl" "1"
"models\Gibs\Glass_shard04.mdl" "1"
"models\Gibs\Glass_shard05.mdl" "1"
"models\Gibs\Glass_shard06.mdl" "1"
}
"ConcreteChunks"
{
"models\props_debris\concrete_chunk08a.mdl" "1"
"models\props_debris\concrete_chunk09a.mdl" "1"
"models\props_debris\concrete_chunk03a.mdl" "1"
"models\props_debris\concrete_chunk07a.mdl" "1"
"models\props_debris\concrete_chunk09a.mdl" "1"
"models\props_debris\concrete_chunk02a.mdl" "1"
}
"MetalChunks"
{
"models\Gibs\metal_gib1.mdl" "1"
"models\Gibs\metal_gib2.mdl" "1"
"models\Gibs\metal_gib3.mdl" "1"
"models\Gibs\metal_gib4.mdl" "1"
"models\Gibs\metal_gib5.mdl" "1"
}
"Bauxe"
{
}
}
Next thing you need to do is find a model to use! Any server side model should work, so find one in your models folder that you would like to use, and just add the path into your propdata.txt
Code:
"Bauxe"
{
"models\player\hhp227\miku\miku.mdl" "1"
}
Compile your map, reopen CS:S and load up the map. We need to get the modelindex, which changes as other models are used in a map and such. That is why we save this part for after the map is completed.
Once the map is loaded up, type in console: "cl_precacheinfo modelprecache" to be presented with a list of all precached models. Near the top (under metal_gib5.mdl) should be your chosen model, as well as a number next to it. In my case, 024.
Add a trigger on your map where you wish to change the model with the following output:
<activation method> - !activator - AddOutput - modelindex ### - 0.00
For example:
Recompile the map, hit the trigger and your model should be changed! To check, just type "sv_cheats 1" and then "thirdperson" in console.
When you are doing your final release, be sure to pack the propdata.txt into your map (making sure it is stored in scripts/ and NOT your custom directory), as well as any models you added (both the model files AND the material files). Adding the model somewhere in the map as a prop_static will make packing the model much easier.
Not an overly detailed guide, so if you have any questions, be sure to ask!