General Help and Quick Questions

Need help with any SMBX game-related issues? Ask your questions here.
deice
Volcano Lotus
Volcano Lotus
Posts: 549
Joined: Fri Jul 23, 2021 7:35 am

Re: General Help and Quick Questions

Postby deice » Fri Mar 08, 2024 4:08 am

Cat king wrote:
Thu Mar 07, 2024 8:09 pm
1: Is there a way to limit the player's controls (such as removing spin jump) and

2: Is there an easier way to import graphics (especially player graphics)?
1. yes

2. there's only one way to import player graphics (unless you intend to rewrite the player's animation logic entirely via a script but that's definitely far more complex than putting an image file into a folder)
there is the "pge calibrator" program (located in "data/pge") which can probably help with aligning player sprites properly, but other than that importing graphics does require at least some effort

Cat king
Koopa
Koopa
Posts: 18
Joined: Thu Feb 29, 2024 1:04 pm
Flair: Mario kart wii is #1
Pronouns: he/him

Re: General Help and Quick Questions

Postby Cat king » Fri Apr 05, 2024 3:50 pm

Is there a way to change music to a new custom music in events without Lunalua? or is that not possible? (e.x. change wii dk summit theme to wii mushroom gorge with events)

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Sat Apr 06, 2024 3:09 am

Cat king wrote:
Fri Apr 05, 2024 3:50 pm
Is there a way to change music to a new custom music in events without Lunalua? or is that not possible? (e.x. change wii dk summit theme to wii mushroom gorge with events)
I just tested around for you. "MKWii Mushroom Gorge" is a "stock music" file for SMBX, as like "SMB3 Overworld" for example.
For everything else take a look on the attachment. The custom music does play (did not work in previous beta, back then custom music only did work when setup as default music in a section -<<< added for clarity ) when the trigger does get "killed".
The example is from "stock music" to "custom music". Other way around is even easier. There you simply have to select the desired music from the list in the classic event itself. If Custom music does play by default in a section then click in the "Custom" checkbox as well.

Image

Keep in mind through, luna lua gives you much more freedom and control. I also can not make a npc and only basic things, but it is overall better than to set up classic events in SMBX. Yes, you have to do some things first and have to know what to consider, but once you know that, you have the "template" for that in your brain... or written down, whatever you prefer.

However I just noticed, while we have a SFX list for stock sound effects

Code: Select all

	Audio.playSFX(7)
= item out of box sound or a custom sfx in your project or level folder

Code: Select all

	Audio.playSFX("whatever.wav/ogg/mp3 etc.")
I can not find a way to control stock music via luna lua either.

Cat king
Koopa
Koopa
Posts: 18
Joined: Thu Feb 29, 2024 1:04 pm
Flair: Mario kart wii is #1
Pronouns: he/him

Re: General Help and Quick Questions

Postby Cat king » Sat Apr 06, 2024 2:49 pm

Thanks Just_Thomas! Just one more question. To my understanding from what you're saying here, is that you can't switch from custom music to new custom music via events, but you can switch from base game music to custom music?

S_Koopa0
Spiny
Spiny
Posts: 29
Joined: Mon Jul 04, 2016 10:57 am
Flair: The S stands for Springboard

Re: General Help and Quick Questions

Postby S_Koopa0 » Sun Apr 07, 2024 12:55 am

Just_Thomas wrote:
Sat Apr 06, 2024 3:09 am
However I just noticed, while we have a SFX list for stock sound effects

Code: Select all

	Audio.playSFX(7)
= item out of box sound or a custom sfx in your project or level folder

Code: Select all

	Audio.playSFX("whatever.wav/ogg/mp3 etc.")
I can not find a way to control stock music via luna lua either.
There's actually Audio.MusicChange() for that. The basegame music IDs are listed in the music.ini file in the _templates folder.

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Sun Apr 07, 2024 3:07 am

Cat king wrote:
Sat Apr 06, 2024 2:49 pm
Thanks Just_Thomas! Just one more question. To my understanding from what you're saying here, is that you can't switch from custom music to new custom music via events, but you can switch from base game music to custom music?
At least NOT within the same section. I can show you how to use luna lua in this case or give you a suitable template, it's not that difficult (I mean this in the sense that I was "very" stupid with it at the beginning before I ever got anything right, so it's not impossible to learn, so I am not mocking you or anything). You can always formulate so many things ambiguously, even though you don't want to.

Edit:

Code: Select all

--------------------------------------------------
-- Level code
-- Created 9:44 2024-4-7
--------------------------------------------------
musicVariable1 = 0

function onStart()
--the music for the level does get controlled entirely in this file
-- this shit does run at the very start

 Audio.MusicChange(0, 1, 300)

-- section 0 does play [level-music-1], name="SMB3 Overworld" with fadeDurationMS of 300
-- (...\data\music.ini)

 Audio.MusicChange(1, 7, 0)

-- section 1 does play [level-music-7], name="SMB1 Underground (8-Bit)" with fadeDurationMS of 0"
-- also (...\data\music.ini)
end

-- Run code when internal event of the SMBX Engine has been triggered
-- eventName - name of triggered event
function onEvent(eventName)
	if(eventName == "music-trigger1") then
	-- this gets triggered if you collect the coin in section 0 and runs the routine called "openCustomMusic"
	musicVariable1 = 1
	Routine.run(openCustomMusic)
	end
end

function onSectionChange(sectionIdx)
	-- when player enters section 0 AND musicVariable1 equals 1 (the coin in section 0 has been collected before)...
	if sectionIdx == 0 and musicVariable1 == 1 then
	Routine.run(openCustomMusic)
	end
end

function openCustomMusic()
	-- does run when the coin in section has been collected OR when section 0 gets entered AND the coin in section 0 has been collected
	Audio.MusicChange(0, 0, 0)	-- for some reason you have to disable the default music "system" first, here section 0 play music 0/none/nothing
	Audio.MusicOpen("Wario Land Shake It! OST - Bad Manor.ogg")
	Audio.MusicPlay()
end
Image

as download:
https://file.io/aLLUzAROrn73
or
https://www.file-upload.net/download-15 ... e.zip.html
I hope you can gain some insights from it. I don't know if all of it has been written down properly. Maybe a professional could take another look at it.
musicVariable could also have false and true in this case. I mostly work with numbers through, as I do not create anything complicated anyway.

If you know where your project is heading and you still have questions or are not sure about a few things, then feel free to ask (here, in that thread).
S_Koopa0 wrote:
Sun Apr 07, 2024 12:55 am
Just_Thomas wrote:
Sat Apr 06, 2024 3:09 am
However I just noticed, while we have a SFX list for stock sound effects

Code: Select all

	Audio.playSFX(7)
= item out of box sound or a custom sfx in your project or level folder

Code: Select all

	Audio.playSFX("whatever.wav/ogg/mp3 etc.")
I can not find a way to control stock music via luna lua either.
There's actually Audio.MusicChange() for that. The basegame music IDs are listed in the music.ini file in the _templates folder.
Hey cool, thanks for the reply. I will check that out. Looks like it does work similar to the SFX list then.

Edit: BTW: I tried it as like "...\data\worlds\cliche\music.ini" but I could NOT overwrite music with that method. For some reason it simply did NOT work so I had to use Audio.MusicOpen(). I tried really a lot and nothing worked at the end.

S_Koopa0
Spiny
Spiny
Posts: 29
Joined: Mon Jul 04, 2016 10:57 am
Flair: The S stands for Springboard

Re: General Help and Quick Questions

Postby S_Koopa0 » Sun Apr 07, 2024 8:49 am

Just_Thomas wrote:
Sun Apr 07, 2024 3:07 am
Edit: BTW: I tried it as like "...\data\worlds\cliche\music.ini" but I could NOT overwrite music with that method. For some reason it simply did NOT work so I had to use Audio.MusicOpen(). I tried really a lot and nothing worked at the end.
Can you explain what you did exactly? I think I'm missing a lot of details, considering that the music.ini file in that folder only replaces the world map music.

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Sun Apr 07, 2024 9:02 am

S_Koopa0 wrote:
Sun Apr 07, 2024 8:49 am
Just_Thomas wrote:
Sun Apr 07, 2024 3:07 am
Edit: BTW: I tried it as like "...\data\worlds\cliche\music.ini" but I could NOT overwrite music with that method. For some reason it simply did NOT work so I had to use Audio.MusicOpen(). I tried really a lot and nothing worked at the end.
Can you explain what you did exactly? I think I'm missing a lot of details, considering that the music.ini file in that folder only replaces the world map music.
Let`s say I copied both music.ini and the music files itself from the cliche world folder:

Code: Select all

[world-music-1]
file="overworld.spc"
name="Where Am I Going?"

[world-music-9]
file="vista-hill.spc"
name="Bowser's Castle (First Time)"

[world-music-10]
file="merry-merry-bells.spc"
name="The Merry Merry Bell Rings"
no matter what I tried I could NOT replicate that. Also not with level-music-xx instead. From my understanding these entries actually replace existing music files and IDs within the project. But nothing works for me. Therefore I had to use the audio open thingy for the example. I would love to know why it is NOT working or if I had a complete wrong understanding about it.

S_Koopa0
Spiny
Spiny
Posts: 29
Joined: Mon Jul 04, 2016 10:57 am
Flair: The S stands for Springboard

Re: General Help and Quick Questions

Postby S_Koopa0 » Sun Apr 07, 2024 9:31 am

Just_Thomas wrote:
Sun Apr 07, 2024 9:02 am
Let`s say I copied both music.ini and the music files itself from the cliche world folder:

Code: Select all

[world-music-1]
file="overworld.spc"
name="Where Am I Going?"

[world-music-9]
file="vista-hill.spc"
name="Bowser's Castle (First Time)"

[world-music-10]
file="merry-merry-bells.spc"
name="The Merry Merry Bell Rings"
no matter what I tried I could NOT replicate that. Also not with level-music-xx instead. From my understanding these entries actually replace existing music files and IDs within the project. But nothing works for me. Therefore I had to use the audio open thingy for the example. I would love to know why it is NOT working or if I had a complete wrong understanding about it.
Ok so, just to be sure everything works with this version, I tried to replace the SMB3 overworld music with the SMB1 one in a level with basically no code and it worked without issues.
This is the content of the file I used, in case you're wondering:

Code: Select all

[level-music-1]
name="test"
file="smb-overworld.spc"
Considering the code you posted earlier, my only guess is that the Audio.MusicChange calls at the top of the code are changing the music again at the start of the level.

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Sun Apr 07, 2024 11:36 am

S_Koopa0 wrote:
Sun Apr 07, 2024 9:31 am
Considering the code you posted earlier, my only guess is that the Audio.MusicChange calls at the top of the code are changing the music again at the start of the level.
That would be very strange, as I tried to use different "slots" for "custom music".
Also MusicChange means to me ... you change the music, e.g. track2 but in the music.ini you define WHAT is track 2?!
Anyway, I do not get it to work. MusicChange is actually more convenient to use if the music.ini is created accordingly and you get by with the existing slots or you want to replace existing music, but I can't get it to work.

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

Re: General Help and Quick Questions

Postby Emral » Sun Apr 07, 2024 7:54 pm

Change music from Custom A to Custom B in event:

Code: Select all

function onEvent(eventName)
	if eventName == "CustomMusicB" then	
		Audio.MusicChange(player.section, "NewCustomMusic.ogg") -- NewCustomMusic.ogg assumed to be in the episode folder. If it's in a subfolder, specify a path.
	end
end
Music.ini is only ever necessary if we're talking world map music.
The SDL Stream music functions like Audio.MusicOpen should not be conflated with the common functions that utilize SMBX's internal music playback system.

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Mon Apr 08, 2024 2:24 am

Emral wrote:
Sun Apr 07, 2024 7:54 pm
Change music from Custom A to Custom B in event:

Code: Select all

function onEvent(eventName)
	if eventName == "CustomMusicB" then	
		Audio.MusicChange(player.section, "NewCustomMusic.ogg") -- NewCustomMusic.ogg assumed to be in the episode folder. If it's in a subfolder, specify a path.
	end
end
Music.ini is only ever necessary if we're talking world map music.
The SDL Stream music functions like Audio.MusicOpen should not be conflated with the common functions that utilize SMBX's internal music playback system.
Thanks for the clarification (mainly because of the music.ini), I really appreciate it. I had partly used the demo stages as a guide.

Of course, this makes the whole thing much easier than initially thought. It was another good learning experience for me.

Code: Select all

--------------------------------------------------
-- Level code
-- Created 9:44 2024-4-7
--------------------------------------------------

function onStart()
--the music for the level does get controlled entirely in this file
-- this shit does run at the very start

 Audio.MusicChange(0, 1, 300)

-- section 0 does play [level-music-1], name="SMB3 Overworld" with fadeDurationMS of 300
-- (...\data\music.ini)

 Audio.MusicChange(1, 7, 0)

-- section 1 does play [level-music-7], name="SMB1 Underground (8-Bit)" with fadeDurationMS of 0"
-- also (...\data\music.ini)
end

-- Run code when internal event of the SMBX Engine has been triggered
-- eventName - name of triggered event
function onEvent(eventName)
	if(eventName == "music-trigger1") then
	Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end

demorlo
Goomba
Goomba
Posts: 2
Joined: Mon Apr 08, 2024 11:50 am
Pronouns: he

Re: General Help and Quick Questions

Postby demorlo » Mon Apr 08, 2024 12:14 pm

Hello, surely there is already a topic about this, but unfortunately I can't find it. How can I reset the game saves on SMBX? I uninstalled the game, then there weren't any at first, the next time I started it, the old ones were there again. I also deleted the *.sav files from the folders. That didn't work either. I need help...

greets

demorlo
Goomba
Goomba
Posts: 2
Joined: Mon Apr 08, 2024 11:50 am
Pronouns: he

Re: General Help and Quick Questions

Postby demorlo » Wed Apr 17, 2024 12:02 pm

Nobody can help me...

mariobrigade2018
Ripper II
Ripper II
Posts: 308
Joined: Wed May 24, 2023 7:00 pm
Flair: Normie in coding who dreams of making a Mario game
Pronouns: he/him

Re: General Help and Quick Questions

Postby mariobrigade2018 » Wed Apr 17, 2024 5:00 pm

demorlo wrote:
Wed Apr 17, 2024 12:02 pm
Nobody can help me...
Because of this post, the only thing I can say to you is...
Spoiler: show
GIT
Spoiler: show
GOOD
You need to be patient with other people. The world doesn’t revolve around you.

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

Re: General Help and Quick Questions

Postby Emral » Thu Apr 18, 2024 1:15 am

mariobrigade2018 wrote:
Wed Apr 17, 2024 5:00 pm
demorlo wrote:
Wed Apr 17, 2024 12:02 pm
Nobody can help me...
Because of this post, the only thing I can say to you is...
Spoiler: show
GIT
Spoiler: show
GOOD
You need to be patient with other people. The world doesn’t revolve around you.
Why would you make this post instead of asking for specifics (SMBX version, screenshots of the relevant folders) or pointing to the "delete save file" button on the launcher if SMBX2 (see below) or recommending they simply make more save files and leave the old ones untouched (if SMBX2)?
Image

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Thu Apr 18, 2024 2:32 am

Emral wrote:
Thu Apr 18, 2024 1:15 am
mariobrigade2018 wrote:
Wed Apr 17, 2024 5:00 pm
demorlo wrote:
Wed Apr 17, 2024 12:02 pm
Nobody can help me...
Because of this post, the only thing I can say to you is...
Spoiler: show
GIT
Spoiler: show
GOOD
You need to be patient with other people. The world doesn’t revolve around you.
Why would you make this post instead of asking for specifics (SMBX version, screenshots of the relevant folders) or pointing to the "delete save file" button on the launcher if SMBX2 (see below) or recommending they simply make more save files and leave the old ones untouched (if SMBX2)?
Image
Is there actually a difference? I have seen the question as well, but I had no idea how to help either, because user already ...
I also deleted the *.sav files from the folders. That didn't work either. I need help...
So I mean between manually deleting the file from the "project folder" and the launcher?
Otherwise, it is of course a bit unfortunate when a new user has questions about the general functionality (not lua, or SMBX content requests etc.) and nobody can (?) answer them. I assume that this has simply gone under.

If I'm already unsure in advance, I'd rather not answer and hope that someone like you will do so.
(As I see it, you're already in charge of a few projects here, only mentioned to avoid misunderstandings.)

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Thu May 02, 2024 4:26 pm

I thought I was clever figuring out it would be quite easy to make a "smaller" (additional) version of the npc-106 SMB1 elevator. Well I guess I was wrong, or did I forget something? I was sure I just have to name the files properly. A lua version of that npc itself does not exist I mean. Also "elevator.lua" does not look like it is "hardcoded" to certain npcs ... so, why does my version does not work like the original?

Code: Select all

[npc]
name = "Smaller Elevator"
group = "Super Mario Bros."
category = "Platforms"
image = "npc-796.png"
description  = "A moving platform that moves vertically."
algorithm = "elevator.lua"
default-effect = 10
shell-effect = 10
gfx-offset-x = 0
gfx-offset-y = 0
gfx-height = 16
gfx-width = 48
grid = 32
grid-offset-x = 0
grid-offset-y = 0
physical-height = 16
physical-width = 48
...
Image
Image

Edit some hours later...
It looks like it does need a proper *.lua

I actually tried to copy that elevator.lua with a new name in the test folder, renaming it (elevatorCC) and looked in a custom class with few lines and thought something like that would do the trick...

Code: Select all

local npcManager = require("npcManager")
local elevatorCC = require("elevatorCC")

local smallElevator = {}
local npcID = NPC_ID

local deathEffect = npcID

return smallElevator
That sh*t is just hard :/
I can't imagine that an insane amount of code would have to be created.

mariobrigade2018
Ripper II
Ripper II
Posts: 308
Joined: Wed May 24, 2023 7:00 pm
Flair: Normie in coding who dreams of making a Mario game
Pronouns: he/him

Re: General Help and Quick Questions

Postby mariobrigade2018 » Fri May 03, 2024 3:18 pm

Just_Thomas wrote:
Thu May 02, 2024 4:26 pm
I thought I was clever figuring out it would be quite easy to make a "smaller" (additional) version of the npc-106 SMB1 elevator. Well I guess I was wrong, or did I forget something? I was sure I just have to name the files properly. A lua version of that npc itself does not exist I mean. Also "elevator.lua" does not look like it is "hardcoded" to certain npcs ... so, why does my version does not work like the original?

Code: Select all

[npc]
name = "Smaller Elevator"
group = "Super Mario Bros."
category = "Platforms"
image = "npc-796.png"
description  = "A moving platform that moves vertically."
algorithm = "elevator.lua"
default-effect = 10
shell-effect = 10
gfx-offset-x = 0
gfx-offset-y = 0
gfx-height = 16
gfx-width = 48
grid = 32
grid-offset-x = 0
grid-offset-y = 0
physical-height = 16
physical-width = 48
...
Image
Image

Edit some hours later...
It looks like it does need a proper *.lua

I actually tried to copy that elevator.lua with a new name in the test folder, renaming it (elevatorCC) and looked in a custom class with few lines and thought something like that would do the trick...

Code: Select all

local npcManager = require("npcManager")
local elevatorCC = require("elevatorCC")

local smallElevator = {}
local npcID = NPC_ID

local deathEffect = npcID

return smallElevator
That sh*t is just hard :/
I can't imagine that an insane amount of code would have to be created.
The elevator is a 1.3 NPC, so you’re going to have to either look at Redigit’s drunk code or use this:
viewtopic.php?t=25472

Just_Thomas
Spike
Spike
Posts: 292
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: General Help and Quick Questions

Postby Just_Thomas » Sat May 04, 2024 12:44 pm

For those, who are also looking for a way, I found something:
I suggest you "\Extension Pack 2.1\SMB1\Balance Platforms"
The plattform of the balance itself can be used as well (most likely intended by the author). It does not exactly behave like the original, "lacks" a little bit for example, but if you do not use the original you won`t notice.
Also unless "you" are able to code you have to make some "copies" of that npc with different speed settings and/or width of the plattform.


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari