Page 17 of 47

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Oct 18, 2015 9:15 am
by PlumberGraduate
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Oct 18, 2015 12:23 pm
by Kevsoft
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 9:03 am
by PlumberGraduate
I can't download modded SMBX because of Security Problems. What do I do?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 9:23 am
by Willhart
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 11:10 am
by PlumberGraduate
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?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 11:42 am
by Kevsoft
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)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 11:50 am
by Emral
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 1:10 pm
by PlumberGraduate
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.)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 1:49 pm
by Kevsoft
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)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 1:51 pm
by PlumberGraduate
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 2:15 pm
by Kevsoft
So you did saw this:
Image
right?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 2:19 pm
by PlumberGraduate
Yes, I did.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Oct 19, 2015 2:21 pm
by Kevsoft
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Oct 20, 2015 12:30 am
by PlumberGraduate
Ok, it doesn't show that (So code is probably right). Maybe it doesn't work in level editor.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Oct 20, 2015 4:55 am
by Kevsoft
Could you maybe send a screenshot of your level custom folder (where you can see the lunadll.lua)?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Oct 20, 2015 6:55 am
by PlumberGraduate
Here. (I know, confusing language) :lol:
Image

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Oct 20, 2015 7:12 am
by Kevsoft
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Oct 20, 2015 7:24 am
by PlumberGraduate
It works! Thank you! :D

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Fri Oct 23, 2015 10:31 am
by Voymo
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:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Oct 25, 2015 6:30 am
by Emral
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.