Jump to content

Need help editing freezable AddColdness function


Recommended Posts

Hello, I need help with something I can't figure out myself :lol:

So basically my character has very low freezing resistance like 1, but this seems to cause problems because when the character is frozen they can become frozen again basically being trapped in a frozen state until they die if they're hit from something like deerclops. So what I would like to do is make it the addcoldness function of the freezable state won't work if the entity is already frozen to prevent stuff from being stuck in frozen state forever :wilson_ecstatic:.

Thanks for reading and any help, have a great time :D!

 

 

Edited by Warbucks
Link to comment
Share on other sites

go to your character's prefab file, this should be in somewhere like prefabs/FluffyCakeChan.lua for example

put this outside master_postinit (before it):

local function AddColdness_override(self, ...)
	if self:IsFrozen() then
		return
	end

	self:AddColdness_original(...)
end

put this inside master_postinit (preferably at the end):

local freezable = inst.components.freezable
freezable.AddColdness_original = freezable.AddColdness
freezable.AddColdness = AddColdness_override

 

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...