Stormish Posted September 21, 2021 Share Posted September 21, 2021 Hi all. So I decided to do some wacky stuff with the badges and I decided to replace the sanity meter with something else, keeping its functionalities as it is but just changing the look of the sanity meter, I also tried to change the ring around the health meter and the hunger meter but it seems like it didn't change... I've somehow succeeded "replacing" the sanity meter, but for some reason, It looks more like I overlapped it with the OG sanity meter and so it looks weirder than it should've been. This is what it currently looks like: Spoiler This is what it SHOULD look like: Spoiler Here's the code if anyone's interested in helping Spoiler local function StormishMechMeter(self, inst) if inst and inst.prefab == "stormish" then local function SetMechMeterForStormish(inst) self.brain.anim:GetAnimState():SetBuild("sanity_robot") self.brain.anim:GetAnimState():SetBank("sanity_robot") self.stomach.anim:GetAnimState():SetBuild("hunger") self.stomach.anim:GetAnimState():SetBank("hunger") self.stomach.anim:GetAnimState():OverrideSymbol("frame_circle", "sanity_robot", "Outer_ring") self.heart.anim:GetAnimState():SetBuild("health") self.heart.anim:GetAnimState():SetBank("health") self.heart.anim:GetAnimState():OverrideSymbol("frame_circle", "sanity_robot", "Outer_ring") end local function SetHumanMeterForStormish(inst) self.brain.anim:GetAnimState():SetBuild("sanity") self.brain.anim:GetAnimState():SetBank("sanity") self.stomach.anim:GetAnimState():SetBuild("hunger") self.stomach.anim:GetAnimState():SetBank("hunger") self.stomach.anim:GetAnimState():ClearOverrideSymbol("frame_circle") self.heart.anim:GetAnimState():SetBuild("health") self.heart.anim:GetAnimState():SetBank("health") self.heart.anim:GetAnimState():ClearOverrideSymbol("frame_circle") end function self:SetStormishHUD(inst) SetMechMeterForStormish(inst) end function self:SetHumanStormishHUD(inst) SetHumanMeterForStormish(inst) end inst.SetHumanStormishHUD = function(inst) self:SetHumanStormishHUD(inst) end inst.SetStormishHUD = function(inst) self:SetStormishHUD(inst) end end end AddClassPostConstruct("widgets/statusdisplays", StormishMechMeter) Thanks in advance. Link to comment https://forums.kleientertainment.com/forums/topic/133821-how-do-i-change-an-existing-badges-animations-into-a-different-one/ Share on other sites More sharing options...
Monti18 Posted September 21, 2021 Share Posted September 21, 2021 Spoiler self.topperanim = self.underNumber:AddChild(UIAnim()) self.topperanim:GetAnimState():SetBank("status_meter") self.topperanim:GetAnimState():SetBuild("status_meter") self.topperanim:GetAnimState():PlayAnimation("anim") self.topperanim:GetAnimState():SetMultColour(0, 0, 0, 1) self.topperanim:SetScale(1, -1, 1) self.topperanim:SetClickable(false) self.circleframe:GetAnimState():Hide("frame") self.circleframe2 = self.underNumber:AddChild(UIAnim()) self.circleframe2:GetAnimState():SetBank("status_sanity") self.circleframe2:GetAnimState():SetBuild("status_sanity") self.circleframe2:GetAnimState():OverrideSymbol("frame_circle", "status_meter", "frame_circle") self.circleframe2:GetAnimState():Hide("FX") self.circleframe2:GetAnimState():PlayAnimation("frame") self.sanityarrow = self.underNumber:AddChild(UIAnim()) self.sanityarrow:GetAnimState():SetBank("sanity_arrow") self.sanityarrow:GetAnimState():SetBuild("sanity_arrow") self.sanityarrow:GetAnimState():PlayAnimation("neutral") self.sanityarrow:SetClickable(false) self.ghostanim = self.underNumber:AddChild(UIAnim()) self.ghostanim:GetAnimState():SetBank("status_sanity") self.ghostanim:GetAnimState():SetBuild("status_sanity") self.ghostanim:GetAnimState():PlayAnimation("ghost_deactivate") self.ghostanim:Hide() self.ghostanim:SetClickable(false) self.ghostanim.inst:ListenForEvent("animover", OnGhostDeactivated) In sanitybadge.lua, this is how the different animations are defined. As self.brain is the sanitybadge.lua, you will need to change the bank and build of self.brain.topperanim and self.brain.circleframe2 otherwise you are changing the entire badge and the things that were there prior to it are still there, as you already saw. This is what I mean: self.brain.topperanim:GetAnimState():SetBuild("sanity_robot") self.brain.topperanim:GetAnimState():SetBank("sanity_robot") The same is probably true for hungerbadge and healthbadge 1 Link to comment https://forums.kleientertainment.com/forums/topic/133821-how-do-i-change-an-existing-badges-animations-into-a-different-one/#findComment-1497010 Share on other sites More sharing options...
Stormish Posted September 21, 2021 Author Share Posted September 21, 2021 8 hours ago, Monti18 said: Reveal hidden contents self.topperanim = self.underNumber:AddChild(UIAnim()) self.topperanim:GetAnimState():SetBank("status_meter") self.topperanim:GetAnimState():SetBuild("status_meter") self.topperanim:GetAnimState():PlayAnimation("anim") self.topperanim:GetAnimState():SetMultColour(0, 0, 0, 1) self.topperanim:SetScale(1, -1, 1) self.topperanim:SetClickable(false) self.circleframe:GetAnimState():Hide("frame") self.circleframe2 = self.underNumber:AddChild(UIAnim()) self.circleframe2:GetAnimState():SetBank("status_sanity") self.circleframe2:GetAnimState():SetBuild("status_sanity") self.circleframe2:GetAnimState():OverrideSymbol("frame_circle", "status_meter", "frame_circle") self.circleframe2:GetAnimState():Hide("FX") self.circleframe2:GetAnimState():PlayAnimation("frame") self.sanityarrow = self.underNumber:AddChild(UIAnim()) self.sanityarrow:GetAnimState():SetBank("sanity_arrow") self.sanityarrow:GetAnimState():SetBuild("sanity_arrow") self.sanityarrow:GetAnimState():PlayAnimation("neutral") self.sanityarrow:SetClickable(false) self.ghostanim = self.underNumber:AddChild(UIAnim()) self.ghostanim:GetAnimState():SetBank("status_sanity") self.ghostanim:GetAnimState():SetBuild("status_sanity") self.ghostanim:GetAnimState():PlayAnimation("ghost_deactivate") self.ghostanim:Hide() self.ghostanim:SetClickable(false) self.ghostanim.inst:ListenForEvent("animover", OnGhostDeactivated) In sanitybadge.lua, this is how the different animations are defined. As self.brain is the sanitybadge.lua, you will need to change the bank and build of self.brain.topperanim and self.brain.circleframe2 otherwise you are changing the entire badge and the things that were there prior to it are still there, as you already saw. This is what I mean: self.brain.topperanim:GetAnimState():SetBuild("sanity_robot") self.brain.topperanim:GetAnimState():SetBank("sanity_robot") The same is probably true for hungerbadge and healthbadge I tried this, except that it did not have the animations so I decided to change the anim instead while hiding the rest of the stuff since they seemed unnecessary for the custom badge and somehow it did work Spoiler However, my character has 2 forms, and when he tries to go back to his normal form, the sanity badge loses its orange meter, so it looks a lot weirder now Spoiler This is the new code: Spoiler local function StormishMechMeter(self, inst) if inst and inst.prefab == "stormish" then local function SetMechMeterForStormish(inst) self.brain.anim:GetAnimState():SetBuild("sanity_robot") self.brain.anim:GetAnimState():SetBank("sanity_robot") self.brain.anim:GetAnimState():SetMultColour(1, 1, 1, 1) self.brain.topperanim:Hide() self.brain.circleframe:Hide() self.brain.circleframe2:Hide() end local function SetHumanMeterForStormish(inst) self.brain.anim:GetAnimState():SetBuild("sanity") self.brain.anim:GetAnimState():SetBank("sanity") self.brain.anim:GetAnimState():SetMultColour( 232 / 255, 123 / 255, 15 / 255, 1 ) self.brain.topperanim:Show() self.brain.circleframe:Show() self.brain.circleframe2:Show() end function self:SetStormishHUD(inst) SetMechMeterForStormish(inst) end function self:SetHumanStormishHUD(inst) SetHumanMeterForStormish(inst) end inst.SetHumanStormishHUD = function(inst) self:SetHumanStormishHUD(inst) end inst.SetStormishHUD = function(inst) self:SetStormishHUD(inst) end end end AddClassPostConstruct("widgets/statusdisplays", StormishMechMeter) Link to comment https://forums.kleientertainment.com/forums/topic/133821-how-do-i-change-an-existing-badges-animations-into-a-different-one/#findComment-1497100 Share on other sites More sharing options...
Monti18 Posted September 22, 2021 Share Posted September 22, 2021 local function SetHumanMeterForStormish(inst) self.brain.anim:GetAnimState():SetBuild("status_meter") self.brain.anim:GetAnimState():SetBank("status_meter") self.brain.anim:GetAnimState():SetMultColour( 232 / 255, 123 / 255, 15 / 255, 1 ) self.brain.topperanim:Show() self.brain.circleframe:Show() self.brain.circleframe2:Show() end Try it with status_meter instead of sanity, in badge.lua the anim is defined as status_meter. 1 Link to comment https://forums.kleientertainment.com/forums/topic/133821-how-do-i-change-an-existing-badges-animations-into-a-different-one/#findComment-1497307 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