Skip to content

SetHorseStat

Sets a stat of a horse to a level, exactly.

stat is strength, agility, vitality or courage; level is 0 .. 30. These are the stats the game keeps for the animal itself, and the set is exact: the level is what it says, lowering a higher one included. The horse shows it on every screen that has it - the rider’s, the others’, and the screens of players who come into view later. A horse never set has its breed’s own. A 0 is a level like any other: it is stored and sent as an exact 0, it does not give the breed’s own back, and GetHorseStat answers 0 for it just as for a stat never set - only GetHorseStats tells the two apart. The stats belong to the horse in the world and go with it: the server forgets them when the horse is destroyed or the server stops, so a mode that keeps horses saves the levels it gave (GetHorseStats) and sets them again when it makes the horse again. The stats of a player’s own character are SetPlayerStat’s.

SetHorseStat(id, stat, level)
Parameter Type
id number the horse
stat string "strength", "agility", "vitality" or "courage"
level number 0 .. 30

boolean - false when it is not a horse, the name is no horse stat, or the level is outside 0..30

-- the stable's best: an agile, hardy horse for the buyer
local x, y, z = GetPlayerPos(pid)
local horse = CreateHorse(x + 2, y, z, GetPlayerYaw(pid), pid, nil, "Pebbles")
if horse then
SetHorseStat(horse, "agility", 25)
SetHorseStat(horse, "vitality", 25)
end

GetHorseStat · GetHorseStats · CreateHorse · SetPlayerStat · the Horses group of the index