Skip to content

Instructions

Learn how to integrate custom models into the keep-companion script seamlessly.

How to add custom models

Follow these steps to add custom models to the keep-companion script:

Create a qb-core item

Create an item in qb-core to represent your pet. Ensure the item has the necessary properties, including name, label, weight, image, and description.

lua
["germanshepherd"] = {
    ["name"] = "germanshepherd",
    ["label"] = "German Shepherd",
    ["weight"] = 500,
    ["type"] = "item",
    ["image"] = "A_C_germanshepherd.png",
    ["unique"] = true,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Shepherd is your royal companion!"
}

Update the configuration file

Add the newly created item to the end of the pets list in the config.lua file. Specify the model name, maximum health, and distinct property of your pet.

lua
Config.pets = {
    [10] = {
        name = 'germanshepherd',
        model = 'A_C_germanshepherd',
        maxHealth = 350,
        distinct = 'yes dog'
    }
}

Step 3: Modify the PetVariation table

Edit the PetVariation table in the shared.lua file to specify the texture and color of your pet when it respawns.

lua
local PetVariation = {
    ['A_C_germanshepherd'] = {
        variation = {
            componentId = 0,
            drawableId = 0,
            textureId = 0
        }
    }
}

Step 4: Adjust the CorrectionList

Update the correctionList table in the animator.lua file to assign animation sets to different pet models.

lua
local correctionList = {
    ['A_C_germanshepherd'] = animationList.rottweiler,
}

Note

  • Make sure to adjust the paths and values according to your specific setup and requirements.
  • Utilize the provided variationTester() function to explore valid variations for your pet model.

That's it! You've successfully added a custom model into the keep-companion script. Enjoy!