Earthyburt Posted April 30, 2021 Share Posted April 30, 2021 (edited) This is the last major thing I need help with in regards to the mod update of mine; basically I have created a function for a healing item that changes depending on sanity, health, and maxhealth. Sorry that I have been using these forums so much. local function setHealing(owner) local sanity = owner.components.sanity and owner.components.sanity.GetPercent() or 0 local currentHealth = owner.components.health and owner.components.health.current or 0 local maxHealth = owner.components.health and owner.components.health.maxhealth or 0 ---I know I need to get a variable for the item, but I looked at the inventory item component and I didn't find anything useful if healing = sanity * (maxHealth - currentHealth) inventoryitem.components.healer:SetHealthAmount(healing) end local function onpickup(inst) owner:ListenForEvent("sanitydelta", setHealing) end local function OnDropped(inst) owner:RemoveEventCallback("sanitydelta", setHealing) end Update: this is the best I got for the inventoryitem local function setHealing(owner) local sanity = owner.components.sanity and owner.components.sanity.GetPercent() or 0 local currentHealth = owner.components.health and owner.components.health.current or 0 local maxHealth = owner.components.health and owner.components.health.maxhealth or 0 local item = owner.components.inventory and owner.components.inventory:GetInventoryItem if item ~= nil then healing = sanity * (maxHealth - currentHealth) inventoryitem.components.healer:SetHealthAmount(healing) end end Update: PLEASE help me with this. This is the very last thing I need to do before updated my mod. Please I just want this done.............. Edited May 1, 2021 by Earthyburt help Link to comment https://forums.kleientertainment.com/forums/topic/129479-item-healing-amount-not-changing/ 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