Community Forum

Horse Fitness and Riding Percent

Forum Overview >> Scripting

Created25.12.2021 05:45

viusing 25.12.2021 05:45
Has anyone had any luck modifying horse fitness and/or riding percentage? I can't find anything useful in the source scripts sadly, but I assume the values are there somewhere.

Jean Fainges (Makrond) 25.12.2021 06:07
From the Rideable specialisation:

function Rideable:updateRiding(dt)
local spec = self.spec_rideable

if spec.cluster ~= nil and spec.currentSpeed ~= 0.0 then
local ridingTime = spec.cluster:getDailyRidingTime()
local changeDelta = ridingTime / 100
local speedFactor = 1

local gaitType = spec.inputValues.currentGait
if gaitType == Rideable.GAITTYPES.CANTER then
speedFactor = 2
elseif gaitType == Rideable.GAITTYPES.GALLOP then
speedFactor = 3

spec.ridingTimer = spec.ridingTimer + (dt*speedFactor)

if spec.ridingTimer > changeDelta then
spec.ridingTimer = 0
spec.cluster:changeRiding(1) -- I believe these are the values you're looking for
spec.cluster:changeDirt(1) --

if self.lastMovedDistance > 0.001 then
local stats = g_currentMission:farmStats(self:getOwnerFarmId())
local distance = self.lastMovedDistance*0.001
stats:updateStats("horseDistance", distance)


Rideable also provides a getCluster() function so you can access the cluster of a specific instance from other classes.

viusing 25.12.2021 06:16
Aha! Thank you very much! Going to see what I can do with changeRiding and report back, in case someone else is looking for the same.

viusing 25.12.2021 23:38
And done, although I had to do some recursive table printing to find the proper function and all:

Note: Log in to post. Create a new account here.