Page 32 of 32

Re: Need help with lua? - LunaLua General Help

Posted: Thu Jan 09, 2025 6:52 pm
by deice
Jokyaku wrote:
Thu Jan 09, 2025 4:58 pm
Hello! I'm currently just finishing a custom NPC and I was wondering if there was any way of using Extra Settings to alter an NPC Config such as nofireball or jumphurt.
extra settings are typically used for setting parameters on individual npc instances, whereas npc config (aside from some outliers like noblockcollision) have no way of being applied selectively. there are ways to emulate certain npc config flags (e.g. cancelling a harm event for a specific npc with a certain setting applied to make it immune to fireballs) but this depends heavily on the use case

could you elaborate on exactly what you're trying to do?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jan 10, 2025 6:07 am
by jokyaku
deice wrote:
Thu Jan 09, 2025 6:52 pm
Jokyaku wrote:
Thu Jan 09, 2025 4:58 pm
Hello! I'm currently just finishing a custom NPC and I was wondering if there was any way of using Extra Settings to alter an NPC Config such as nofireball or jumphurt.
extra settings are typically used for setting parameters on individual npc instances, whereas npc config (aside from some outliers like noblockcollision) have no way of being applied selectively. there are ways to emulate certain npc config flags (e.g. cancelling a harm event for a specific npc with a certain setting applied to make it immune to fireballs) but this depends heavily on the use case

could you elaborate on exactly what you're trying to do?
I'm making a "Bro" NPC with way too many variants so I'm using Extra Settings to alter which variant I want instead of using a different NPC slot for each one, sorta like how the Paratroopa works but with more variants and also changing the sprite on each one.

I wanted to know if changing the config in a case by case basis was possible since it would be a lot easier to manage, but if it's not possible I'll just emulate the behavior like you mentioned, thanks for the help.

Image

Re: Need help with lua? - LunaLua General Help

Posted: Mon Jan 13, 2025 3:08 pm
by Muffler
Is there a way to check if the player is riding a Yoshi?

Re: Need help with lua? - LunaLua General Help

Posted: Mon Jan 13, 2025 7:23 pm
by mariobrigade2018
Muffler wrote:
Mon Jan 13, 2025 3:08 pm
Is there a way to check if the player is riding a Yoshi?

Code: Select all

if player.mount == MOUNT_YOSHI then
	--do code
end
https://docs.codehaus.moe/#/constants/mounts

Re: Need help with lua? - LunaLua General Help

Posted: Tue Jan 14, 2025 11:00 am
by Muffler
mariobrigade2018 wrote:
Mon Jan 13, 2025 7:23 pm
Muffler wrote:
Mon Jan 13, 2025 3:08 pm
Is there a way to check if the player is riding a Yoshi?

Code: Select all

if player.mount == MOUNT_YOSHI then
	--do code
end
https://docs.codehaus.moe/#/constants/mounts
Thank you sm!

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 06, 2025 9:55 am
by Muffler
Hello, I have two questions:
1. Does anyone have a script that changes how the camera behaves to make it more like the NSMB games? I really don't like how your character is always at the center and I would like to change that. I know about SMWCamera but it is very old and it's not compatible with warpTransitions.
2. Can you disable the flight ability of the Super Leaf and Tanooki Suit and how do you do that? I'd like it to be like in 3D Land where you can only attack and glide.
Thank you in advance!

Re: Need help with lua? - LunaLua General Help

Posted: Tue Feb 18, 2025 11:16 pm
by mariobrigade2018
Muffler wrote:
Thu Feb 06, 2025 9:55 am
Hello, I have two questions:
1. Does anyone have a script that changes how the camera behaves to make it more like the NSMB games? I really don't like how your character is always at the center and I would like to change that. I know about SMWCamera but it is very old and it's not compatible with warpTransitions.
2. Can you disable the flight ability of the Super Leaf and Tanooki Suit and how do you do that? I'd like it to be like in 3D Land where you can only attack and glide.
Thank you in advance!
1. Camera manipulation is kinda a pain to deal with, and I’d imagine that it would be a massive headache to make that in SMBX.

2. viewtopic.php?t=29298

Re: Need help with lua? - LunaLua General Help

Posted: Sun Mar 02, 2025 2:47 pm
by arthur4272
Image
I'm having this problem with Dracula, what I can do about it?

Re: Need help with lua? - LunaLua General Help

Posted: Wed Mar 12, 2025 5:28 pm
by Muffler
Hello, is there a way to remove the hearts system for Toad and Peach, so that their health is based on powerup state instead like Mario and Luigi?

Re: Need help with lua? - LunaLua General Help

Posted: Sun Mar 16, 2025 2:02 pm
by proCoder
I've been trying to use capture buffers to capture the background of the level (for use in the lives screen)
but it just says "Invalid type for capture buffer."

I looked in the code and turns out my capture buffer apparently isn't a capture buffer, somehow.
How does this work?

Code: Select all

local buffer = Graphics.CaptureBuffer() -- Realized that width and height defaults to main frame buffer size
buffer.captureAt(-100) -- Here is the error, Also -100 is the priority of the level background

Graphics.drawBox{
    x = 0,
    y = 0,
    priority = priority - 2,
    w = cam.width,
    h = cam.height,
    texture = buffer
}

weird behavior of globals

Posted: Thu May 01, 2025 2:56 am
by DigitalDetective47
i am trying to make a library with the following structure:

library.lua

Code: Select all

function onStart()
    --Do stuff
end
luna.lua

Code: Select all

require("library")
for some reason, the onStart function in the library isn't called. i've tested playing a sound effect in the global scope of library.lua and luna.lua, as well as within a new onStart function within luna.lua, and these all trigger. but if it's specifically within the onStart specified within a require, it doesn't work. why is this happening?

Re: Need help with lua? - LunaLua General Help

Posted: Thu May 01, 2025 3:38 am
by Emral
DigitalDetective47 wrote: i am trying to make a library with the following structure:

library.lua

Code: Select all

function onStart()
    --Do stuff
end
luna.lua

Code: Select all

require("library")
for some reason, the onStart function in the library isn't called. i've tested playing a sound effect in the global scope of library.lua and luna.lua, as well as within a new onStart function within luna.lua, and these all trigger. but if it's specifically within the onStart specified within a require, it doesn't work. why is this happening?
functions in libraries should be registered to the library table.

Code: Select all

local myLib = {}
function myLib.onStart()

end

registerEvent(myLib, "onStart")
return myLib
If you simply have one onStart here, and another onStart in the script calling the library, then the script calling the library overwrites the onStart from the library.

Re: weird behavior of globals

Posted: Thu May 01, 2025 4:04 am
by DigitalDetective47
Emral wrote:
Thu May 01, 2025 3:38 am
DigitalDetective47 wrote: i am trying to make a library with the following structure:

library.lua

Code: Select all

function onStart()
    --Do stuff
end
luna.lua

Code: Select all

require("library")
for some reason, the onStart function in the library isn't called. i've tested playing a sound effect in the global scope of library.lua and luna.lua, as well as within a new onStart function within luna.lua, and these all trigger. but if it's specifically within the onStart specified within a require, it doesn't work. why is this happening?
functions in libraries should be registered to the library table.

Code: Select all

local myLib = {}
function myLib.onStart()

end

registerEvent(myLib, "onStart")
return myLib
If you simply have one onStart here, and another onStart in the script calling the library, then the script calling the library overwrites the onStart from the library.
that works! for the record, the calling script does not have an onStart

Re: Need help with lua? - LunaLua General Help

Posted: Tue Jul 01, 2025 7:08 pm
by Paka_Mzuri
I was wondering if it would be possible to implement the crouching high jump badge ability from Super Mario Wonder? And if possible, make it only available for Peach and Toad since they act more like how they did in SMB2.