Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Setting Up NPC Equipment (npc_equipment_kits.txt)  (Read 290 times)

0 Members and 1 Guest are viewing this topic.

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Setting Up NPC Equipment (npc_equipment_kits.txt)
« on: July 11, 2020, 06:18:56 AM »
NPC Equipment Kits
Current Ver: BSMOD v0.4a_S

This file is located at: .../BSMOD/scripts/npc_equipment_kits.txt

With this file you can add equipment (entities and models) into an NPC's "inventory". These equipment items will appear attached to the NPC, and, in the case of some weapons, can be switched to by the NPC in certain events (ex. enemy dropping weapon from being shot in arm)




BASICS
Lets start with the basics.

Code: [Select]
NPCEquipmentKits
{

}

This is the opening array, probably tells the game that we are dealing with NPC Equipment Kits, and that we are not messing around mister. Everything we are going to add goes between these two braces, period. If you add stuff outside these braces, you are going to have a bad time (ie. best case it won't work, or worst case, your game will crash.)

Now here is the basic format of how the equipment kit code works:

"mapname"
{
   "npc_classname"
   {
      "attachment_point" "model_path_or_entity_name, rotation"
   }
}


Now to break it down:

MAPNAME : This is the name of the map you want these equipment kits to be used on. It MUST match the name of the map exactly, but please don't include the .bsp file extension.
Example: For map d1_canals_06.bsp you would use "d1_canals_06"

NPC_CLASSNAME : Now that we've set up which map these EquipmentKits should be used on, we define which NPC they should apply to in that map. Here is a list of all NPCs in HL2.
Example: To apply to combine soldier, we would use "npc_combine_s" as the npc_classname.

ATTACHMENT_POINT : Ok so we have our map, and our NPC class set, now we are actually adding stuff to their 'inventory'. The attachment point is where to attach the piece of equipment to the NPC. Attachment points are embedded into the actual npc's model, so use HLMV to find out which models have which attachments, or check below for a list of all BSMOD exclusive attachment points.
Example: To attach equipment to the combine soldiers face we would use attachment point "eyes"

MODEL_PATH_OR_ENTITY_NAME : Ok this is the meat and potatoes part. we have defined which map we are using, which NPC we are giving equipment to, and where we are attaching it to them. Time to tell the game exactly what we are attaching. You can either use an entity class here, or you can use a path to a model file. Can not use ragdolls or other NPC's! An example below of each.
Example: ENTITY CLASS - To give the combine soldier a fancy bolt-action rifle we would use "weapon_kar98k"
Example: MODEL PATH - To put a bucket on the combine soldiers head we would use "models\props_junk\metalbucket01a.mdl"

ROTATION : If the combine soldiers piece of equipment is facing the wrong way, lets say the bucket helmet is not facing proper direction to provide adequate protection, you can add a rotation argument to adjust the angle of the equipment. The rotation is expressed in X Y Z format. If everything is great then you don't have to include any rotation argument, or you can leave it at 0 0 0. Rotation does not work on Weapons, only items and trinkets (aka models).
Example Adjust the Yaw of the bucket by 180 degrees would look like this "models\props_junk\metalbucket01a.mdl, 0 180 0"

So here would be the actual code to put in the file. This would tell the game that on map d1_canals_06, give any npc_combine_s a bucket helmet and attach it to their eyes with a 180 degree yaw offset:

Code: [Select]
"d1_canals_06"
{
"npc_combine_s"
{
"eyes" "models\props_junk\metalbucket01a.mdl, 0 180 0"
}
}


DEFAULT MAP SETTINGS
There is one special MAPNAME called "default_map". Placing any data inside this section will apply to every map that DOES NOT have its own entry in the file.
Example: Citizens should carry frag grenade on every map except on map d1_eli_01 they should carry a broom on their back!
Code: [Select]
"default_map"
{
"npc_citizen"
{
"holster_grenadeFront2" "weapon_frag"
}
}

"d1_eli_01"
{
"npc_citizen"
{
"trinket_lowerback" "models/props_c17/pushbroom.mdl, -90 90 -35"
}
}


MULTIPLE NPC's PER MAP
For each map you can include multiple NPC's. In fact you could give every NPC in the game a different kit on every map if you wanted to. A smart move is to make a standard kit for every NPC in the "default_map" section, and then adjust on a per map basis as desired.
Example: On map d2_coast_02 combine soldiers should carry grenade on waist and citizens should carry shotgun on their back!
Code: [Select]
"d2_coast_02"
{
"npc_combine_s"
{
"holster_grenadeFront1" "weapon_frag"
}

"npc_citizen"
{
"holster_back" "weapon_shotgun"
}
}



ADVANCED

Here is some advanced stuff you can do with NPC Equipment Kits.

NPC's WITH MULTIPLE KITS
Hey wouldn't it be cool if you could make an NPC type have multiple loadouts and then randomly select between them?! Yes, yes it would. You can achieve this by merely adding one more layer of data into your regular format:

"mapname"
   {
      "npc_classname"
      {
         "weight"
         {

         "attachment_point" "model_path_or_entity_name, rotation"
         }
      }
   }


WEIGHT: This value give a kit weight. The higher the kits weight, the more likely the game is to choose it when selecting a random kit for an NPC. There does not appear to be a limit on the number of weighted kits an NPC can have.
Example: On map d3_c17_04 Combine soldiers should choose from two different kits when they spawn.
Code: [Select]
"d3_c17_04"
{
"npc_combine_s"
{
"20"
{
"holster_back" "weapon_garand"
"holster_grenadeFront0" "weapon_frag"
}

"10"
{
"holster_back" "weapon_shotgun"
}
}
}
« Last Edit: July 11, 2020, 07:08:59 PM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
« Last Edit: July 11, 2020, 07:30:04 AM by BIZ »

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal