Unwanted checkpoints and ones which do not get registered

Need help with any SMBX game-related issues? Ask your questions here.
Just_Thomas
Snifit
Snifit
Posts: 233
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Unwanted checkpoints and ones which do not get registered

Postby Just_Thomas » Mon Jan 22, 2024 10:19 am

Hello guys, hello Emral - as you are mostly active around here (: ,
For some reason I feel like this code here - causes - SMBX to place a "checkpoint" at the start, which however kills you anyway.
This unplaced and still existing checkpoint ONLY appears, if I place a real checkpoint within the level (npc-430).
On the screenshots it is titled with "checkpoint 1". If NOT placed, then the faulty checkpoint does not appear as well.
However the placed checkpoint is not properly registered and can not be selected from the test menu and also gets ignored when "collected" ingame.
This "very tall" checkpoint, I want to note, does work with the first level where I have put 3 of them. They are supposed to mimic the oldskool-invisible-checkpoints of SMB1 or SML1 on gameboy. So it must have something to do with the luna lua code of this own level.

"--checkpoint 1 (real start)" is actually the deleted checkpoint.
In SMB1 - if you restart an underground or waterlevel after the "mario goes to the pipe really slow" you do not watch the sequence a second time but rather you start at the actual begin of the level.

Code as follows:

Code: Select all

--for Underground and Water Levels

local inputs2 = API.load("inputs2")
Timer.setSecondLength(40)
moveToPipe = 0

function onStart()

	if moveToPipe == 0 and player.section == 0 then
	Defines.player_walkspeed = 2.5
	moveToPipe = 1
	inputs2.locked[1].all = true
	end

--checkpoint 1 (real start)

	if player.x == -179852 and player.section == 1 then
	Routine.run(delayPipeSFX)
	end

end


function delayPipeSFX()
	Misc.pause()
	Timer.activate()
	Timer.set(400)
	Routine.waitSeconds(2.0, true)
	Misc.unpause()
	Audio.playSFX(17)
end

function onTick()
--Text.print(player.x, 100, 100)
	
	if moveToPipe == 1 then
	player.keys.right = true
	end

	if moveToPipe == 1 and player.section == 1 then
	Timer.activate()
	Timer.set(400)
	inputs2.locked[1].all = false
	Defines.player_walkspeed = 3
	moveToPipe = 0
	end

end

function onEvent(calledEvent)
	if(calledEvent == "BigBlockScript") then
	Defines.earthquake = 20
	Audio.playSFX(37)
	end
end

Screenshot as follows, hopefully showing the whole situation:
Image

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

Re: Unwanted checkpoints and ones which do not get registered

Postby Just_Thomas » Thu Jan 25, 2024 3:24 pm

Oooooooooook, ....
I am pretty much clueless at this point and if I would have to guess it is a bug (somehow).

For those who bothered to read the stuff in the previous post:
The checkpoint bug (?) has nothing to do with the luna code for the level as it seems, because even if I remove the file (even restart the editor) nothing changes.
The "ghost checkpoints" are still at the start location instead where I actually placed them.

Then I thought the SMW checkpoint and the SMM checkpoints do not "like each other", and since I only used the SMM checkpoints in level 01 and it worked, I thought it would work for level02 as well.
Info: The SMM checkpoint acts as an invisible and very tall checkpoint (to let it "look" like those in the original SMB), the SMW checkpoint however is more of a very small one for those levels where you enter the pipe at the beginning (like 1-2 or 2-2) and do not watch the "enter pipe sequence" a second time.

For level 01 the checkpoints are in section 0, while in level 02 they are in section 1.

Now guess what: Once I placed the SMM checkpoint in section 0 instead ... no problem anymore. So if I have to guess it is a bug of npc-430 (with changed settings that is, I have to admit, default settings do not cause problems).
Please look at the testmap and try to restart from the checkpoints ingame. One does work, the other does not.

DL:
https://file.io/FQBhVBZjEPTU

Mirror 1:
https://www.file-upload.net/download-15 ... 3.zip.html

Mirror 2:
https://fastupload.io/G0TYTF8UOByDusB/file

Mirror 3:
https://filebin.net/7vimdzktv5bgo6mk/testworld3.zip

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

Re: Unwanted checkpoints and ones which do not get registered

Postby Just_Thomas » Fri Feb 02, 2024 2:44 pm

For those curious I used an other solution provided by Emral somewhere earlier:
an example from one of my levels, which has 3 checkpoints:

Code: Select all

local checkpoints = require("checkpoints")
local cp1 = checkpoints.create{x = -202112, y = -200128, section = 0}
local cp2 = checkpoints.create{x = -199936, y = -200096, section = 0}
local cp3 = checkpoints.create{x = -196992, y = -200096, section = 0}
beware you have to have some space at the target locations (for the horizontal), so the place where you "spawn" again.
You might want to test out the spawning ingame from the selected checkpoint to see if you do not wall slip or anything like that.
The least thing you have to do is to setup the X and y spawn coordinates in the chosen sector.
Also keep in mind, that the player somehow still does not respawn at these exact locations.
If you want to work with the exact coordinates use something like:

Code: Select all

function onTick()
Text.print(player.x, 100, 100)
end
Of course you also have to activate them, which you can do like that:

Code: Select all

function onEvent(calledEvent)
	if calledEvent == "collectCP1" then
	cp1:collect()
	end

	if calledEvent == "collectCP2" then
	cp2:collect()
	end

	if calledEvent == "collectCP3" then
	cp3:collect()
	end
end
In this case I have 3 vanilla SMBX events with these names: collectCP1, collectCP2 and collectCP3, also called classic events.
Just add them via names, everything else does happen in the luna lua file.
As trigger in the level I used the npc-465, the invislble red square under "Misc" -> "NPCs" -> "Sources", as well as the option "Activate" within the npcs settings, as I only have to use one of these for each checkpoint then.

Thanks again to Emal for his help, as I could not really understand this part of the wiki very well:
https://docs.codehaus.moe/#/reference/checkpoint


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari