Jump to content

Getting a custom widget (badge) to show up


Gryffo

Recommended Posts

Hey, so I got a simple mod for wigfrid working (thanks to help from DarkXero) that shows her amount of 'battleborn' to the user through a beaver badge. It's working great so far.

 

Now I want to swap the placeholder beaver badge for a custom one. I would like to do this by editing a copy of the beaver badge. Thus I've created battlebornbadge.lua in a widgets folder inside my mods', and called it in modmain.

--local BattlebornBadge =  _G.require "widgets/beaverbadge"local BattlebornBadge =  _G.require "widgets/battlebornbadge"status.battleborn = status:AddChild( BattlebornBadge( status.owner ) )

But it doesn't show up! Everything seems to be working fine, I just can't see the badge.

 

The contents of battlebornbadge.lua are a pretty barebones version of beaverbadge, but the constructor calls Badge._ctor(self, "battle_meter", owner) instead of beaver_meter. It appears to me I must have messed up something on the battle_meter.zip itself.

 

What might I have missed? I've seen similar problems, but few seem to be widget related. I've changed the zip and build.bin name from 'battleborn_meter' to 'battle_meter' in case it was the number of characters. Also added, in modmain:

Assets = {	Asset( "ANIM", "anim/battle_meter.zip"),}

but it still doesn't do the trick. Is there an additional step I'm not aware of?

 

If I can't get it to work, I guess I'll try loading a bunch of separate .tex and .xml files, but It'd really come in handy to use the beaverbadge's texture structure, as I intend to use this knowledge on future mods, plus it's always nice to do things the 'right way'.

battle_meter.zip

Link to comment
Share on other sites

I ran into the same problem and what you suggest you should do is take a look at those two mods : Link, or Markiplier.

They both add a new widget, fully functional (magic for link, sprint for markiplier). what you can do is take their anim/build file, and replace whatever is in there, like sprint for example, by something with the same amount of letters like you already did. Scrap the code you see which is widget related in modmain, and "init_whatever meter", and you should be good to go I think. Not sure if I am of any help here, maybe you already tried this. Good luck anyway !

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...