API:SetMoraleBarData
From RoR Wiki
UI Lua API · Hotbar functions
Version: WAR 1.4.8
Asks the server to place a morale ability in a morale bar slot, or to clear the slot.
SetMoraleBarData(moraleLevel, abilityId)
Arguments
- moraleLevel
number– Morale slot, 1 toGameData.NUM_MORALE_LEVELS(4). It is converted to an 8-bit integer.- abilityId
number– Id of the morale ability, or 0 to clear the slot. It is converted to a 16-bit integer.
Returns
Nothing.
Details
- The client only sends the request; it does not change its own copy of the morale bar here.
- Nothing is sent if the connection is not ready.
- For a slot outside 1 to 4 the error below is logged (not raised as a Lua error) and nothing is sent.
- The function needs at least two arguments and only reads the last two.
Errors
Error in function call 'SetMoraleBarData': moraleSlotId must be 1 to GameData.NUM_MORALE_LEVELS.(logged)- The generic Invalid Parameters message when an argument is not a number.
Example
From ea_moralewindow/source/moralewindow.lua:
SetMoraleBarData (self.m_MoraleLevel, Cursor.Data.ObjectId)
Clearing a slot, from the same file:
SetMoraleBarData (self.m_MoraleLevel, 0)
