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
PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Sun Oct 18, 2015 9:15 am

Is there any way to make jumping enemies to not jump (like Mouser). I need it for my GFX. I have another topic with more details: http://www.smbxgame.com/forums/v ... 35&t=11930

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sun Oct 18, 2015 12:23 pm

Maybe this helps?

Code: Select all

function onLoop()
    for _, mouser in pairs(NPC.get(262, -1)) do
        if(mouser:mem(0x100, FIELD_DFLOAT) > 100)then
            mouser:mem(0x100, FIELD_DFLOAT, 0)
        end
    end
end

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Mon Oct 19, 2015 9:03 am

I can't download modded SMBX because of Security Problems. What do I do?

Willhart
Banned
Posts: 368
Joined: Thu Apr 10, 2014 2:18 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Willhart » Mon Oct 19, 2015 9:23 am

Mario Maker 200 wrote:I can't download modded SMBX because of Security Problems. What do I do?
Download a copy from here that Includes the complete standalone base game, and has (Vanilia+Launcher) That version should not cause security problems, and you can use it via separate LunaLoader.exe that is included to the installation folder. Edit: Select the full installation at the start to see the other options.

http://engine.wohlnet.ru/LunaLua/

Edit2: You can also have it without the base game, if you own smbx already.

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Mon Oct 19, 2015 11:10 am

Sorry if i'm asking too much questions, but lua codes aren't working for me. :(
I have a folder with graphics what I need and a file named lunadll.lua with code:

Code: Select all

function onLoop()
    for _, mouser in pairs(NPC.get(262, -1)) do
        if(mouser:mem(0x100, FIELD_DFLOAT) > 100)then
            mouser:mem(0x100, FIELD_DFLOAT, 0)
        end
    end
end
Then I have my level. I open it in LunaLoader's Level Editor, but it doesn't work.
What am I doing wrong?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Mon Oct 19, 2015 11:42 am

1.) Start the game and when in the main menu then look on the top right corner if the version number is displayed.
2.) Be sure to have it named "lunadll.lua" and not "lunadll.lua.txt" (it is often an mistake)

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Mon Oct 19, 2015 11:50 am

Mario Maker 200 wrote:Sorry if i'm asking too much questions, but lua codes aren't working for me. :(
I have a folder with graphics what I need and a file named lunadll.lua with code:

Code: Select all

function onLoop()
    for _, mouser in pairs(NPC.get(262, -1)) do
        if(mouser:mem(0x100, FIELD_DFLOAT) > 100)then
            mouser:mem(0x100, FIELD_DFLOAT, 0)
        end
    end
end
Then I have my level. I open it in LunaLoader's Level Editor, but it doesn't work.
What am I doing wrong?
Before I go over the general lua mistakes you made and tell you how to avoid them in the future, I need to tell you that Mouser doesn't use memory offset 0x100. Even if you apply the fixes I present in the following post, it will still only return 0.

First, I'd use some letter like "i", rather than "_". There's no particular reason, it's just the standard and stuff and IDK if _ could cause problems somewhere else.

Second, you're not even creating a table. Catch the mouser NPC in a seperate line of creating the table:

Code: Select all

function onLoop()
    tableOfMouser = NPC.get(262, -1)
    for i = 1, table.getn(tableOfMouser) do
        if(tableOfMouser[i]:mem(0x100, FIELD_WORD) > 100)then
            tableOfMouser[i]:mem(0x100, FIELD_WORD, 0)
        end
    end
end
The next error I see is that it should say FIELD_WORD, not FIELD_DFLOAT. (Citation needed, might be FIELD_DOUBLE or FIELD_FLOAT. The documentary confuses me.)

To call on a single instance of an object caught within a table (rather than the entire table), you use tableOfMouser. If you don't use this, there's no reason to create a table and you won't be able to modify NPCs.

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Mon Oct 19, 2015 1:10 pm

It's still not working.
My problem is that this Bowser (Made by me.) that replaces Mouser should look like this.
Image

But when he jumps, it looks like this...
Image
And that clearly isn't what is post to happen.
So I want a working way to make him not jump. (If I use invisible blocks to block him, he just dies, sad.)

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Mon Oct 19, 2015 1:49 pm

You didn't answer my questions yet:
Kevsoft wrote: 1.) Start the game and when in the main menu then look on the top right corner if the version number is displayed.
2.) Be sure to have it named "lunadll.lua" and not "lunadll.lua.txt" (it is often an mistake)

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Mon Oct 19, 2015 1:51 pm

It was SMBX 1.3.0.1 and LunaLua v0.7.1.1 Beta and file is a LUA-file. Sorry that I didn't awnser.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Mon Oct 19, 2015 2:15 pm

So you did saw this:
Image
right?

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Mon Oct 19, 2015 2:19 pm

Yes, I did.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Mon Oct 19, 2015 2:21 pm

So just for beeing sure, use this code for your lunadll.lua:

Code: Select all

function onLoop()
  Text.print("This text should be displayed!", 100, 100)
end

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Tue Oct 20, 2015 12:30 am

Ok, it doesn't show that (So code is probably right). Maybe it doesn't work in level editor.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Tue Oct 20, 2015 4:55 am

Could you maybe send a screenshot of your level custom folder (where you can see the lunadll.lua)?

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Tue Oct 20, 2015 6:55 am

Here. (I know, confusing language) :lol:
Image

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Tue Oct 20, 2015 7:12 am

I just notice that the Test.lvl is in the custom folder. I expect that this is the level file you are working with. If this is the case, then make a folder called "Test" and move all your custom content (including all gifs and the lunadll.lua) in the "Test"-Folder

PlumberGraduate
Rex
Rex
Posts: 38
Joined: Sat Jun 14, 2014 11:39 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PlumberGraduate » Tue Oct 20, 2015 7:24 am

It works! Thank you! :D

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Voymo » Fri Oct 23, 2015 10:31 am

Heyo, I extra waited with this until the weekend. MECHDRAGON777 has made a fixed graphic of the existent but unused "flying Peach" sprite and requested a LunaLUA code to make Peach have the ability to fly like everyone else, which DarkShadeX made:
DarkShadeX wrote:

Code: Select all

-- SMBX - Peach flying Script by DarkShadeX

-- 0x1C = Princess hover timer
-- 0x16E = Is flying
-- 0xF0 = Player identity index (0 = nothing! don't use, 1 = demo, 2 = iris, 3 = princess, 5 = sheath)
local fly_lenght = 80 -- How long you can fly,adjust it so its perfect for you ;)
local remaining_fly = fly_lenght

function onLoop()

printText("RUNNING "..tostring(remaining_fly).." FRAMES", 30, 60)

-- If you Hover,prevent that you can fly:
if( player:mem(0x1C,FIELD_WORD) >= 1 )then
remaining_fly = 0
end

-- Check if Stuff ... :
if( player:mem(0x1C,FIELD_WORD) == 0 and player.speedY ~= 0 and remaining_fly >= 0 and player:mem(0xF0,FIELD_WORD) == 3 and player.speedX >= 5.55 and player.powerup == PLAYER_LEAF or player.powerup == PLAYER_TANOOKIE)then
player:mem(0x16E,FIELD_WORD,-1) -- LET THE FLY BEGIN :>
remaining_fly = remaining_fly - 0.25 -- Reduce our flying timer.
end
-- Check if Stuff ... LEFT :
if( player:mem(0x1C,FIELD_WORD) == 0 and player.speedY ~= 0 and remaining_fly >= 0 and player:mem(0xF0,FIELD_WORD) == 3 and player.speedX <= -5.55 and player.powerup == PLAYER_LEAF or player.powerup == PLAYER_TANOOKIE)then
player:mem(0x16E,FIELD_WORD,-1) -- LET THE FLY BEGIN :>
remaining_fly = remaining_fly - 0.25 -- Reduce our flying timer.
end
-- End the Flying:
if( remaining_fly <= 1 )then -- If you don't have any flying timer anymore...
player:mem(0x16E,FIELD_WORD,0) -- Stop the Flying.
end

-- Extra Fixes:
if( remaining_fly <= fly_lenght and player:mem(0x16E,FIELD_WORD) == -1 )then -- So the counter doesnt stop if you change the direction ;)
remaining_fly = remaining_fly - 0.25
end
end

function onJumpEnd()
remaining_fly = fly_lenght -- Reset the counter if you fall.
end
Now this works, but the problem is that Peach gains height way too fast, as if she would jump (check http://www.smbxgame.com/forums/v ... 31&t=11877).
I know a possible fix, but I cannot code in LUA, so I would be happy if someone of you could do it.
After running for a while as Peach, the WINGMAN cheat should activate itself. When the flying time is over, it should deactivate itself again.
Afterwards the saving problem should be automatically fixed, I also know how. Redigit is a cool guy, but please, try making it so that you don't hear the Mother Brain cry if that "fix" is applied, if yk what I mean. (shh!) :oops:

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Sun Oct 25, 2015 6:30 am

Bug Report: When you have a level open (in SMBX, not PGE) and insert new graphics into it (or remove some), they won't be updated if you save the level. You have to save the level and then load it instead.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari