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
|
Syntax
|
|
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 |