Well-met Posted April 5, 2019 Share Posted April 5, 2019 hi I want my char to be immune to flinching (stunlock). Searching around and I find this inst.components.combat:SetPlayerStunlock(PLAYERSTUNLOCK.NEVER) however it seems TUNING.STUNLOCK_TIMES.NEVER no longer exists in tuning.lua and the game doesn't recognize "never". at any rate even if the command was functional, it still doesn't prevent flinching on hit. what am i doing wrong? Link to comment Share on other sites More sharing options...
IronHunter Posted April 5, 2019 Share Posted April 5, 2019 This function is applied to the attacker, not the player getting attacked. In the wilson stategraph. This stunlock is setting a timeout, you could try wrapping this state and toggling it never/original for the attacker. Not sure if that will have a conflict. But I think you can also cancel the timeout with a new uber short one. Link to comment Share on other sites More sharing options...
Well-met Posted April 5, 2019 Author Share Posted April 5, 2019 (edited) I believe changing it for the attacker will also mean they cant flinch any other player. I'm not certain where to go from here. I tried this for modmain.lua but still no luck AddComponentPostInit("combat", function(inst, self) local oldGetAttacked = self.GetAttacked function self:GetAttacked(attacker, damage, weapon, stimuli) if self.inst.prefab == "CHARNAME" then attacker.components.combat:SetPlayerStunlock(PLAYERSTUNLOCK.NEVER) end return oldGetAttacked(self, attacker, damage, weapon, stimuli) end end) (yes I changed charname) Edited April 5, 2019 by Hell-met Link to comment Share on other sites More sharing options...
IronHunter Posted April 5, 2019 Share Posted April 5, 2019 Well the idea is you toggle it, so it would set to never, playback the state, and then return it back to the original stunlock. This should all happen in a instance. With no delays to prevent it from affecting other players in the event of aoe. Again theory, also not sure if function self:Getattacked is localized or global. Maybe try self.GetAttacked = function(parameters,...) This overwrites the original GetAttacked with your new function. Link to comment Share on other sites More sharing options...
Well-met Posted April 5, 2019 Author Share Posted April 5, 2019 I won't lie, that last block I showed you was one I found around the forums. I have no idea how to build another from scratch. Link to comment Share on other sites More sharing options...
Well-met Posted April 7, 2019 Author Share Posted April 7, 2019 @IronHunter I believe this is what you meant? AddComponentPostInit("combat", function(inst, self) local oldGetAttacked = self.GetAttacked self.GetAttacked = function(inst, ...) if self.inst.prefab == "CHARHERE" then attacker.components.combat:SetPlayerStunlock(PLAYERSTUNLOCK.NEVER) end return oldGetAttacked(self, attacker, damage, weapon, stimuli) end end) no luck still Link to comment 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