Page 22 of 47

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Fri Nov 20, 2015 10:58 pm
by HenryRichard
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?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 3:25 am
by PersonNamedUser
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 4:45 am
by Voymo
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...

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 8:09 am
by Kevsoft
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"?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 8:33 am
by Voymo
@Kevsoft The one with .gif files.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 11:50 am
by lotus006
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. ?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 11:58 am
by Emral
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 2:54 pm
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 7:16 pm
by HenryRichard
Why not find a way to make it work with Graphics.drawImage?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 7:32 pm
by lotus006
HenryRichard wrote:Why not find a way to make it work with Graphics.drawImage?
what is the difference ?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 7:49 pm
by HenryRichard
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 7:52 pm
by lotus006
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 ?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 7:55 pm
by Emral
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)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 8:12 pm
by lotus006
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 ?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Nov 21, 2015 10:16 pm
by HenryRichard
HenryRichard wrote:Graphics.drawImage draws the image for only one frame - it's gone the next one.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Nov 22, 2015 2:12 am
by lotus006
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


Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Nov 23, 2015 3:35 am
by PersonNamedUser
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Nov 24, 2015 4:43 pm
by Emral
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Nov 24, 2015 10:19 pm
by XerX
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Wed Nov 25, 2015 12:13 am
by PersonNamedUser
How do you put the path to your image in the lunalua code? I think i'm very close to making the money system