Jump to content

In desperate need to fix custom badge. Won't show characters proper values. DEADLINE Dec, 24th


Recommended Posts

Hi after struggling for some time, I'm at my wits end and have little to no time left until my mod's release deadline on the 24th. I cannot delay it any longer as the mod was supposed to release in July with months and delay after delay. And I have so much other things I need to prep and create for it before deadline.

With further a do. My mod has an entire new mechanic in the form of radiation affliction, which was created mostly by Asura but tweaked with additional stuff by me in the most ungraceful way. He's busy atm with irl stuff so I have to modify a lot and script on my own.

All characters have their own set radiation sickness value similar to health, hunger, and sanity in TUNING.

But the badge is stuck at a set max of 100 no matter what I change it to. I could change the max to 69, the characters own values in TUNING using TUNING.CHARACTERS_RADIATION[string.upper(inst.prefab)] and it'll still be stuck at 100 which will probably result in many many character deaths and lots of Wilson blood on my hands come Sunday, unless I hide the badge widget and let the visual cues give off hints.

But this won't help with testing purposes, and making new gear in the future that may activate the badge for players to see later down the line.

Now the badge does move up and down when a character is afflicted and it functions as it should, and visually halts when appropriate gear is worn via penalty to prevent the affliction from going higher. But it just doesn't account visually for any of the characters set values. Nor does it show any of the numbers on the badge. I only know it's stuck at 100 because I artificially increased characters radiation values to godly means and made them stand in an affected area.

I'm also trying to attempt to hide the badge whenever the rad count is 0, but since the badge max values for characters is more broke than me financially when I was attending Uni, I cannot get the thing to hide or reappear. Even referenced the moisture meter before just scrapping code.

 

Code for the badge is here

radiationbadge.lua

 

Link to comment
Share on other sites

Looking at your badge code, I noticed you're doing this in your SetPercent function:

Badge.SetPercent(self, self.val, self.max)

I believe the second argument is supposed to take in a percentage, not a direct value. Since it's expecting a value between 0-1, if you put 20 in there for example, it's going to display the max value no matter what. So you'd want to do something like this:

Badge.SetPercent(self, self.val / self.max, self.max)

If that still doesn't fix it, you may not be calling the SetPercent() function to change the badge values at all when they need to (I'm not seeing a call to it anywhere in your script) though you may be doing that elsewhere. I hope that helps.

  • Health 1
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...