Roqi Posted November 7, 2022 Share Posted November 7, 2022 I've been trying to find this function for hours... I've gotten a new pills item but when you consume it, it doesn't do anything..... Also, I used the same exact pillsbox as in game but during the animation, its offset is away from the hand??? Can someone please direct me which files I need to edit to add a new function for my new pills item when consuming it so it decreases the amount of them and also has function, I can implement I beg .... Link to comment Share on other sites More sharing options...
Yesod Posted November 9, 2022 Share Posted November 9, 2022 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now