Configuration

The XSC_Raids configuration system allows you to create and customize each raid by defining attributes like location, guards, loot, cooldowns, and more. Below is a breakdown of each configurable option, an example configuration file, and steps to load your custom configuration files into the server.


Example Configuration File

{
    raidId = "testRaid",
    raidName = "Test Raid",
    startCost = 85000,
    cooldown = 60, -- Cooldown in minutes

    guardHelper = true,
    guardHelperTime = 3, -- Time before Guard Helper is shown in minutes
    lootHelper = true,
    lootHelperTime = 3, -- Time before Loot Helper is shown in minutes

    location = vector3(255.75, -774.44, 30.66),

    startingPed = {
        model = "ig_drfriedlander",
        coords = vector4(261.01, -774.90, 30.64, 65.20),
    },

    endingPed = {
        model = "u_f_y_jewelass_01",
        coords = vector4(259.05, -779.59, 30.56, 68.03),
    },
    
    loot = {
        { name = 'red_key', chance = 45, lowAmount = 1, highAmount = 1},
        { name = 'thermitecharge', chance = 65, lowAmount = 1, highAmount = 2},
        { name = 'chronax', chance = 45, lowAmount = 15, highAmount = 25 },
    },

    objective = {
        item = "walker_manifest",
        requiredAmount = 1
    },

    guards = {
        {
            model = "s_m_m_movprem_01",
            weapon = "WEAPON_HEAVYPISTOL",
            armor = 25,
            accuracy = 45,
            spawnPoint = vector4(261.97, -767.50, 30.88, 161.57)
        },
    }
}

Loading Custom Configurations

Once you've created a new configuration file, you’ll need to add it to the fxmanifest.lua file and specify its path in the server/main.lua script.

Step 1: Add Configuration File to fxmanifest.lua Open the fxmanifest.lua file and add your configuration file to the files section:

files {
    'configs/config_test.lua',
    -- Add any additional configuration files here
}

Step 2: Update configPaths in server/main.lua

In server/main.lua, you’ll find a LoadAllRaidConfigs function that loads each raid configuration file. To ensure your new configuration file is loaded, add its path to the configPaths variable:

local function LoadAllRaidConfigs()
    print("Server: Starting to load all raid configurations.")
    local configPaths = {
        "configs/config_test.lua",
        -- Add additional configuration paths here
    }

    for _, filePath in ipairs(configPaths) do
        local configData = LoadResourceFile(GetCurrentResourceName(), filePath)
        if configData then
            local raidConfig = load(configData)()
            if raidConfig and raidConfig.raidId then
                raidConfigs[raidConfig.raidId] = raidConfig
                print("Server: Loaded configuration for raid - " .. raidConfig.raidName)
            else
                print("Server: Failed to load configuration file - " .. filePath)
            end
        else
            print("Server: Error reading file - " .. filePath)
        end
    end
end

Adding the new configuration file path in configPaths allows the server to recognize and load your custom raid setup.

Configuration Options

Each element in the configuration file controls a specific aspect of the raid. Here’s a description of each field:

raidId: Unique identifier for the raid.
raidName: Display name of the raid.
startCost: In-game currency cost to start the raid.
cooldown: Cooldown time in minutes before the raid can be started again.
Helper Settings
guardHelper: Enables or disables the guard helper feature, which provides assistance during guard encounters.
guardHelperTime: Time in minutes before the guard helper becomes available.
lootHelper: Enables or disables the loot helper feature, providing assistance in locating loot.
lootHelperTime: Time in minutes before the loot helper becomes available.
Location and Peds
location: The starting point of the raid, defined as a vector3 coordinate.
startingPed: NPC who initiates the raid. Includes:
model: Ped model used for the starting NPC.
coords: Location and orientation of the starting NPC, defined as vector4.
endingPed: NPC who completes the raid. Includes:
model: Ped model used for the ending NPC.
coords: Location and orientation of the ending NPC, defined as vector4.

Loot Configuration

loot: A table of items that players may obtain upon raid completion. Each item has:
name: Item identifier.
chance: Percentage chance of the item dropping.
lowAmount: Minimum quantity of the item that can drop.
highAmount: Maximum quantity of the item that can drop.
Objective
objective: Specifies the item and quantity required to complete the raid. Includes:
item: Identifier of the objective item.
requiredAmount: Quantity of the item required to succeed in the raid.

Last updated