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
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 » Wed Dec 23, 2015 3:06 pm

Just replace a goomba or something. The hiding part of boos is unchangable to my knowledge.

FanofSMBX
Ludwig von Koopa
Ludwig von Koopa
Posts: 3878
Joined: Sun Dec 22, 2013 12:01 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby FanofSMBX » Wed Dec 23, 2015 3:12 pm

Enjl wrote:Just replace a goomba or something. The hiding part of boos is unchangable to my knowledge.
Can't you set it to always be in one AI phase?

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 » Wed Dec 23, 2015 3:18 pm

FanofSMBX wrote:
Enjl wrote:Just replace a goomba or something. The hiding part of boos is unchangable to my knowledge.
Can't you set it to always be in one AI phase?
Not with boos. I tried.

FanofSMBX
Ludwig von Koopa
Ludwig von Koopa
Posts: 3878
Joined: Sun Dec 22, 2013 12:01 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby FanofSMBX » Wed Dec 23, 2015 3:24 pm

Enjl wrote:
FanofSMBX wrote:
Enjl wrote:Just replace a goomba or something. The hiding part of boos is unchangable to my knowledge.
Can't you set it to always be in one AI phase?
Not with boos. I tried.
I believe you, but maybe you could use another boo? I know the brown donut block can't move in the same ways with Attach to Layer as a red one.

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Wed Dec 23, 2015 3:34 pm

I tried changing the speed of boos with npc codes, but it doesn't work. Is it possible to increase the speed of boos using lunalua?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Wed Dec 23, 2015 3:43 pm

TheDinoKing432 wrote:I tried changing the speed of boos with npc codes, but it doesn't work. Is it possible to increase the speed of boos using lunalua?
What NPC code did you use? It should be possible with them.

FanofSMBX
Ludwig von Koopa
Ludwig von Koopa
Posts: 3878
Joined: Sun Dec 22, 2013 12:01 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby FanofSMBX » Wed Dec 23, 2015 3:45 pm

PixelPest wrote:
TheDinoKing432 wrote:I tried changing the speed of boos with npc codes, but it doesn't work. Is it possible to increase the speed of boos using lunalua?
What NPC code did you use? It should be possible with them.
He probably means up and down speed which is not possible with npc codes.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Wed Dec 23, 2015 3:51 pm

FanofSMBX wrote:
PixelPest wrote:
TheDinoKing432 wrote:I tried changing the speed of boos with npc codes, but it doesn't work. Is it possible to increase the speed of boos using lunalua?
What NPC code did you use? It should be possible with them.
He probably means up and down speed which is not possible with npc codes.
Okay. I thought he was referring to just the speed in general.

Mushroom King
Flurry
Flurry
Posts: 185
Joined: Sun May 25, 2014 5:09 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Mushroom King » Thu Dec 24, 2015 3:45 pm

Is it possible to make a fireball shooted from a Fire Piranha melt the ice blocks like the player can with a fire flower?
Last edited by Mushroom King on Sat Dec 26, 2015 4:53 am, edited 1 time in total.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sat Dec 26, 2015 2:55 am

I need to play and stop music when I put on off with my new graphical menu in lua but I can loop and play music but I dont know how to make it stop
when I put it on off
i have so far this command , any one can give me a tiny hint ? thanks in advance :D

Code: Select all

Audio.SfxPlayCh(1, StarmanSound, -1);

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Tue Dec 29, 2015 12:02 pm

I'm working on a post-game feature of my episode titled "Life Factory" where the player can trade 99 lives for one of the special power-ups. How can I modify the player's life count without killing and respawning the player over and over? Also, the 99 lives trade-off gives you a modified fire flower power-up, a tanooki suit (not found anywhere else in the game), or a special hammer suit (hammer suits aren't found anywhere else in the game either). So, how do I load alternate graphics and text files for the fire flower power-up onEvent, that will automatically replace all fire flower related graphics and add the text file for the fireballs that currently are in the main episode folder?

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 Dec 29, 2015 12:54 pm

PixelPest wrote:I'm working on a post-game feature of my episode titled "Life Factory" where the player can trade 99 lives for one of the special power-ups. How can I modify the player's life count without killing and respawning the player over and over? Also, the 99 lives trade-off gives you a modified fire flower power-up, a tanooki suit (not found anywhere else in the game), or a special hammer suit (hammer suits aren't found anywhere else in the game either). So, how do I load alternate graphics and text files for the fire flower power-up onEvent, that will automatically replace all fire flower related graphics and add the text file for the fireballs that currently are in the main episode folder?
http://engine.wohlnet.ru/pgewiki/SMBX_Global_Memory for the life counter.

http://engine.wohlnet.ru/pgewiki/PlayerGfx.lua for a new fire flower spritesheet.

http://engine.wohlnet.ru/pgewiki/Npcconfig.lua for changing npc codes at runtime.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Tue Dec 29, 2015 1:01 pm

Enjl wrote:
PixelPest wrote:I'm working on a post-game feature of my episode titled "Life Factory" where the player can trade 99 lives for one of the special power-ups. How can I modify the player's life count without killing and respawning the player over and over? Also, the 99 lives trade-off gives you a modified fire flower power-up, a tanooki suit (not found anywhere else in the game), or a special hammer suit (hammer suits aren't found anywhere else in the game either). So, how do I load alternate graphics and text files for the fire flower power-up onEvent, that will automatically replace all fire flower related graphics and add the text file for the fireballs that currently are in the main episode folder?
http://engine.wohlnet.ru/pgewiki/SMBX_Global_Memory for the life counter.

http://engine.wohlnet.ru/pgewiki/PlayerGfx.lua for a new fire flower spritesheet.

http://engine.wohlnet.ru/pgewiki/Npcconfig.lua for changing npc codes at runtime.
Thanks. Those are extremely helpful.
But how do I use HUD Lives Count? I want to check to see if the value of HUD Lives Count is equal to another value (99) and if true subtract a value of 99 from HUD Lives Count?

underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Tue Dec 29, 2015 1:33 pm

mem(0x00B2C5AC,FIELD_FLOAT) returns the life number
mem(0x00B2C5AC,FIELD_FLOAT,lifecount) lets you set the amount of lives to "lifecount"

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 Dec 29, 2015 1:34 pm

Yeah you can get and set mem(0x00B2C5AC, FIELD_FLOAT) and do exactly what you just described.
Spinda wrote:mem(0x00B2C5AC,FIELD_FLOAT) returns the life number
mem(0x00B2C5AC,FIELD_FLOAT,lifecount) lets you set the amount of lives to "lifecount"
wow nice ninja geez

Quantumenace
Chain Chomp
Chain Chomp
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Quantumenace » Tue Dec 29, 2015 6:41 pm

Transferring some of my layer movements to Lua, I ran into a problem Hoeloe also pointed out: http://talkhaus.raocow.com/viewtopic.ph ... &start=250

When the player gets a powerup or gets hit, all layer movements and basic event timers are paused briefly, but Lua is not. (generators, NPCs, and attached layers aren't either.) That can throw off the layer positions because the script assumes they have been moving. Defines.levelFreeze accounts for stopwatches but not this.

I did find a workaround that uses a test block on an oscillating test layer. If the layer movement is "paused", including from stopwatches, the block's speed will register as 0 instead of the layer speed. If that's the case you can tell your script not to update its layer script for that loop.

Is there a simpler way to check this? If not I'll post the code. It's still far from ideal because you have to manually place the block and type in its coordinates to find it. As far as I know you can't use script to place a block on a non-default layer. Blue P-switches also make it lose track of the block and freak 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 Dec 29, 2015 6:48 pm

Normally SMBX discontinues layer movement while the player is in a forced animation state. There's a player mem offset for that state (0x122 I believe). Just check if that's 0 and only run your code inside if it is.

Also, you can do block = Block.spawn and then block.layerName = "string"

Quantumenace
Chain Chomp
Chain Chomp
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Quantumenace » Tue Dec 29, 2015 7:56 pm

It looks like 1, 2, 4 and 7 are animation values associated with frozen layers, the others don't pause them. Is there a global memory offset that stores whether the layers are paused?

As for the block, layerName is read-only :(

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 Dec 29, 2015 8:13 pm

oh really? I remember 500 pausing stuff like NPC platforms at least. You can still single out the forced frames by adding conditions to the if clause. If, for example, 1, 2, 4 and 7 are frames which bother you and shouldn't run the code, you type:

if (player:mem(0x122, FIELD_WORD) ~= (1 or 2 or 4 or 7)) then
your code
end

(I think this should work. I'm not too familiar with fancy stuff you can do in if clauses.)

Quantumenace
Chain Chomp
Chain Chomp
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Quantumenace » Tue Dec 29, 2015 9:04 pm

Oh, 500 does pause it, it's just so short it's hard to tell by just watching the layer. Same with 8. I know that 3 (pipe) does not, however.

There appear to be other values, like 11 for getting the Tanooki powerup, 41 for ice flower, 12 for hammer. It may work to just check whether it is 0 or 3.

I may just go with the block as an indicator, I don't intend to use P-switches anyway.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari