Need help with lua? - LunaLua General Help

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?
PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 22, 2016 6:41 am

Mario_and_Luigi_55 wrote:Is there a way to make LunaLua count seconds?
For what purpose? There's multiple ways you can do it, but it depends on what you'll be doing with it

Mario_and_Luigi_55
Spike
Spike
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Fri Jul 22, 2016 6:43 am

PixelPest wrote:
Mario_and_Luigi_55 wrote:Is there a way to make LunaLua count seconds?
For what purpose? There's multiple ways you can do it, but it depends on what you'll be doing with it
For making powerups disapper after few seconds

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

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 22, 2016 6:44 am

Mario_and_Luigi_55 wrote:
PixelPest wrote:
Mario_and_Luigi_55 wrote:Is there a way to make LunaLua count seconds?
For what purpose? There's multiple ways you can do it, but it depends on what you'll be doing with it
For making powerups disapper after few seconds
Then you should look at using eventu.lua, specifically, the eventu.setTimer() function

Mario_and_Luigi_55
Spike
Spike
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Fri Jul 22, 2016 6:53 am

Thanks. One more question
Why isn't this script working?

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD)=0
end
end

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

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 22, 2016 6:56 am

Mario_and_Luigi_55 wrote:Thanks. One more question
Why isn't this script working?

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD)=0
end
end
Read the documentation. That's not how you set mem values

Mario_and_Luigi_55
Spike
Spike
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Fri Jul 22, 2016 6:59 am

PixelPest wrote:
Mario_and_Luigi_55 wrote:Thanks. One more question
Why isn't this script working?

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD)=0
end
end
Read the documentation. That's not how you set mem values
This:

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD,0)
end
end
didn't work as well though

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

Re: Need help with lua? - LunaLua General Help

Postby Emral » Fri Jul 22, 2016 7:05 am

Mario_and_Luigi_55 wrote:
PixelPest wrote:
Mario_and_Luigi_55 wrote:Thanks. One more question
Why isn't this script working?

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD)=0
end
end
Read the documentation. That's not how you set mem values
This:

Code: Select all

function onLoop()
if mem(0x00B251E0,FIELD_WORD)==1 then
mem(0x00B251E0,FIELD_WORD,0)
end
end
didn't work as well though
Image

Yoshi021
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 691
Joined: Thu Jan 21, 2016 9:06 pm
Flair: :)
Pronouns: He/Him

Re: Need help with lua? - LunaLua General Help

Postby Yoshi021 » Mon Jul 25, 2016 10:26 pm

How can I make the Player's fireballs go through floors and walls using Lunalua? I tried using NPC code:
noblockcollision=1
but it doesn't work for some reason.

loop
Ninji
Ninji
Posts: 984
Joined: Sun Apr 17, 2016 5:56 pm
Flair: i may be dumb but im not stupid!
Pronouns: he/him/they

Re: Need help with lua? - LunaLua General Help

Postby loop » Tue Jul 26, 2016 3:33 am

Yoshi021 wrote:How can I make the Player's fireballs go through floors and walls using Lunalua? I tried using NPC code:
noblockcollision=1
but it doesn't work for some reason.
Edit: I guess that it doesn't work on player fireballs.

Angelus
Tweeter
Tweeter
Posts: 132
Joined: Tue Jun 21, 2016 9:38 am

Re: Need help with lua? - LunaLua General Help

Postby Angelus » Fri Jul 29, 2016 10:40 am

How do I change the hitbox of a character using LunaLua? I'm replacing Peach with a smaller character, so it feels weird when you hit a block or a ceiling with that.

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

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 29, 2016 10:51 am

Angelus wrote:How do I change the hitbox of a character using LunaLua? I'm replacing Peach with a smaller character, so it feels weird when you hit a block or a ceiling with that.
Either use a .ini file if you have 2.0 or the PlayerSettings class which I would recommend to use either way. You first have to set a variable to PlayerSettings.get() function with the proper values inside which you can find here: http://wohlsoft.ru/pgewiki/LunaLua_global_functions, although for your purposes you'll probably want to use player.character and player.powerup as your arguments. Then refer here to change hitboxes: http://wohlsoft.ru/pgewiki/PlayerSettings_(class). Then you'd want to test for different frames of spritesheets, of different power-ups and different characters. You can use the memory offset 0x114 found here: http://wohlsoft.ru/pgewiki/SMBX_Player_Offsets to test for different frames. The issue with PlayerSettings class is that when it sets hitboxes, they don't revert back on their own, which is the toughest part to work around

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jul 29, 2016 11:58 am

PixelPest wrote:
Angelus wrote:How do I change the hitbox of a character using LunaLua? I'm replacing Peach with a smaller character, so it feels weird when you hit a block or a ceiling with that.
Either use a .ini file if you have 2.0 or the PlayerSettings class which I would recommend to use either way. You first have to set a variable to PlayerSettings.get() function with the proper values inside which you can find here: http://wohlsoft.ru/pgewiki/LunaLua_global_functions, although for your purposes you'll probably want to use player.character and player.powerup as your arguments. Then refer here to change hitboxes: http://wohlsoft.ru/pgewiki/PlayerSettings_(class). Then you'd want to test for different frames of spritesheets, of different power-ups and different characters. You can use the memory offset 0x114 found here: http://wohlsoft.ru/pgewiki/SMBX_Player_Offsets to test for different frames. The issue with PlayerSettings class is that when it sets hitboxes, they don't revert back on their own, which is the toughest part to work around
Uh, I really wouldn't recommend using PlayerSettings if all you need to do is change the hitbox for a specific character. PlayerSettings is much more advanced and only recommended if you're working with a more dynamic setup.

Angelus
Tweeter
Tweeter
Posts: 132
Joined: Tue Jun 21, 2016 9:38 am

Re: Need help with lua? - LunaLua General Help

Postby Angelus » Fri Jul 29, 2016 12:33 pm

I appreciate your suggestion, PixelPest, but is there a simpler way of doing so? As Hoeloe said, I just need to adjust the hitbox to the character height. I've tried to use the PGE Calibrator, but I don't know how to implement it into the game using LunaLua.

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

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 29, 2016 1:13 pm

Angelus wrote:I appreciate your suggestion, PixelPest, but is there a simpler way of doing so? As Hoeloe said, I just need to adjust the hitbox to the character height. I've tried to use the PGE Calibrator, but I don't know how to implement it into the game using LunaLua.
Try using character .ini files. You can use them in 2.0 to change hitboxes. It probably takes the least amount of coding experience needed

Reign
Chain Chomp
Chain Chomp
Posts: 327
Joined: Tue Jan 21, 2014 4:22 am

Re: Need help with lua? - LunaLua General Help

Postby Reign » Wed Aug 03, 2016 1:04 pm

This must be the sillies question in history but for some reason I can't find the command on PGE wiki even when I'm sure I've seen it before. I want to print the amount of stars the player has on the screen. Which command returns the amount of stars?

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

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Wed Aug 03, 2016 1:16 pm

Reign wrote:This must be the sillies question in history but for some reason I can't find the command on PGE wiki even when I'm sure I've seen it before. I want to print the amount of stars the player has on the screen. Which command returns the amount of stars?
You can find it here: http://wohlsoft.ru/pgewiki/SMBX_Global_Memory

Reign
Chain Chomp
Chain Chomp
Posts: 327
Joined: Tue Jan 21, 2014 4:22 am

Re: Need help with lua? - LunaLua General Help

Postby Reign » Wed Aug 03, 2016 1:54 pm

Got it, thanks.

Enchlore
Spike
Spike
Posts: 272
Joined: Thu May 08, 2014 3:40 pm

Re: Need help with lua? - LunaLua General Help

Postby Enchlore » Wed Aug 03, 2016 8:00 pm

When trying to start SMBX with LunaLua I get this error message:
Image

Here are my computer specs:
Image

I tried to search the forums if anyone provided a solution but didn't find anything.

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

Re: Need help with lua? - LunaLua General Help

Postby Mushroom King » Sun Aug 07, 2016 4:23 pm

Please, can someone give me a way to use lua to make Boos' behavior acting the opposite, like the Mad Boos in Super Princess Peach?

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

Re: Need help with lua? - LunaLua General Help

Postby Emral » Sun Aug 07, 2016 4:35 pm

Right now the easiest way to do that is to make a boo from scratch, as smbx overrides ai1.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari