Overview
npc_weapon_randomize.txt is an SMOD script used to mix up NPCs' use of weapons. You might wish to give the rebels on a map with zombies a greater chance of wielding shotguns, as one example.
Source
|
Syntax
|
|
Line 1 names the map that the next few lines will apply to. In this case, default_map is used to affect an NPC type's equipment on any map that doesn't have its own weapon settings for that NPC.
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 we want to change the equipment of. In this case, the run-of-the-mill Combine soldier. default_npc can be used to affect all NPCs capable of carrying a weapon.
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 names of possible weapons and their chances of being that NPCs' weapon of choice.
Because their values total up to 7, their chances are as follows:
AR2: |
4 / 7 |
Lines 8 and 9 are closing braces for the default_map and npc_combine_s 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_randomize_weapon <boolean> ( Default: 0 )
When enabled, NPCs' weapons are randomized as specified by npc_weapon_randomize.txt.
Customization |