Thomas Die Posted January 4, 2021 Share Posted January 4, 2021 How to make Custom Badges For Health/maybe othersThe Code To Do This: Spoiler Assets = {Asset("ANIM", "anim/custom_meter.zip")} local function CustomHealthBar(class) if GLOBAL.ThePlayer.prefab == "Your_Prefab_Name" then if class.heart.circleframe then class.heart.circleframe:GetAnimState():OverrideSymbol("icon", "anim_build", "icon") class.heart.anim:GetAnimState():SetMultColour( 1, 1, 1, 1 )--default white: works in RGB class.heart.backing:GetAnimState():SetMultColour( 1, 1, 1, 1 )--default white: works in RGB else print("bruh") end end end AddClassPostConstruct("widgets/statusdisplays", CustomHealthBar) --for hunger instead of heart do stomach --for sanity instead of heart do brain --these two should wokr the same but eh class.heart.backing is the the very back of the badge class.heart.anim is the colour of the meter itself this goes in your modmainThe Assets To Do This:custom_meter.rarLittle Showcase: 1 2 Link to comment Share on other sites More sharing options...
Hornete Posted January 5, 2021 Share Posted January 5, 2021 epic. @thomas4846 maybe put this in the Tutorials and Guides subforum? Link to comment Share on other sites More sharing options...
Thomas Die Posted January 5, 2021 Author Share Posted January 5, 2021 thanks also how Link to comment Share on other sites More sharing options...
Hornete Posted January 5, 2021 Share Posted January 5, 2021 20 minutes ago, thomas4846 said: thanks also how report your own post as wrong section I think 1 Link to comment Share on other sites More sharing options...
Thomas Die Posted January 5, 2021 Author Share Posted January 5, 2021 dun thnx Link to comment Share on other sites More sharing options...
Marmalade Posted June 6, 2021 Share Posted June 6, 2021 The health icon won't appear for the badge. Is there a way to fix that? Link to comment Share on other sites More sharing options...
Thomas Die Posted June 6, 2021 Author Share Posted June 6, 2021 18 hours ago, Welx said: The health icon won't appear for the badge. Is there a way to fix that? can you send me the code or the file?Off the top of my head i can say that it could be: > Spriter build name wasn't changed > class.heart.circleframe:GetAnimState():OverrideSymbol("icon", "anim_build", "icon"): The anim_build wasn't changed > my code sucks 1 Link to comment Share on other sites More sharing options...
Marmalade Posted June 7, 2021 Share Posted June 7, 2021 13 hours ago, thomas4846 said: can you send me the code or the file?Off the top of my head i can say that it could be: > Spriter build name wasn't changed > class.heart.circleframe:GetAnimState():OverrideSymbol("icon", "anim_build", "icon"): The anim_build wasn't changed > my code sucks Big dumbo move on my part I changed my Spriter build name but forgot to change the anim_build to the build name, lol I changed that and now it works. Thanks for pointing that out! 1 Link to comment Share on other sites More sharing options...
Garamonde Posted June 10, 2021 Share Posted June 10, 2021 Shot in the dark, but is there any way this widget could be modified to not be tied to health? I made a thread here about it but have not gotten a single reply aside from myself. Here's my entire mod so that one can see if everything's organized correctly and see how all my files are coded, things are named properly, etc. Thanks in advance! Garamonde.rar Link to comment Share on other sites More sharing options...
Thomas Die Posted June 10, 2021 Author Share Posted June 10, 2021 2 hours ago, Garamonde said: I'll give a brief explanation what i know: P.S i use to use other people's code it doesn't work that wellYou're trying to make a new meter so you'll need to know how the widgets and net-vars work: All of the meters are compiled inside of scripts\widgets\statusdisplay so to access and import you should use: (statusdisplays is where all the icons/huds reside) AddClassPostConstruct("widgets/statusdisplays", function (self) --code end) The cool people at klei have decided to make another widget called badge to simplify the process for creating the widget to importing some data,you can use my assets as a template for your icons This is somethings just to make the code more manageable throughout coding it first: and below is the code used to create the badge\meter. local require = GLOBAL.require local Badge = require "widgets/badge" local UIAnim = require "widgets/uianim" local Text = require "widgets/text" --this is so that the code uses the in items in widgets for us to use AddClassPostConstruct("widgets/statusdisplays", function (self) --local Badge = Class(Widget, function(self, anim, owner, tint, iconbuild, circular_meter, use_clear_bg) self.custom_meter = self:AddChild(Badge(nil, self.owner, { 1, 1, 1, 1 }, "iconbuild")) self.custom_meter:SetClickable(true) self.custom_meter:SetPosition(x, y, z) --position could be anything but i use x, y, z = 0, -85, 0 end) to import data is to use netvars personally i use something more simpler but that's for you to figure out. some of the code from my tutorial can be used for reference in regard to some of the things here, sorry but anything more is gonna drain me good luck on your code. 1 Link to comment Share on other sites More sharing options...
ScrewdriverLad Posted January 6, 2022 Share Posted January 6, 2022 On 1/4/2021 at 4:20 PM, Thomas Die said: How to make Custom Badges For Health/maybe others The Code To Do This: Reveal hidden contents Assets = {Asset("ANIM", "anim/custom_meter.zip")} local function CustomHealthBar(class) if GLOBAL.ThePlayer.prefab == "Your_Prefab_Name" then if class.heart.circleframe then class.heart.circleframe:GetAnimState():OverrideSymbol("icon", "anim_build", "icon") class.heart.anim:GetAnimState():SetMultColour( 1, 1, 1, 1 )--default white: works in RGB class.heart.backing:GetAnimState():SetMultColour( 1, 1, 1, 1 )--default white: works in RGB else print("bruh") end end end AddClassPostConstruct("widgets/statusdisplays", CustomHealthBar) --for hunger instead of heart do stomach --for sanity instead of heart do brain --these two should wokr the same but eh class.heart.backing is the the very back of the badge class.heart.anim is the colour of the meter itself this goes in your modmain The Assets To Do This: custom_meter.rar 82.14 kB · 15 downloads Little Showcase: Will this just change the HP meter, or will it be able to add a new meter, like Time or Might? Link to comment Share on other sites More sharing options...
Wonderlarr Posted January 6, 2022 Share Posted January 6, 2022 49 minutes ago, ScrewdriverLad said: Will this just change the HP meter, or will it be able to add a new meter, like Time or Might? Just the health meter. Time is also just a replaced health meter like this. If you want to make another meter for your mod, I'd suggest look into Wigfrid's inspiration meter or the new Might meter for guidance. Link to comment Share on other sites More sharing options...
ScrewdriverLad Posted January 6, 2022 Share Posted January 6, 2022 2 minutes ago, TheSkylarr said: Just the health meter. Time is also just a replaced health meter like this. If you want to make another meter for your mod, I'd suggest look into Wigfrid's inspiration meter or the new Might meter for guidance. Alright, that was my plan. Thank you very much for the quick reply! 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