Page 31 of 76

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:41 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:43 am
by Mario_and_Luigi_55
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:44 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:53 am
by Mario_and_Luigi_55
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:56 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 6:59 am
by Mario_and_Luigi_55
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 22, 2016 7:05 am
by Emral
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

Re: Need help with lua? - LunaLua General Help

Posted: Mon Jul 25, 2016 10:26 pm
by Yoshi021
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.

Re: Need help with lua? - LunaLua General Help

Posted: Tue Jul 26, 2016 3:33 am
by loop
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 29, 2016 10:40 am
by Angelus
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 29, 2016 10:51 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 29, 2016 11:58 am
by Hoeloe
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 29, 2016 12:33 pm
by Angelus
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 29, 2016 1:13 pm
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 03, 2016 1:04 pm
by Reign
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?

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 03, 2016 1:16 pm
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 03, 2016 1:54 pm
by Reign
Got it, thanks.

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 03, 2016 8:00 pm
by Enchlore
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.

Re: Need help with lua? - LunaLua General Help

Posted: Sun Aug 07, 2016 4:23 pm
by Mushroom King
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?

Re: Need help with lua? - LunaLua General Help

Posted: Sun Aug 07, 2016 4:35 pm
by Emral
Right now the easiest way to do that is to make a boo from scratch, as smbx overrides ai1.