Mariotu4 Posted April 26, 2017 Share Posted April 26, 2017 I've been playing around with the armor component and I can't seem to remove the call back to PercentChanged. How would I go about doing this? Link to comment Share on other sites More sharing options...
Lumina Posted April 26, 2017 Share Posted April 26, 2017 I know that armor skeleton doesn't break at 0%, but it works differently than others armor (fueling instead of 0%). you can try to look at the code maybe, but it's complex. Link to comment Share on other sites More sharing options...
Aquaterion Posted April 28, 2017 Share Posted April 28, 2017 You'd have to adjust a function or 2 in the armor component put this in modmain.lua: (untested) NOTE replace where ever it says "YOUR_PREFAB" with your prefab name (2 occurrences) AddComponentPostInit("armor", function(self) local oldTakeDamage = self.TakeDamage local oldGetAbsorption = self.GetAbsorption function self:TakeDamage(damage_amount) if (self.inst.prefab ~= "YOUR_PREFAB" or (self.condition - damage_amount) > 0) then return oldTakeDamage(self, damage_amount) else if (self.condition - damage_amount) <= 0 then self.condition = 0 if self.onfinished ~= nil then self.onfinished() end end end end function self:GetAbsorption(attacker, weapon) return (self.inst.prefab ~= "YOUR_PREFAB" or self.condition > 0) and oldGetAbsorption(self, attacker, weapon) or nil end end) 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