weapon_category.txt

Overview

Source

Syntax

Usage Notes


Overview

weapon_category.txt is an SMOD script used to restrict the type and/or number of weapons the player can carry at one time. You might for instance restrict the player to carrying only one primary weapon (rifle, shotgun, RPG) and one secondary (SMG, pistol, crowbar) in a style similar to Ghost Recon.

Source



Syntax

1
2
3
4
5
6
    "Marksman"
        {
        "weapon_svd"{}
        "weapon_kar98"{}
        "weapon_crossbow"{}
        }

Line 1 names a new weapon category. The player will be able to carry only one weapon from this category at a time.

Line 2 has an opening brace, {. This signals the start of a code block, which will continue until we hit its closing brace, }. Any weapons put within these braces will be added to the category named in line 1.

Lines 3, 4, and 5 name the weapons that make up this category.

Line 6 is a closing brace for the category's 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.

Exclusion

There's a special weapon category called CannotCarry. Like the name suggests, weapons placed here cannot be picked up by the player. The syntax here is identical to the norm, as in this example:

"CannotCarry"
        {
        "weapon_mp5"{}
        }

Here, the MP5 has been restricted and the player can't carry it so long as the script is active.

Usage Notes

  • Weapon categories with the same name will not conflict. You can name all your groups "Death" if you really want to.
  • It's possible for a weapon to be in multiple categories where it will only count toward one. The exception is the first category it appears in, which it will always count toward. Take the example below:
    "Group1"
        {
        "weapon_svd"{}
        "weapon_shotgun"{}
        }
    "Group2"
        {
        "weapon_svd"{}
        "weapon_357"{}
        }
    "Group3"
        {
        "weapon_svd"{}
        "weapon_crossbow"{}
        }

Having the SVD would prevent you from taking a shotgun, but not from picking up the .357 and crossbow. The same would apply if you picked up the shotgun instead of the SVD.

  • Weapons that are unlisted or in a category of their own may be picked up at any time.

Console Variables

  • weapon_limitcategory <boolean> ( Default: 0 )
    When enabled, this script will restrict the number and type of weapons the player can carry.


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