Script for changing value in inaccessible .lua file

Your forum for all discussions around Modding.
FlorianPaun
Posts: 3
Joined: Thu Apr 13, 2023 1:02 am

Script for changing value in inaccessible .lua file

Post by FlorianPaun »

The game is hard-coded to render a maximum amount of visible animals per placeable, depending on the game settings profile. The highest it will go is 25 when the game is set to very high.

The value maxNumVisualAnimals is hard-coded in PlaceableHusbandryAnimals.lua, which is located inside of the dataS.gar, so I can not edit it directly.

So my guess is that the only way to change this value is through a script. How should I go about doing this? I've tried different things and look at how other mods (like the enhanced animals mod) do this but I'm in over my head.

Link to PlaceableHusbandryAnimals documentation:
https://gdn.giants-software.com/documen ... &class=501

Code: Select all

if spec.animalTypeIndex == AnimalType.HORSE then
        spec.maxNumVisualAnimals = math.min(spec.maxNumAnimals, 16)
        spec.maxNumAnimals = math.min(spec.maxNumAnimals, 16)
    else
        local profileClass = Utils.getPerformanceClassId()
        if GS_PLATFORM_XBOX or profileClass == GS_PROFILE_LOW then
            spec.maxNumVisualAnimals = 10
        elseif profileClass >= GS_PROFILE_VERY_HIGH then
            spec.maxNumVisualAnimals = 25
        elseif profileClass >= GS_PROFILE_HIGH then
            spec.maxNumVisualAnimals = 20
        else
            spec.maxNumVisualAnimals = 16
        end
    end
edit: Or maybe a script that changes the spec_husbandryAnimals.maxNumVisualAnimals value of the animal husbandry(s)