Well-met Posted January 10, 2025 Share Posted January 10, 2025 This commands also deactivates Sanity and Hunger Is there a way to set health invincibility without interfering with hunger and sanity? Link to comment https://forums.kleientertainment.com/forums/topic/163062-componentshealthsetinvincible/ Share on other sites More sharing options...
yanecc Posted January 11, 2025 Share Posted January 11, 2025 ThePlayer.components.health.deltamodifierfn = function() return 0 end 1 Link to comment https://forums.kleientertainment.com/forums/topic/163062-componentshealthsetinvincible/#findComment-1785079 Share on other sites More sharing options...
Well-met Posted January 11, 2025 Author Share Posted January 11, 2025 8 hours ago, yanecc said: ThePlayer.components.health.deltamodifierfn = function() return 0 end that's pretty good, unfortunately this still plays the hit feedback (pain, stun, red screen) Link to comment https://forums.kleientertainment.com/forums/topic/163062-componentshealthsetinvincible/#findComment-1785126 Share on other sites More sharing options...
oregu Posted February 3, 2025 Share Posted February 3, 2025 (edited) Kind of late, but in order to do that you have to modify a lot of stuff. I tried setting the players stun value to be STUNNABLE.NEVER but I got inconsistent results, so I overwrote the attacked event instead. Not sure what you need this for but it's probably easy to modify since it only depends on a tag. Spoiler local _G = GLOBAL local statetag = "invulnerable" -- In case it needs to be changed later local function OverlayDisable(self, owner) local Flash_old = self.Flash self.Flash = function(self, ...) if owner:HasTag(statetag) then return end -- No red pulses Flash_old(self, ...) end end AddClassPostConstruct("widgets/bloodover", OverlayDisable) AddStategraphPostInit("wilson", function(sg) -- No AddStategraphPostInitAny, so I'm not sure how to make any inst unstunnable? if not sg.events.attacked.fn then return end local attacked_old = sg.events.attacked.fn sg.events.attacked.fn = function(inst, data) if inst:HasTag(statetag) then return end -- No stun attacked_old(inst, data) end end) local function invulnerableOn(inst) if not inst:HasTag(statetag) then print(inst, "invuln on") inst:AddTag(statetag) inst.components.health.externalabsorbmodifiers = _G.SourceModifierList(inst, 1, _G.SourceModifierList.additive) -- No damage delta else print(inst, "invuln already on") end end local function invulnerableOff(inst) if inst:HasTag(statetag) then print(inst, "invuln off") inst:RemoveTag(statetag) inst.components.health.externalabsorbmodifiers = _G.SourceModifierList(inst, -1, _G.SourceModifierList.additive) else print(inst, "invuln already off") end end local function c_invulnerable(toggle, inst) local inst = inst or _G.ConsoleCommandPlayer() or _G.ThePlayer if type(toggle) == "boolean" then if toggle then invulnerableOn(inst) else invulnerableOff(inst) end elseif inst:HasTag(statetag) then invulnerableOff(inst) else invulnerableOn(inst) end end GLOBAL.c_invulnerable = c_invulnerable Edited February 5, 2025 by oregu Link to comment https://forums.kleientertainment.com/forums/topic/163062-componentshealthsetinvincible/#findComment-1792760 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