Adjusting Animal Productions

Game Version: FS13 and later
GE Version: ? and later


Modding Index | Map Making Tutorials


This tutorial is for anyone who feels their cows, sheep and chickens are producing too much or too little.

Part 1 FS13-FS15

Step 1: Create the script file Script provided by Bassaddict with permission to create this tutorial with it. –  Copy the following code into a text file and save it as something similar to husbandry.lua or animals.lua –  Manipulate the numbers anyway you see fit for feed usage and manure / milk / slurry / wool / egg production.

AnimalValues = {};

function AnimalValues:loadMap(name)
   g_strawUsagePerAnimalPerDay.cow = 235;
   g_forageUsagePerAnimalPerDay.cow = 350;
   g_manureLitersPerAnimalPerDay.cow = 53;
   g_grassUsagePerAnimalPerDay.cow = 450;
   g_silageUsagePerAnimalPerDay.cow = 535;
   g_liquidManureLitersPerAnimalPerDay.cow = 210;
   g_milkLitersPerAnimalPerDay.cow = 198;

   g_forageUsagePerAnimalPerDay.chicken = 1;
   g_pickupObjectsPerAnimalPerDay.chicken = 1;

   g_forageUsagePerAnimalPerDay.sheep = 125;
   g_palletFillLevelPerAnimalPerDay.sheep = 26;
end;

function AnimalValues:deleteMap()
end;

function AnimalValues:mouseEvent(posX, posY, isDown, isUp, button)
end;

function AnimalValues:keyEvent(unicode, sym, modifier, isDown)
end;

function AnimalValues:update(dt)
end;

function AnimalValues:draw()
end;

addModEventListener(AnimalValues);

Step 2:  Place the script file in your map folder. See the attached snapshot for an example. This can be in the parent folder of the map or if the map has a 'scripts' subfolder, you can place it there.

Step 3:  Edit the map moddesc file to call the script file when the game loads. Place the following xml tag line (file path is important; depends on where you placed it in the parent folder or a subfolder):

<sourceFile filename="husbandry.lua" />

in between the following brackets that should have other files being called already:

<extraSourceFiles>

</extraSourceFiles>

See attached second file for an example.

Step 4:  Run a test of the map and check your log file for any errors such as the 'cant load resource' error.

We hope this helps and thanks again to Bassaddict for the script share.

Part 2 FS17

Thanks to Bassaddict we have insight on the FS17 animal attributes…

Animals now have their own class which contains all the date. Here's a quick copy&paste of all the values:

local desc = {name = name, index = AnimalUtil.NUM_ANIMALS};
        desc.title = title;
        desc.imageFilename = imageFilename;
        desc.price = price;
        desc.dailyUpkeep = dailyUpkeep;
        desc.canBeBought = canBeBought;
        desc.hasStatistics = hasStatistics;
        desc.subType = 0;

        desc.milkPerDay = 0;
        desc.manurePerDay = 0;
        desc.liquidManurePerDay = 0;
        desc.palletFillLevelPerDay = 0;
        desc.pickUpObjectsPerDay = 0;
        desc.dirtFillLevelPerDay = 0;
        desc.birthRatePerDay = 0;
        desc.strawPerDay = 0;
        desc.waterPerDay = 0;
        desc.foodPerDay = 0;

        AnimalUtil.animals[name] = desc;

Original Author: JDM | Date: April 24, 2016

Modding Index | Map Making Tutorials