Page 1 of 1

LunaLUA: How to add item box to a custom HUD

Posted: Sat Jan 03, 2015 7:38 pm
by Sambo
I have created a complete re-code of the item reserve box with LunaLUA:
Spoiler: show
128-nodither.gif
Using it is simple; just download the files and place them in your level's folder. Or if you want it for your whole episode, rename lunadll.lua to lunaworld.lua and place them in the episode folder instead.
Be careful not to overwrite your existing lunadll files. If you have lunadll.lua already, just add this to the onLoop function:

Code: Select all

	if reserve ~= player:mem(0x158, FIELD_WORD) then
		reserve = player:mem(0x158, FIELD_WORD)
		if reserve == 0 then
			loadImage("NONE", 5, 0xdc00ff)
		elseif reserve == 184 then
			loadImage("../HUD/smb_shroom.bmp", 5, 0xdc00ff)
		elseif reserve == 182 then
			loadImage("../HUD/smb_flower.bmp", 5, 0xdc00ff)
		elseif reserve == 9 then
			loadImage("../HUD/smb3_shroom.bmp", 5, 0xdc00ff)
		elseif reserve == 14 then
			loadImage("../HUD/smb3_flower.bmp", 5, 0xdc00ff)
		elseif reserve == 34 then
			loadImage("../HUD/leaf.bmp", 5, 0xdc00ff)
		elseif reserve == 264 then
			loadImage("../HUD/smb3_iceflower.bmp", 5, 0xdc00ff)
		elseif reserve == 169 then
			loadImage("../HUD/tanooki_suit.bmp", 5, 0xdc00ff)
		elseif reserve == 170 then
			loadImage("../HUD/hammer_suit.bmp", 5, 0xdc00ff)
		elseif reserve == 248 then
			loadImage("../HUD/stopwatch.bmp", 5, 0xdc00ff)
		elseif reserve == 185 then
			loadImage("../HUD/smw_shroom.bmp", 5, 0xdc00ff)
		elseif reserve == 183 then
			loadImage("../HUD/smw_flower.bmp", 5, 0xdc00ff)
		elseif reserve == 277 then
			loadImage("../HUD/smw_iceflower.bmp", 5, 0xdc00ff)
		end
		placeSprite(1, 5, 384, 30)
	end
Don't forget to include 'end' at the end of your functions.
NOTE: The custom HUD shown is not included.

Re: LunaLUA: How to add item box to a custom HUD

Posted: Sun Jan 04, 2015 7:28 am
by DarkShadeX
Good job,i also wanted to do this but i was to lazy : P
I gonna use this for SMW -DIDL- so thank you.

Re: LunaLUA: How to add item box to a custom HUD

Posted: Tue Jan 06, 2015 8:42 pm
by Sambo
You can remove the "local reserve" part of the code because it doesn't do anything and isn't necessary.

Re: LunaLUA: How to add item box to a custom HUD

Posted: Wed Jan 07, 2015 1:13 am
by XerX
So what does this do exactly?

Re: LunaLUA: How to add item box to a custom HUD

Posted: Wed Jan 07, 2015 1:27 am
by SilverDeoxys563
If you can recreate the item box graphics, does this mean that you can basically recreate all the graphics used in the HUD without having to modify an EXE? Including the fonts?

Re: LunaLUA: How to add item box to a custom HUD

Posted: Wed Jan 07, 2015 11:38 am
by DarkShadeX
You can draw a string/text using lunalua but it uses the original fonts.

Re: LunaLUA: How to add item box to a custom HUD

Posted: Mon Jan 12, 2015 10:18 pm
by HenryRichard
DarkShadeX wrote:You can draw a string/text using lunalua but it uses the original fonts.
Though you could make a function to display custom numerals (saved individually as .bmps) based on an integer...