. . . Posted August 21, 2016 Share Posted August 21, 2016 (edited) Hello, I need a little bit of help . So, my character has a dodge power thing & when he dodges he becomes invincible for as long as his dodging but the problem is while his dodging & his invincible if she's wearing any armor & he gets hit while dodging then the armor takes damage even though he's supposed to be invincible! And that's kinda problem-ish ! Can someone tell me if there's a way to fix this or is there no way to make armor invincible as well? Here's the code if you need to see it & if you need my character to help me then please let me know & I will upload as fast as possible ! local DODGE = GLOBAL.Action() DODGE.str = "Dodge" DODGE.id = "DODGE" DODGE.fn = function(act) if act.target.components.hunger.current >= 10 and act.target.flawless_mode == nil then if act.target:HasTag("playerghost") or act.target.components.health:IsDead() or act.target.sg:HasStateTag("giving") or act.target.sg:HasStateTag("playing") or act.target.sg:HasStateTag("busy") or act.target.sg:HasStateTag("working") or act.target.sg:HasStateTag("fishing") or act.target.sg:HasStateTag("doing") then return end act.target.sg:GoToState("dodge") act.target.components.hunger:DoDelta(-10) act.target.components.health.invincible = true act.target:DoTaskInTime(0.73, function() if act.target:HasTag("playerghost") or act.target.components.health:IsDead() then return end act.target.components.health.invincible = false end) elseif act.target.components.hunger.current <= 9.99 and act.target.components.sanity:IsSane() then if act.target:HasTag("playerghost") or act.target.components.health:IsDead() then return end act.target.components.talker:Say("Ugh...") elseif act.target.components.hunger.current <= 9.99 and not act.target.components.sanity:IsSane() then if act.target:HasTag("playerghost") or act.target.components.health:IsDead() then return end act.target.components.talker:Say("We NeEd FoOd!!!") end end Edited September 12, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69686-solved-i-need-help-fixing-a-dodge-action/ Share on other sites More sharing options...
rezecib Posted August 21, 2016 Share Posted August 21, 2016 @SuperDavid Seems like the easiest way to do this is to just override the combat component's GetAttacked function (this would also hand the invincibility for you): local _GetAttacked = inst.components.combat.GetAttacked function inst.components.combat:GetAttacked(...) if inst.is_dodging then --or however you're saving the dodge state return false --false means the damage was "blocked" end return _GetAttacked(self, ...) end You'd put this in the character's master_postinit. Link to comment https://forums.kleientertainment.com/forums/topic/69686-solved-i-need-help-fixing-a-dodge-action/#findComment-805452 Share on other sites More sharing options...
. . . Posted August 21, 2016 Author Share Posted August 21, 2016 (edited) @rezecib Awesome it worked great, thank you so much !!! Edited August 21, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69686-solved-i-need-help-fixing-a-dodge-action/#findComment-805484 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