Jump to content

PlayerStunLock.Never


Recommended Posts

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

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

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 by Hell-met
Link to comment
Share on other sites

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

@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

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
 Share

×
  • Create New...