LunaLua Offical Thread - SMBX Usermod Framework

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

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?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Fri Nov 20, 2015 10:58 pm

Enjl wrote:The name for the world .lua file is lunaoverworld.lua
Thanks! I've managed to make this with your help:
Spoiler: show
Image
...also, is it possible to fix the fact that the gif recording go way too fast?

PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Sat Nov 21, 2015 3:25 am

Does anyone know how to make a money system sort of like the one Sambo has on his episode?
I'm trying to figure out lunalua, but i really can't understand the commands. Does anyone know how I can implement a
money system?
EDIT:
I'm actually going to try to figure this out myself.
Last edited by PersonNamedUser on Sat Nov 21, 2015 2:04 pm, edited 1 time in total.

Voymo
Hoopster
Hoopster
Posts: 46
Joined: Sat Sep 26, 2015 10:07 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Voymo » Sat Nov 21, 2015 4:45 am

Guys, there is a (new) bug in the 7.2.2 version of SMBX 1.3.0.2 (haven't tested 1.3.0.1). After start, if you load an episode that has custom NPC graphics FIRST, then quitting and load an episode that has the default NPC graphics, the NPC's mask gets messed up (the old custom mask will still be used). However this doesn't happen if you load an episode with default graphics first and THEN another one that has custom graphics.
Not sure if this only applies to NPC custom graphics...

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sat Nov 21, 2015 8:09 am

Voymo wrote:Guys, there is a (new) bug in the 7.2.2 version of SMBX 1.3.0.2 (haven't tested 1.3.0.1). After start, if you load an episode that has custom NPC graphics FIRST, then quitting and load an episode that has the default NPC graphics, the NPC's mask gets messed up (the old custom mask will still be used). However this doesn't happen if you load an episode with default graphics first and THEN another one that has custom graphics.
Not sure if this only applies to NPC custom graphics...
Are you talking about the custom NPC graphics with ".gif" or the new one with ".png"?

Voymo
Hoopster
Hoopster
Posts: 46
Joined: Sat Sep 26, 2015 10:07 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Voymo » Sat Nov 21, 2015 8:33 am

@Kevsoft The one with .gif files.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Nov 21, 2015 11:50 am

lotus006 wrote:I'm really surprised about the progress i've done to my inventory, I started now savedata and it's almost work now for when we collect items it's follow you
over the level :) , just a question how i'm saving onto the folder where is lunaworld instead of the level folder ?

And also I'm stuck again with sprites, I have some question about the size of the addon when he is finished for the user, is it a problem
if the pack will be over 3 or 4 mb the size I mean ? and I try to do concatenate

Code: Select all

local SelMushroom  		= {}
for i=1, 6 do
table.insert(SelMushroom .. i , Graphics.loadImage(resPath .. "\\SelMushroom.png") );
end
it's say i can concatenate a upvalue something like this, or I got an another solution is to duplicate img "\\SelMushroom" .. i .. ".png "
but the size of the addon will grow alot with this :(

Any solutions ?

I'm desesperate with loop and local variable of image :( nothing work because uservalue

Thanks in advance.
Ok I think I start to understand why no one have already made the inventory mode, is already started in the lunalua LuaScriptsLib folder but not yet finished
I think is not possible to make the original one because there is no possible way to make more than 1 same sprites without make a copy of the png when
is loaded in the game the same png will not appear until you make a copy of a copy of the png, I hope in the next Lunalua this bug will be corrected.

I will take a break now because I think is impossbile to make the inventory mode for now. :(

PS.: Is there a reason why smb3inventory is in the folder but not working. ?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Sat Nov 21, 2015 11:58 am

lotus006 wrote:because there is no possible way to make more than 1 same sprites without make a copy of the png when
is loaded in the game the same png will not appear until you make a copy of a copy of the png, I hope in the next Lunalua this bug will be corrected.

I will take a break now because I think is impossbile to make the inventory mode for now. :(
sprite = Graphics.loadImage("sprite.png)

function onLoop()
Graphics.drawImage(sprite, 0, 0)
Graphics.drawImage(sprite, 32, 0)
Graphics.drawImage(sprite, 64, 0)
Graphics.drawImage(sprite, 96, 0)
end

Just a simple example of how to draw the same image multiple times.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Nov 21, 2015 2:54 pm

Enjl wrote:
lotus006 wrote:because there is no possible way to make more than 1 same sprites without make a copy of the png when
is loaded in the game the same png will not appear until you make a copy of a copy of the png, I hope in the next Lunalua this bug will be corrected.

I will take a break now because I think is impossbile to make the inventory mode for now. :(
sprite = Graphics.loadImage("sprite.png)

function onLoop()
Graphics.drawImage(sprite, 0, 0)
Graphics.drawImage(sprite, 32, 0)
Graphics.drawImage(sprite, 64, 0)
Graphics.drawImage(sprite, 96, 0)
end

Just a simple example of how to draw the same image multiple times.
Thanks for this, but in this case it should work but I test on my stuff and isnt should work because
I use unplaceSprites also and is remove the last one because of this :(

like this -->

Code: Select all

Graphics.unplaceSprites(inv2);
Graphics.placeSprite(1,inv2,   160  , 518   );
This is how I use this for moving graphic :)
or maybe I can try I just have an idea but i dont know why before I tested without unplacesprites and I make it so laging because its placing indefinitely the sprites on the loops but now is not laging weird ?
I will test to make it when is not moving do not use function unplacesprites with If then else.

Edit :

I tried again without Unplacesprites but after 30 sec the game start to lag because the sprite is never stop to be added on the loop
but with Unplacesprites there is no problem if I leave it loaded even after 30 sec

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sat Nov 21, 2015 7:16 pm

Why not find a way to make it work with Graphics.drawImage?

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Nov 21, 2015 7:32 pm

HenryRichard wrote:Why not find a way to make it work with Graphics.drawImage?
what is the difference ?

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sat Nov 21, 2015 7:49 pm

lotus006 wrote:
HenryRichard wrote:Why not find a way to make it work with Graphics.drawImage?
what is the difference ?
Graphics.drawImage draws the image for only one frame - it's gone the next one.
Graphics.placeSprite makes the image drawn until it's removed with Graphics.unplaceSprite.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Nov 21, 2015 7:52 pm

HenryRichard wrote:
lotus006 wrote:
HenryRichard wrote:Why not find a way to make it work with Graphics.drawImage?
what is the difference ?
Graphics.drawImage draws the image for only one frame - it's gone the next one.
Graphics.placeSprite makes the image drawn until it's removed with Graphics.unplaceSprite.
Even if is in the loop section ?
And I can alway make moving with Graphics.drawImage ?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Sat Nov 21, 2015 7:55 pm

lotus006 wrote: Even if is in the loop section ?
And I can alway make moving with Graphics.drawImage ?
I mean you can make dynamic x and y values depending on how many items are already in your inventory. Since drawImage is only shown for one frame, it's even easier "move" it than placeSprite (though I never used placeSprite so whatever)

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Nov 21, 2015 8:12 pm

Enjl wrote:
lotus006 wrote: Even if is in the loop section ?
And I can alway make moving with Graphics.drawImage ?
I mean you can make dynamic x and y values depending on how many items are already in your inventory. Since drawImage is only shown for one frame, it's even easier "move" it than placeSprite (though I never used placeSprite so whatever)
Oh I didnt know about this one i was thinking it's just an older code from older version, thanks I will try soon :)

Edit :
oh it's work without lagging, sorry guy's I'm feeling so embarrassed :S

I love so much Lua , and I have alot of Idea what to do now I can do everything with this toy and music in background meh !! :) haha thanks guy again :)

Next stuff maybe, I will try to implant Zelda 2 power menu or shop stuff with points (everyone know in Mario Points is useless then now it will be :D )

Edit2 :
But how I remove now Graphics.drawImage instead of Graphics.unplaceSprites ? is it the same thing ?

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sat Nov 21, 2015 10:16 pm

HenryRichard wrote:Graphics.drawImage draws the image for only one frame - it's gone the next one.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Nov 22, 2015 2:12 am

Thanks I'm stupid sometimes sorry again :)

I have almost a beta release for the inventory mode, it work pretty good as I expecting
I hate so much placesprites lolll

before I release it i need to fix some sprites align it and make it with a stock i mean amount of the items when
you take the items will have -1 each times like in the normal game :D
and more than 1 row also maybe 4, and make it 2 mode smb4 advance and snes mode :)

there is a preview in video :)
thanks guy for your help :D
Edit: Oh and maybe an extra I will try to recreate the Warp Whistle and the world map :)
+ yoshi egg and hand items who will work only in game not on world in the future :D


PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Mon Nov 23, 2015 3:35 am

Could someone help me to implement the money system? I'm putting in this code:

Code: Select all

function Onload()
raocoin = loadSharedAPI("raocoin2");
coins = raocoin.registerCurrency(10, true, 472, 66);
coins = raocoin.registerCurrency(33, true, 472, 66);
coins = raocoin.registerCurrency(88, true, 472, 66);
coins = raocoin.registerCurrency(133, true, 472, 66);
coins = raocoin.registerCurrency(152, true, 472, 66);
coins = raocoin.registerCurrency(251, true, 472, 66);
coins = raocoin.registerCurrency(252, true, 472, 66);
coins = raocoin.registerCurrency(253, true, 472, 66);
coins = raocoin.registerCurrency(258, true, 472, 66);
coins = raocoin.registerMemCurrency(0x00B2C5A8,FIELD_WORD,true,false);
end

function Onloop()
Currency:onCollect(1, 10) if not
    then elseif
     Currency:onCollect(1, 33) if not
     then elseif
         Currency:onCollect(1, 88) if not
         then elseif
             Currency:onCollect(1, 133) if not
             then elseif
             Currency:onCollect(1, 152) if not
             then elseif
             Currency:onCollect(1, 251) if not
             then elseif
             Currency:onCollect(5, 252) if not
             then elseif
             Currency:onCollect(20, 253) if not
             then elseif
             Currency:onCollect(5, 258) if not
             if not
	      end
	   end
    end
end
And It won't work. I need help to figure this out.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Tue Nov 24, 2015 4:43 pm

I have a VERY HARD TIME believing that "if not then elseif" is a legitimate line.

Also, load APIs outside of any functions.
Also, you're setting the value "coins" repeatedly. What you're essentially doing in onLoad is overwriting a bunch of stuff. Only the last time you define "coins" will actually be relevant, because it's the one up to date. It's like defining:
Hello = 1
Hello = 2
Hello = 1
Hello = 2
Hello = 5
while you could just write
Hello = 5
which would give the same result.

XerX
Phanto
Phanto
Posts: 1487
Joined: Fri Dec 20, 2013 3:33 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby XerX » Tue Nov 24, 2015 10:19 pm

lotus006 wrote:Thanks I'm stupid sometimes sorry again :)

I have almost a beta release for the inventory mode, it work pretty good as I expecting
I hate so much placesprites lolll

before I release it i need to fix some sprites align it and make it with a stock i mean amount of the items when
you take the items will have -1 each times like in the normal game :D
and more than 1 row also maybe 4, and make it 2 mode smb4 advance and snes mode :)

there is a preview in video :)
thanks guy for your help :D
Edit: Oh and maybe an extra I will try to recreate the Warp Whistle and the world map :)
+ yoshi egg and hand items who will work only in game not on world in the future :D


That's pretty neat. I was working on something similar myself to go with the Overhaul mod, but never got around to finishing it. Maybe I should finish it just for the heck of it.
Image

PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Wed Nov 25, 2015 12:13 am

How do you put the path to your image in the lunalua code? I think i'm very close to making the money system


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari