Skip to content

SetItemClassWeight

Sets what every item of a kind weighs, for every player - lighter rocks, heavier armour.

weight is in kilograms per piece, 0 to 1000, in place of the game’s own (GetItemInfo weight). It holds for every player at once and for every item of the class wherever it is: the game’s inventory, a horse’s saddlebags, the item panel and what a player carries - an overloaded player cannot sprint or mount, as with the game’s own weights - and the server’s carry-weight check weighs it the same way. A tagged item with a weight of its own (SetPlayerItemWeight) keeps it. nil gives the class its own back. Set it in OnGameModeInit for a rule of the server; players who join later get it as they spawn. At most 1024 classes have a rule.

SetItemClassWeight(item, weight)
Parameter Type
item string | number the item class - its name, id, English name or GUID (the item catalogue)
weight number | nil kilograms per piece; nil = the class’s own

boolean - false for an unknown item, a weight outside 0..1000, or a 1025th class

function OnGameModeInit()
SetItemClassWeight("bsmt_ironGood", 0.5) -- a smith can carry a cart's worth of iron home
SetItemClassWeight("ArmPlate01_m01_C2", 4) -- heavier couters
end

GetItemClassWeight · SetItemClassPrice · SetPlayerItemWeight · GetItemInfo · GetPlayerWeight · the Items and inventory group of the index