Language…
18 users online: anonimzwx, bradcomp, Dennsen86,  Donut, drkrdnk, ForthRightMC, Fozymandias, hhuxy, mathie, oliver1, playagmes169, RichardDS90,  Segment1Zone2, SirMystic, steelsburg,  Telinc1, tOaO, zAce08xZ - Guests: 285 - Bots: 337
Users: 64,795 (2,375 active)
Latest user: mathew

[Solved] Teleport to OW from Intro Level

I'm setting up a cutscene to replace SMW's intro level (C5). I have everything set up the way I want, but I'm running into a small issue.

I want Mario to teleport to the overworld via a screen exit (I configured a secondary exit to warp him to the overworld, now that Lunar Magic supports that). Unfortunately, when the screen exit is triggered, it just takes me back to the start of level C5 again.

I believe this also happens if you try using the side-exit sprite on the intro level. I don't remember how to bypass that to make level C5 just behave like a regular level. Any ideas on what I could try?
Not sure if you got this answered yet, but if you didn't, putting this in your intro level in UberASM should fix the problem.

Code
STZ $0109


In case you want to know the reason: The intro level number is stored here, and while its set, any fadeout that happens redirects to the intro level, so clearing it allows things to progress like normal. The intro message clears it as soon as you close it, so without that, it never happens otherwise.
Thanks M90. I never did learn ASM like I said I would since the last time you helped me 7 years ago, heheh. Sorry.

But as for that line of code, am I supposed to just slap that under a [main:] label for LevelASM and run it on the level? It seems to just crash my emulator, heh. I'm sure I'm missing something.

An alternative I tried in the meantime was to simply have Mario warped to another level (I'm using Blockreator to make blocks that display message boxes in a sequence and then teleport the player), place the side exit sprite on that level (side exit does seems to work fine, contrary to my initial post), and manually walk Mario off to the side when it's done. Feels clunky that way, but I guess it was a solution of sorts.

Ideally, though, I'd like for everything to just play out as a normal cutscene. So, what address should STZ $0109 be written to?
Originally posted by Diego
But as for that line of code, am I supposed to just slap that under a [main:] label for LevelASM and run it on the level? It seems to just crash my emulator, heh. I'm sure I'm missing something.


Yes that's correct. The full thing would look like this:

Code
main:
STZ $0109
RTL


If using SA-1 it would be STZ $6109 but I'm sure the crashing that happened was simply because you didn't put an RTL afterwards. This little line of code on its own wouldn't do that. Coincidentally, the side exit routine also does the same thing, which is why that works as well.
Of course—the RTL tag, duh. Now that makes much more sense. And as it happens, my rom is using SA-1. So $6109 it is.

Works perfectly now, without needing player intervention for the cutscene other than skipping dialogue. Sweet!

Thanks so much for your help.