Skip to content

SetHorseItems

Makes a horse’s saddlebags hold exactly this list.

What was in them is gone, the list’s items are there - in the server’s record and in the copy on the screen of the player whose game holds the bags (the owner, else the rider, else the one who simulates the horse), which the server fills and checks the player’s game made - so the item check counts them as the horse’s and taking them out is no cheat. A horse nobody holds keeps the list for whoever holds it next. A class is any key of the item catalogue; an unknown one is logged and skipped. The money class (the groschen) is kept in the bags too: its amount is in tenths of a groschen, as GetHorseItems returns it, and all of it is one stack. Otherwise 64 stacks at most, 65 535 to a stack (money: up to 1 000 000 000 tenths). When a saved horse comes back, dress it first (SetHorseGear), then fill it. An entry with an id is one of the mode’s tagged items (one item, its name and text shown in the game’s item panel).

SetHorseItems(id, items)
Parameter Type
id number the horse
items table a list of {class=, amount=, health=, quality=} (amount 1 and health 100 when left out, quality the class’s own; id, name, text for a tagged item), as GetHorseItems returns it

boolean - false when it is not a horse

-- a saved horse back at the login: the breed, the gear, then the bags
local x, y, z = GetPlayerPos(pid)
local horse = CreateHorse(x + 3, y, z, 0, pid, nil, saved.breed)
if horse then
SetHorseGear(horse, saved.gear)
SetHorseItems(horse, saved.items)
end

GetHorseItems · SetHorseGear · CreateHorse · the Horses group of the index