Jump to content

Recommended Posts

I tried to make my DST Character better at healing and succeeded. but now it also aplies when i eat any health restoring food item. Does anyone know a way to change this code to where it only affects healer items such as spider glads and haling salves? 

under charactername.lua:
local function _newHealthDoDelta(self, amount, cause, ...)
    local MULT = 1.5
    if amount > 0 then amount = amount * MULT end
    return self.inst._oldHealthDoDelta(self, amount, cause, ...)
end

under master_postinit:
    inst:ListenForEvent("_newHealthDoDelta", _newHealthDoDelta)
    
    inst._oldHealthDoDelta = inst.components.health.DoDelta
    inst.components.health.DoDelta = _newHealthDoDelta

My guess would be to implement the feature to the specific items which you want to be affected. For example a function which checks what item was consumed and then apply the multiplier.

As of right now the code affects all items since you don't have a restriction.

1 hour ago, Lumina said:

Problem is that make the mod not compatible with other mods that will add healing items. Maybe just exclude the items with the edible component instead ?

Good idea with the edible thing, didn't think about it. Could be probably an "if else" function to exclude them.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...