npc_replace_model.txt

Overview

Source

Syntax

Convars


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

1
2
3
4
5
6
7
8
9
    "default_map"
        {
        "npc_citizen"
            {
            "models/humans/group01/male_01.mdl"    "1"
            "models/humans/group01/female_02.mdl"    "5"
            "models/combine_f_soldier.mdl"    "7"
            }
        }

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:
Female 2:
Friendly Soldier:

1 / 13
5 / 13
7 / 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

Mapadd Command Reference (Non-LUA)Command Reference (LUA)Getting StartedPorts 'n' Doors
Alarm, Alarm!Color Correction in SMODDoor BreachingMobile APCsWorking With Dropships
Supply Drop (LUA)Countdown (LUA)
kh0rn3's Mapadd Generator
Scripts addcontentsoverride_classsmod_custom_explosivesmodaclistSMOD Soundscripts

npc_gib_modelnpc_replace_modelnpc_shieldsetnpc_weapon_randomizenpc_weaponweight

excludeweaponsweapon_categoryweapon_customConsole Command List
Other Crosshair CustomizationGenerating AI NodesUsing the NodemakerSubViewCam
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License