Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Displaying Damage easily

SPN

Member

Hey guys, apologies if this has been dealt with before.

I'm currently whipping up an evented CBS, and would like a bit of help. I haven't got around to programming the damage displaying system yet, but I can foresee a few horrible snags if I don't pull it off properly.

The terribly terribly messy way that popped into my head was to actually have a Conditional Branch for every single damage amount possible, and display a combination of number pictures depending on the damage. This would result in literally thousands of Conditional Branches and appropriate picture organizing for this to work. I KNOW that there is an easier way to go about this.

So what I'm looking for is precisely this:

> Set final damage to Variable.
> Show Variable on screen.

The number itself would preferably look like the numbers displayed in the DBS, but over top of a specified event if possible.

In a nutshell:

Display a Variable in a modifiable location like how damage is displayed in the default battle system.

Any help would be greatly appreciated. Sorry if this is in the wrong place, I'm not exactly sure what kind of request I'm looking for...I just want to get this done, haha.

PS: And yes, I am fully aware that this will no longer be an EVENTED battle system if scripting is required :)
 

Zeriab

Sponsor

Manage each digit by itself.
Use % 10 for the first digit.
Use / 10 and % 10 for the next digit
Use / 100 and % 10 for the next digit
....

That will heavily decrease the amount of conditional branches you need to use.

*hugs*
 

SPN

Member

Sorry for the double post, but I just need a quick clarification. If I'm understanding this correctly, the divisions will work for the 10's and the 100's and whatnot, but I'm still not quite sure how to calculate the first digit.

Say, for example, an attack deals 52 damage. I can get the 5 easy enough by dividing, but how would I get the 2?
 

SPN

Member

Ah! I was looking through the Variable operations trying to wrap my head around a way to get it working. Didn't even piece that one together. Thanks a bunch guys, you know where I'll be if I need more help, haha.

R-r-r-resolved!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top