Jump to content

Invisible Custom Badge


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?

battle_meter.zip

Edited by Gryffo
Link to comment
Share on other sites

Could you provide a bigger piece of code? Because what is this famous "status" here?

 

Hello ZupaleX, I'm a fan of your mods :-)

 

Yes, I can in fact provide you with the whole mod. It's a simple one that aims to make Wigfrid a little more fun for me and my fellows while helping me understand modding better.

 

Please note since posting this message I decided to do things 'the dirty way' and got it to work by adding a bunch of childs to the badge and loading various Image assets (.tex's and .xml's ) to them. I am still interested, though, in learning how to do it the way I feel blends best with the official approach (having the game understand my Anim folder's .zip with anim and build and atlas files).

 

I should mention the file is a renamed .rar, instead of a proper .zip. Hope that doesn't ruin anyone's day.

Wigfrid Tweaks.zip

Link to comment
Share on other sites

You should have left it as a rar because windows refuses to open the .zip actually. Anyway, I extracted it by renaming it to .rar again :razz:

I check this a come back to you if I have anything interesting to say.

 

EDIT: I am not sure I understand your issue. The badge shows up for me.

 

EDIT2: ok forget what I said I read your previous post properly and understand what you want now. You have the exported folder somewhere?

Edited by ZupaleX
Link to comment
Share on other sites

Soooo, I commented out all the stuffs related to your dirty "fix" with images, put back the ANIM as an asset only, modify something and :

 

http://prntscr.com/8ej8eu

 

I just modify one single stuff. Here are the hints for you :

 

in beaverbadge.lua

    Badge._ctor(self, "beaver_meter", owner)

Then in badge.lua

    local Badge = Class(Widget, function(self, anim, owner)    ........    self.anim:GetAnimState():SetBank(anim)    self.anim:GetAnimState():SetBuild(anim)    self.anim:GetAnimState():PlayAnimation("anim")

Now look into your scml file.

:snarlingspider:(<- That's me after seeing what you did)

 

PS : just kidding :-)

 

Edited by ZupaleX
Link to comment
Share on other sites

How did you create the zipfile btl_meter.zip?

Didn't you use spriter? If not then I understand everything.

 

I explain :

I used krane to decompile the anim.bin and build.bin from your ctl_meter.zip to see what was inside.

I noticed that the file contains one build which is called "beaver_meter"

This build contains one anim called "anim".

 

The issue is that the constructor of the badge takes as an argument a name. You put "btl_meter" because that's how your file is called. Unfortunatly you cannot do it like that. Because then look in the constructor : this name is called to set the build (ok the build is called btl_meter, it's the name of the file), but also the bank! And here is the issue, the bank is called "beaver_meter" so the game doesn't find it so you get nothing. You have to name the bank "btl_meter" as well.

Now, I guess you just took the beaver_meter.zip, extracted it, modified the .tex and thought that you'll be done with it. NOPE.

 

Just create a new spriter file and name everything properly, it will be much better.

Otherwise do what I did. Decompile your anim.bin and build.bin with krane, rename the "beaver_meter" by "btl_meter" in the scml file you get as an output, launch the game (it will recompile the file) and enjoy.

 

I hope it is not too confused what I said?

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