Given the way pills are coded, the following will work for custom versions:
The custom item name must start with Pills.
Example:
item PillsEnergy
{
...
Type = Drainable,
UseDelta = 0.1, /*** math: uses/100 for 10 uses ***/
...
}
Override ISTakePillAction:perform, check for custom item, do a thing:
Example:
--- inside client folder add lua file to override as follows:
do
-- Option 1: Use this assignment for debugging purpose; preserves original 'perform' function given this lua is reloaded while debugging it.
ISTakePillActionPerform = ISTakePillActionPerform or ISTakePillAction.perform
-- Option 2: Use this assignment for final release.
-- local ISTakePillActionPerform = ISTakePillAction.perform
function ISTakePillAction:perform()
if (self.item:getFullType() == 'Base.PillsEnergy') then --- Note: module 'Base' is assumed. Use what is valid.
--- Note: custom code here; like self.character:getStats():setFatigue(0)
end
ISTakePillActionPerform(self) -- still call original for action cleanup.
end
end
-- Yesod