npc_shieldset.txt

Overview

npc_shieldset.txt is an SMOD script used to define special armor pieces for NPCS to wear, and which NPCs can use them. Combine soldiers for instance could be given bullet-resistant visor helmets or shields.

Source



Syntax

1
2
3
4
5
6
7
8
9
10
11
12
13
14
"default_map"
    {
    "npc_combine_s"
        {
        "RiotShield"
            {
            "Model"        "models/misc/shield.mdl"
            "Attach"    "anim_attachment_RH"
            "Rotate"    "0 0 0"
            "Offset"    "0 0 0"
            "Durability"    "64 128"
            }
        }
    }

Line 1 names the map that the next few lines will apply to. You could for instance, have Civil Protection officers hold riot shields in the late Follow Freeman chapters, and only use their lighter armor in the rest of the game. In this case, default_map is used to set the NPCs' behavior on any map that isn't defined later 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 we want to tweak with this script. In this case, the run-of-the-mill Combine soldier.

Line 4 is an opening brace for another code block. Anything within this block will apply to the NPC named in line 3.

Line 5 sets the name of the armor to be defined, which can be anything you want. Don't worry about giving different armor pieces for the same NPC unique names (Face, Arm, Arm2) because they won't interfere with each other.

Line 6 is an opening brace for yet another code block. Anything within this block will apply to the armor piece named in line 5.

Line 7 sets the model used by the armor piece. In this case, a large and transparent riot shield.

Line 8 sets the attachment point of the NPC's model that the armor should be attached to (Ex. eyes, lefthand, chest). You can review attachment points through the Source SDK's model viewer. In this case, the shield is attached to a point on the soldier's right hand.

Line 9 is used to alter the pitch, yaw, and roll angles of the armor piece.

Line 10 is used to alter the XYZ positioning of the armor piece, relative to its attachment point. If a piece of armor isn't hugging the NPC as close as you'd like, this is what you'll be tweaking.

Line 11 is used to define the health range of the armor piece. Health will be randomly set between the two values and once its health (or that of its owner) reaches 0, the armor will shatter into pieces.

Lines 12, 13, and 14 are all closing braces for the default_map block, the npc_combine_s block, and the RiotShield block, in that order. 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.

Referencing

When setting up an NPC, it may be more convenient to reference an entry already in the script. Below is an example in the default script.

"npc_combine_c" {
            "Reference"    "npc_combine_s"
        }

Because the two NPCs have identical attachment points for their models, they're able to share the same settings this way.

Usage Notes

  • The script is not limited to tweaking Combine soldiers. You can see below that citizens, vortigaunts, and zombies can be used as well. NPCs only need a model and an attachment point for shields to work smoothly.
shieldline_t.png shieldbraaains_t.jpg
  • If a block for a specific map is made, any settings in it will override those in default_map.
  • If more than one armor piece is defined for them, NPCs tend to mix and match them up. For instance, Civil Protection officers can often be seen wearing both arm shields but no helmet.
  • While it's possible to equip armor without using attachment points, don't expect it to act as smoothly. Below is an example of a shield-bearing soldier, with and without an attachment point set. Without one set, the shield will hover in front of him instead of following his animations.
shieldsoldier2_t.jpg shieldsoldier_t.jpg

Console Variables

  • enemies_useshield <integer> ( Default: 0 )
    Controls how often NPCs use combat shields or similar protective gear. The value acts as a divisor, so 5 would give a 20% (1/5) chance of using this kind of equipment. 0 disables.

  • enemies_shielddurability_min <integer> ( Default: 255 )
    Sets the default min. health for protective gear. If an armor piece's health range is not already set in the script, this value will be used.

  • enemies_shielddurability_max <integer> ( Default: 255 )
    Sets the default max health for protective gear. If an armor piece's health range is not already set in the script, this value will be used.


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