CalcLeveledItem

A command for Oblivion Script Extender

Syntax:

(randomItem:ref) CalcLeveledItem leveledList:ref level:short useChanceNone:bool levelDiff:short

Returns one item from a leveled item list, selected randomly for a character of the specified level.

By default, this function selects a level range from which to choose using the game setting iLevItemLevelDifferenceMax. The item chosen is within the range [minLevel...maxLevel], where maxLevel is the level in the list closest to but not exceeding the character's level, and minLevel = maxLevel - levelDiff.

If the “Calculate for all item <= level” flag is set for the leveled list, minLevel is always zero.

This behavior differs significantly from the standard Oblivion lists behavior, where iLevItemLevelDifferenceMax is not considered at all unless the "all levels" flag is set.

This function checks the "Chance None" property of the leveled list, so it may return nothing based on that chance; pass 0 for the third parameter to override this behavior. In the case of leveled lists containing nested leveled lists, the function recurses through each list until it finds a non-leveled item. Omit the levelDiff parameter to use the current value of iLevItemLevelDifferenceMax.

See AlsoEdit