sjtdhiqbwczfzpu Posted March 16, 2021 Share Posted March 16, 2021 (edited) Hi. I'm trying to make the character take more damage. Several years ago I made a mod in which I managed to do this. But I lost this mod and now I don't remember how I did it. I try to do it with this: inst.components.health.absorb = -0.5 But "absorb" doesn't seem to work anymore to increase damage, only to decrease. Edited March 17, 2021 by sjtdhiqbwczfzpu solved Link to comment https://forums.kleientertainment.com/forums/topic/128015-solved-taking-more-damage/ Share on other sites More sharing options...
Combustiblemon Posted March 16, 2021 Share Posted March 16, 2021 inst.components.health.externalabsorbmodifiers:Set(-0.5) maybe this? absorb and playerabsorb are deprecated, as written in health.lua. Link to comment https://forums.kleientertainment.com/forums/topic/128015-solved-taking-more-damage/#findComment-1438726 Share on other sites More sharing options...
sjtdhiqbwczfzpu Posted March 16, 2021 Author Share Posted March 16, 2021 2 hours ago, Combustiblemon said: inst.components.health.externalabsorbmodifiers:Set(-0.5) maybe this? absorb and playerabsorb are deprecated, as written in health.lua. I already tried this, the game just crashes "absorb" and "playerabsorb" are deprecated, but it still work for absorb damage Link to comment https://forums.kleientertainment.com/forums/topic/128015-solved-taking-more-damage/#findComment-1438769 Share on other sites More sharing options...
Combustiblemon Posted March 17, 2021 Share Posted March 17, 2021 local function HealthDeltaPlus(inst, amount, overtime, cause, ignore_invincible, afflicter, ignore_absorb) if not ignore_invincible and (self.invincible or self.inst.is_teleporting) then return 0 elseif amount < 0 and not ignore_absorb then amount = amount * math.clamp(1 - (self.playerabsorb ~= 0 and afflicter ~= nil and afflicter:HasTag("player") and self.playerabsorb + self.absorb or self.absorb), 0, 1) * math.clamp(1 - self.externalabsorbmodifiers:Get(), 0, 1) * 1.5 end local old_percent = inst.components.health:GetPercent() inst.components.health:SetVal(inst.components.health.currenthealth + amount, cause, afflicter) local new_percent = inst.components.health:GetPercent() inst:PushEvent("healthdelta", { oldpercent = old_percent, newpercent = new_percent, overtime = overtime, cause = cause, afflicter = afflicter, amount = amount }) if inst.components.health.ondelta ~= nil then inst.components.health.ondelta(inst, old_percent, new_percent) end return amount end ================================ inst.components.health.redirect = HealthDeltaPlus You're right, absorb/playerabsorb/externalmodifiers can only "absorb" damage(because they has math.clamp), so I had to redirect entire healthdelta. 1 Link to comment https://forums.kleientertainment.com/forums/topic/128015-solved-taking-more-damage/#findComment-1439086 Share on other sites More sharing options...
sjtdhiqbwczfzpu Posted March 17, 2021 Author Share Posted March 17, 2021 5 hours ago, Combustiblemon said: You're right, absorb/playerabsorb/externalmodifiers can only "absorb" damage(because they has math.clamp), so I had to redirect entire healthdelta. Yes, I suspected that this was the cause of the problem, but my knowledge was not enough to solve it. I replaced all "self" to "inst.components.health" and now it works for me. Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/128015-solved-taking-more-damage/#findComment-1439178 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