Skip to content

Creating External Lua Config Addons

tpan496 edited this page Sep 19, 2021 · 6 revisions

Besides the client-side GUI configs, you can create lua config addons! This allows you to create multiple configurations easily. Note that class descriptions changes are not available yet in external lua configs, because they may be subject to huge changes.

You config addons should stay in garrysmod/addons/your-config/lua/horde/gamemode/custom, and have the following (example) format:

-- Example your-custom-config.lua
-- If you just want to configure items, leave enemies as empty. Vice versa.

CONFIG = {}
CONFIG.name = "custom_config" -- YOU MUST NAME IT! Used for horde_external_lua_config.

-- Leaving CONFIG.items not present will use the default item config setup.
CONFIG.items = {
    -- key and class must be the same!
    -- Weapon Entity Example:
    weapon_crowbar = {
        class="weapon_crowbar",
        category="Melee", -- You can find out the full list in !itemconfig
        name="Cheap Crowbar",
        price=50, weight=1,
        description="A cheap crowbar",
        whitelist = {Medic=true, Assault=true, Heavy=true, Demolition=true, Survivor=true, Ghost=true},
        ammo_price=0,           -- Leave it as 0 if it does not have primary ammo
        secondary_ammo_price=-1, -- Leave it as -1 if it does not have secondary ammo
        entity_properties={type=1} -- Weapon Entity type is 1.
    },
    -- Give Entity Example
    item_healthvial = {
        class="item_healthvial",
        category="Special", -- You can find out the full list in !itemconfig
        name="Health Vial",
        price=50, weight=0,
        description="Heals you",
        whitelist = {Medic=true, Assault=true, Heavy=true, Demolition=true, Survivor=true, Ghost=true},
        ammo_price=0,           -- Does not matter for entities
        secondary_ammo_price=-1, -- Does not matter for entities
        entity_properties={type=2} -- Give Entity type is 2.
    },
    -- Drop Entity Example
    item_healthvial = {
        class="item_healthvial",
        category="Equipment", -- You can find out the full list in !itemconfig
        name="Health Vial",
        price=50, weight=0,
        description="Drops onto the ground when purchased.",
        whitelist = {Medic=true, Assault=true, Heavy=true, Demolition=true, Survivor=true, Ghost=true},
        ammo_price=0,           -- Does not matter for entities
        secondary_ammo_price=-1, -- Does not matter for entities
        entity_properties={type=3, x=50, z=15, yaw=0, limit=5} -- Drop Entity type is 3.
    }
}

-- Leaving CONFIG.enemies not present will use the default enemies config setup.
CONFIG.enemies = {
    -- Since key has to be unique, you can use npc name + wave for the key.
    HugeZombie1 = {
        name = "HugeZombie1",
        class = "npc_zombie",
        weight = 1, -- Relative weight to other enemies in the same wave.
        wave = 1,
        is_elite = true,
        health_scale = 2,
        damage_scale = 1,
        reward_scale = 100,
        model_scale = 2,
        color = Color(0,255,0),
        weapon = "",
    },
    HugeCombine1 = {
        name = "HugeCombine1",
        class = "npc_combine_s",
        weight = 1, -- Relative weight to other enemies in the same wave.
        wave = 1,
        is_elite = true,
        health_scale = 2,
        damage_scale = 1,
        reward_scale = 100,
        model_scale = 2,
        color = Color(255,0,0),
        weapon = ""
    },
    RaidBoss = {
        name = "RaidBoss",
        class = "npc_combine_s",
        weight = 1, -- Relative weight to other enemies in the same wave.
        wave = 2,
        is_elite = true,
        health_scale = 2,
        damage_scale = 1,
        reward_scale = 100,
        model_scale = 2,
        color = Color(255,0,0),
        weapon = "",
        spawn_limit = nil, -- optional
        boss_properties = {is_boss=true, end_wave=true, unlimited_enemies_spawn=true, enemies_spawn_threshold=0.5, music="music/hl1_song24.mp3", music_duration=105}, -- optional, boss settings
        mutation = "fume", -- optional
        skin = nil, -- optional
        model = nil -- optional
    }
}

To use your config, simply set horde_external_lua_config to the name you used for the config (CONFIG.name). You can also do that directly in the gmod start menu.

Clone this wiki locally