How to make and customize boss hp bar?

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Rakalborn
Shy Guy
Shy Guy
Posts: 8
Joined: Sun Dec 25, 2016 12:50 pm

How to make and customize boss hp bar?

Postby Rakalborn » Sat Sep 29, 2018 1:54 pm

Sorry, i am noob at luna, but i want to make hp bar for bowser in my project.Image

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Sun Oct 14, 2018 10:40 pm

I have no idea. Just here because this had no posts and it would seem nobody cares. I care, but I don't know how. If somebody told you how, we could all learn how then it would be a nice Luna feature.

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: How to make and customize boss hp bar?

Postby PixelPest » Sun Oct 14, 2018 10:57 pm

ThePieSkyHigh wrote:
Sun Oct 14, 2018 10:40 pm
I have no idea. Just here because this had no posts and it would seem nobody cares. I care, but I don't know how. If somebody told you how, we could all learn how then it would be a nice Luna feature.
Please don't respond to help topics if you don't actually have an answer--it's a little pointless

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Mon Oct 15, 2018 4:00 pm

Sorry about that. It would really be nice though!

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: How to make and customize boss hp bar?

Postby MECHDRAGON777 » Wed Oct 17, 2018 2:31 am

I would be able to help make it, but I need to know the following info:
  • Graphics in .png format.
  • Location in either X,Y of the setup, or the general area.
  • Event to start the fight.
...but if I do it, I would need to suggest make the boss in question start with an event to trigger the showing of it.

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Mon Nov 05, 2018 11:28 am

WAIT!

I had an idea!

If you make custom graphics, you should make the same amount as bowser's health depending on what your hitting him with. (e.g. 3 plants can kill him)

Later, make the graphics replace a BGO, and with an event make it disappear and make the next health bar appear. (the one with less life drawn in it!)

Idk if I explained well, I don't think I did. Maybe it could work with custom graphic for lakatu, that floats around and kinda follows you so the bar won't stay in one place like a BGO..

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: How to make and customize boss hp bar?

Postby Hoeloe » Mon Nov 05, 2018 12:10 pm

That's an extremely convoluted and inefficient way to do it. Drawing the bar with LunaLua is a substantially easier and more effective method.

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Mon Nov 05, 2018 12:22 pm

It's pretty simple if you ask me.

Added in 37 seconds:
without the lakatu, mind you.

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: How to make and customize boss hp bar?

Postby Hoeloe » Mon Nov 05, 2018 12:53 pm

It's far, far simpler to just use Lua. Really it is.

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Mon Nov 05, 2018 1:20 pm

Oh. Well in that case can you script it?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9722
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: How to make and customize boss hp bar?

Postby Emral » Mon Nov 05, 2018 1:33 pm

ThePieSkyHigh wrote:
Mon Nov 05, 2018 1:20 pm
Oh. Well in that case can you script it?
Mechdragon already offered up his help in scripting it further up in this topic.

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: How to make and customize boss hp bar?

Postby MECHDRAGON777 » Wed Nov 07, 2018 2:27 am

Image
I think I should at least post some of my work (Quick Mach-up) to show a basis. (This is just a basic Health Bar using two graphics, and about 18 lines of code. I did not account for the death of Bowser in the code, but I am assuming this is similar to what you are asking for?

ThePieSkyHigh
Eerie
Eerie
Posts: 755
Joined: Fri Jun 15, 2018 3:03 pm
Flair: eat trash, die fast

Re: How to make and customize boss hp bar?

Postby ThePieSkyHigh » Wed Nov 07, 2018 9:31 am

Looks really good!

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: How to make and customize boss hp bar?

Postby Hoeloe » Wed Nov 07, 2018 9:36 am

MECHDRAGON777 wrote:
Wed Nov 07, 2018 2:27 am
I think I should at least post some of my work (Quick Mach-up) to show a basis. (This is just a basic Health Bar using two graphics, and about 18 lines of code. I did not account for the death of Bowser in the code, but I am assuming this is similar to what you are asking for?
Worth remembering that imagic exists and has a built-in function for drawing bars like that. Really this kind of health bar is ridiculously easy to make, only requiring 3 lines of code or so.

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: How to make and customize boss hp bar?

Postby MECHDRAGON777 » Wed Nov 07, 2018 10:30 am

Image
Although I should look into imagic a bit more than I already have, I can see my if-then statement on line 9 and 11 is not needed to just leave line 10, and the debug text on line 17 is also not needed. I also can replace the table "Bowser" with just "86" and also remove all spaces making it 6 lines less of code. I am sure the graphics would still be loaded with imagic and last time I looked into imagic, it takes around the same amount of code as glDraw. Then again, you are the expert here. (I also agree about Health being easy to display.)

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: How to make and customize boss hp bar?

Postby Hoeloe » Wed Nov 07, 2018 10:39 am

MECHDRAGON777 wrote:
Wed Nov 07, 2018 10:30 am
Although I should look into imagic a bit more than I already have, I can see my if-then statement on line 9 and 11 is not needed to just leave line 10, and the debug text on line 17 is also not needed. I also can replace the table "Bowser" with just "86" and also remove all spaces making it 6 lines less of code. I am sure the graphics would still be loaded with imagic and last time I looked into imagic, it takes around the same amount of code as glDraw. Then again, you are the expert here. (I also agree about Health being easy to display.)
You should be using ipairs instead of pairs too.

And drawing health the way you've done it is grossly inefficient. The imagic method uses the imagic.Bar function, which just does pretty much all of it for you. All you have to do is feed in a number between 0 and 1, and it'll draw the bar correctly. Yes you have to feed in images if you want textures, but if you just want flat colours then you don't.

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: How to make and customize boss hp bar?

Postby PixelPest » Wed Nov 07, 2018 10:43 am

MECHDRAGON777 wrote:
Wed Nov 07, 2018 10:30 am
Image
Although I should look into imagic a bit more than I already have, I can see my if-then statement on line 9 and 11 is not needed to just leave line 10, and the debug text on line 17 is also not needed. I also can replace the table "Bowser" with just "86" and also remove all spaces making it 6 lines less of code. I am sure the graphics would still be loaded with imagic and last time I looked into imagic, it takes around the same amount of code as glDraw. Then again, you are the expert here. (I also agree about Health being easy to display.)
This code in itself is really not good. Mix of global and properly-scoped variables, inconsistent variable naming, no reason to have 86 in a table (as you can just do NPC.get(id)). Also again definitely need to look into imagic. However you don't load images with imagic, just use imagic.Bar

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9722
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: How to make and customize boss hp bar?

Postby Emral » Wed Nov 07, 2018 12:10 pm

Use this thing which we refuse to provide any documentation to in this topic!

imagic.bar{named arguments}

Available args:
x: x-coordinate
y: y-coordinate
width: width
height: height
percent: filled portion of bar (between 0 and 1, optional)
texture: the texture (optional)
align: alignment relative to pivot coordinate (default: ALIGN_TOPLEFT)
baralign: how the bar itself should be aligned, determines how the bar fills (default: ALIGN_BOTTOMLEFT)
bgwidth: width of the bar background (default: 2 pixels more than the bar itself)
bgheight: height of the bar background (default: 2 pixels more than the bar itself)
scene: whether you're drawing the bar to scene or screen coords (defaults to false)
color: color tint. if no texture is supplied, this defaults to green (else white)
bgtexture: texture for bar background (optional)
priority: render priority (optional)
outline: whether to draw an outline or not (defaults to false)
outlinecolor: color tint for outline, defaults to white

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: How to make and customize boss hp bar?

Postby MECHDRAGON777 » Wed Nov 07, 2018 1:08 pm

I was also unable to find documentation on the Wiki for lua. Thanks Enjl.

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: How to make and customize boss hp bar?

Postby Hoeloe » Wed Nov 07, 2018 5:06 pm

Enjl wrote:
Wed Nov 07, 2018 12:10 pm
Use this thing which we refuse to provide any documentation to in this topic!
Apologies I keep forgetting imagic doesn't have documentation available outside its source file.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari