npc_weaponweight.txt

Overview

Source

Syntax

Convars


Overview

A weapon's "weight" determines how highly NPCs covet each weapon type, if those NPCs are capable of picking them up. For example, a rebel with an MP5 (weight: 3) would be eager to switch for an AR2 (4) they find lying on the ground. She wouldn't trade down for a 9mm pistol (1), though. Each weapon's weight is set in that weapon's script.

npc_weaponweight.txt is an SMOD script that can be used to override certain weapons' weights with new values.

Source

//
//    SMOD weapon weight customize setting (sample)
//

WeaponWeightData
{
    "default_map" {
        "default_weapon"    "-1"
        "weapon_crowbar"    "10"
        "weapon_pistol"        "1"
        "weapon_shotgun"    "2"
        "weapon_smg1"        "3"
        "weapon_grease"        "3"
        "weapon_ar2"        "4"
        "weapon_ak47"        "4"
        "weapon_kar98"        "5"
    }
}


Syntax

1
2
3
4
    "default_map"
        {
        "weapon_ak47"    "10"
        }

Line 1 names the map that the next few lines will apply to. You could for instance, have rebels in a zombie-centric map favor shotguns to SMGs or rifles. In this case, default_map is used to set the NPCs' behavior on 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 a weapon that we want to tweak with this script. In this case, the AK-47 rifle is having its normal weight (4) raised to 10. NPCs who are carrying a weapon with less weight will choose to swap for the AK if they're close enough.

Line 4 is the closing brace for the default_map block. 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

  • weapon_customweight <boolean> (Default: 0 )
    When enabled, this script can override NPCs' weapon preferences.


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