Overview
npc_replace_model.txt is an SMOD script that can be used to replace NPCs' models with alternative ones. The settings can be also fine-tuned per map for some appropriate variety through the game, as in SMOD: Tactical.
Source
// SMOD model replace data (sample)
NPCModelReplaceData
{
"default_map" {
"default_npc" {
// "models/alyx.mdl" "10"
// "models/barney.mdl" "10"
}
}
"d1_trainstation_01" {
"npc_metropolice" {
"models/barney.mdl" "100"
}
}
"d1_trainstation_02" {
"npc_metropolice" {
"models/alyx.mdl" "100"
}
}
}
Syntax
|
|
Line 1 names the map that the next few lines will apply to. In this case, default_map is used to set the override behavior for any map that isn't defined elsewhere in the script.
Line 2 has an opening brace, {. This signals the start of a code block, which will continue until we hit its closing brace, }. Anything within these braces will apply to the map named in line 1.
Line 3 is an NPC whose model we want to replace with this script. In this case, a humble citizen of City 17.
Line 4 is an opening brace for another code block. Anything within this block will apply to the NPC named in line 3.
Lines 5, 6, and 7 set the paths of possible replacement models, then their chances of being the replacement.
Because their values total up to 13, their chances are as follows:
Male 1: |
1 / 13 |
Mind that there is no chance of the model not being set to something.
Lines 8 and 9 are closing braces for the default_map and npc_citizen blocks, respectively. You must match every opening brace with a closing brace or you'll have problems. Most commonly, the entire script won't run or some code blocks will be skipped over and won't do anything.
Convars
- npc_replacemodel <boolean> ( Default: 0 )
When enabled, NPCs' models can be replaced by this script.
Customization |