Help Thread
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
Since people found this explanation of mine from the MAGL X2 thread helpful, I'm going to repost it here. This covers basic stuff that I worked out while making my first level in SMBX.
Dragon Fogel wrote:Hello! I'm a new-to-SMBX person who learned a lot about events and layers in the making of my level, so I'll try to help you other new people out. I used Wohl's editor to learn all this, so my explanations will be based on that.
First, layers. You can make a new layer in one of two ways: by hitting the Layer icon in the top menu (it's the colored rectangles, between the doors and the clock-and-gears), and selecting "New Layer"; or, by right-clicking on something you've placed, hovering over where it says "Layer", and selecting "Add to new layer".
Layers are essentially a number of objects that are all connected. They're either all showing or all not showing. By themselves, they don't really do anything; to make use of them, you need events. So let's talk about those next.
The icon with the clock and gears is the Event icon. Click on that and you'll be able to make new events. There are a few things you can do with them, but the ones I found particularly useful were these:
-Layers.
Probably the most important event feature of all. This lets you select layers to hide, show, or switch between visible and invisible. (The last one is called "Toggle".) At the top is a list of all the layers. Below that are empty lists that say Show, Hide, and Toggle. Highlight a layer in the first list, and click the "+" button next to the list you want it to be in to add it to that list. As an example, you can have a layer called "Star", and put a star in there; then highlight "Star" in the list of layers and click on the "+" button next to Show. This will make everything on the Star layer appear when the event is triggered. Use the Hide list to make layers disappear, and the Toggle list to make them switch between visible and invisible whenever the event happens.
-"Common"
This tab has one feature that I would particularly like to note - "Display message". This makes a message pop up when the event starts. You can use this to show text without requiring the player to talk to an NPC, or to have extra text boxes on talking. This brings us to our next useful feature.
-Trigger event.
You can use an event to call another event. There's only so much you can do with just one, after all. This is most useful for talking; just make a new event for each text box, and have each text box's event trigger the next one. It has other uses, but this is probably the one that will come up the most.
I think that covers the basics, but wait! You might be asking how you make these events happen. Obviously you can use Trigger Event, but that doesn't do you any good unless you've triggered the first event in the sequence, right? So what are your options?
Well, you have four. They're all useful in their own ways. To use any of these, first you place an NPC. You then get a little toolbar that pops up, which you can also see by right-clicking the NPC and selecting Properties. At the bottom of this toolbar, there are four options. These allow the NPC to trigger events under certain circumstances.
-Activate
This causes the event to happen as soon as the player gets close enough for the NPC to spawn. Doesn't work with things like vines or ladders, which don't really "spawn" per se. An example of this would be an enemy that makes a barrier appear behind you when you approach, so you can't leave the area until you defeat it.
-Death
Particularly relevant to Kitet's question! This causes the event to happen once the NPC dies - this includes being collected in the case of items. Again, doesn't work with things like vines or ladders because they can't die.
-Talk
This requires the NPC to be friendly, I believe, so that you can talk to them. It makes something happen when you talk; you can use this for multiple text boxes in a conversation, or to have someone who opens a path or makes a power-up appear when you talk to them.
-Layer is empty
This causes the event to activate if there's nothing left on a specific layer. Examples of this are putting a group of enemies on a layer and making something happen if you defeat them all, or putting all the dragon coins on a layer and making something happen if they're all collected.
It's worth noting that projectiles created by NPCs or anything produced by a generator on a particular layer is not counted as being on that layer. I think they're on Spawned NPCs, which I just realized can be hidden and I didn't think to make use of in my level. Oh well!
I hope that's helpful to other new people, feel free to ask questions about it.
- Dog In Da Grass
- Woof!
- Posts: 522
- Joined: 11 years ago
- First name: Dog
- Pronouns: that dog
- Location: Da Grass
Re: Help Thread
I've been finding all sorts of ways of exploiting the vanilla SMBX to get around the imitations (for the most part at least) so I could potentially help with some more advanced stuff if you have any ideas you were wanting to get working. feel free to PM me or message here too if needed.
- TaviTurnip
- Reach for the top
- Abministrator
- Posts: 1077
- Joined: 14 years ago
- First name: Rena
- Location: Winter
Re: Help Thread
Okay so... are NPCs (or at least flying Koopas set to fly mode) not affected by layer movement? Or is this a side effect of autoscroll? I really wanted to do a specific thing, but it seems like I can only make blocks be affected by layer movement and these Koopas don't care at all. Is that something I'm just stuck without?
I regularly stream on Twitch! with other members of the talkhaus. Come watch Monday, Tuesday and Friday at 2PM for blind playthroughs and Pokémon and Touhou and stuff. Come hang out with us!
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
I may be mistaken, but I think that the only "NPCs" affected by layer movement are: 1) vines, 2) grabbable grass/herbs
- TaviTurnip
- Reach for the top
- Abministrator
- Posts: 1077
- Joined: 14 years ago
- First name: Rena
- Location: Winter
Re: Help Thread
Apparently coins are too, but... this is kind of a letdown, apparently literally everything I wanted for this level is not a thing SMBx does and I'm going to have to do some major trickery/loopholes just to get a level that's even close to what I originally wanted...Rednaxela wrote:I may be mistaken, but I think that the only "NPCs" affected by layer movement are: 1) vines, 2) grabbable grass/herbs
You won't beat me, SMBx >:I
I regularly stream on Twitch! with other members of the talkhaus. Come watch Monday, Tuesday and Friday at 2PM for blind playthroughs and Pokémon and Touhou and stuff. Come hang out with us!
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
If I want to have an exit pipe come on-screen, what's the right way to do it? I tried putting a warp next to the pipe on the same layer and moving the layer in an event, but then I died after entering the pipe. Should I put the warp next to where I want the pipe to end up instead?
Re: Help Thread
I could be mistaken but this sounds like it's the moving layers killing you so you may not be able to do a pipe that way. You might try a door if possible instead.Dragon Fogel wrote:If I want to have an exit pipe come on-screen, what's the right way to do it? I tried putting a warp next to the pipe on the same layer and moving the layer in an event, but then I died after entering the pipe. Should I put the warp next to where I want the pipe to end up instead?
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
The layer isn't moving any more at that point, though. Unless SMBX thinks it is for some reason?
Anyways, I've seen the exact thing I'm trying to do work before, I just don't know what I'm doing wrong with it.
Anyways, I've seen the exact thing I'm trying to do work before, I just don't know what I'm doing wrong with it.
Re: Help Thread
Is the exit warp moving out of position? That's the only thing I can think of.
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
Oh, that might explain it, and apparently I can't have the entrance and exit on different layers so I have to move the exit to the right of where I want it to end up.
Edit: Yeah, that's it. Now the issue is making the exit line up properly. I'm not quite sure how setting the speed in the layer movement command works, in that I know how to change it but I don't know how to make sure it moves a whole number of tiles.
Edit: Yeah, that's it. Now the issue is making the exit line up properly. I'm not quite sure how setting the speed in the layer movement command works, in that I know how to change it but I don't know how to make sure it moves a whole number of tiles.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
I'm going to guess the speed is pixels per frame, and each frame is 1/65th of a second so say... speed 4 would mean 260 pixels per second. For sake of fun example, least common multiple of 32 and 65 is 2080 so if you wanted time/speed/tiles to all be integers, would require a movement of 2080 pixels (32 speed, 1 second, 65 tiles)Dragon Fogel wrote:Edit: Yeah, that's it. Now the issue is making the exit line up properly. I'm not quite sure how setting the speed in the layer movement command works, in that I know how to change it but I don't know how to make sure it moves a whole number of tiles.
Last edited by Rednaxela 9 years ago, edited 1 time in total.
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
I'm using Wohl's editor, which says "blocks per second" but that doesn't seem to match up with how it's actually working.
-
- ? Title Title Title Title ?
- Posts: 30
- Joined: 14 years ago
- Location: USA
Re: Help Thread
It also has a 'how many blocks per second' and 'block pixel size' bits, are either of those off of the default for you? (32 pixels, 1.0000 blocks per second)Dragon Fogel wrote:I'm using Wohl's editor, which says "blocks per second" but that doesn't seem to match up with how it's actually working.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
Note that the blocks per second calculator of Wohl's editor limits it's output to 5 decimal places, so (32 pixels, 1.0000 blocks per second) becomes 0.49231... which if you translate it back to blocks per second gives you 1.0000047 blocks per second. This discrepancy can be enough to impact the SMBX physics if your level is designed as to be super picky about exact block sizes (such as if you put 32px high spikes layered around 32px aligned blocks and stop layer movement right when they cross).KingTwelveSixteen wrote:It also has a 'how many blocks per second' and 'block pixel size' bits, are either of those off of the default for you? (32 pixels, 1.0000 blocks per second)Dragon Fogel wrote:I'm using Wohl's editor, which says "blocks per second" but that doesn't seem to match up with how it's actually working.
- Dragon Fogel
- Master of Pointlessness
- Posts: 1418
- Joined: 10 years ago
Re: Help Thread
Well, that could explain some of the issues I'm having. But there's one other thing - when I set the speed to -6 bps in an event that runs for 1 second before triggering an event that sets the speed to 0, the pipe moves considerably more than 6 blocks. Nearly twice as much.
Setting the event to run for a half-second produces results closer to what I want, but it still makes the layer move an uneven number of blocks. (Probably due to the rounding.)
So is there a good way to make a layer move an exact number of blocks? There are other ways I can do this so it's not that big of a deal, I'm just wondering if I can get this method to work.
Setting the event to run for a half-second produces results closer to what I want, but it still makes the layer move an uneven number of blocks. (Probably due to the rounding.)
So is there a good way to make a layer move an exact number of blocks? There are other ways I can do this so it's not that big of a deal, I'm just wondering if I can get this method to work.
- Dog In Da Grass
- Woof!
- Posts: 522
- Joined: 11 years ago
- First name: Dog
- Pronouns: that dog
- Location: Da Grass
Re: Help Thread
Is it possible to start an event after grabbing a stopwatch down from your reserve power-ups? I had an idea where it could be used similarly to a p-switch but I'm not sure if my idea is valid or could work.
Re: Help Thread
Is there a way to force a character to enter a level in a certain state (like, say, Small Toad)? Or is that something I should figure out how Lua works for?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
There are of course map making tricks you could use to force a certain powerup state (i.e use a warp to teleport them onto powerups in an area they can't get out of safely ), but they can be a bit messy...No Lynch wrote:Is there a way to force a character to enter a level in a certain state (like, say, Small Toad)? Or is that something I should figure out how Lua works for?
To do it automatically/quietly/clearly without such stuff requires LunaDLL (Either Lua or Autocode).
For sake of a quick code sample for Lua, to force a player to small when entering a the first section:
Code: Select all
function onLoadSection0(playerIndex)
player.powerup = PLAYER_SMALL
end
Re: Help Thread
Is there a way to edit blocks to animate (frames and frame speed) like you do with NPCs?
I'm using those moving spikes from Super Metroid, but the ceiling spikes (=Muncher replacement) animate twice as fast as the floor spikes (=Drilling Spikes replacement)
I'm using those moving spikes from Super Metroid, but the ceiling spikes (=Muncher replacement) animate twice as fast as the floor spikes (=Drilling Spikes replacement)
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
Not really no. For blocks you're stuck using ones that already match the desired graphics propertiesS1eth wrote:Is there a way to edit blocks to animate (frames and frame speed) like you do with NPCs?
In theory it might be doable with LunaLua mem calls, but the information required is not yet known.
- Dog In Da Grass
- Woof!
- Posts: 522
- Joined: 11 years ago
- First name: Dog
- Pronouns: that dog
- Location: Da Grass
Re: Help Thread
Is it possible to start an event after grabbing a stopwatch down from your reserve power-ups? I had an idea where it could be used similarly to a p-switch but I'm not sure if my idea is valid or could work.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
Whoops, I saw you post this a few times when I was busy and forgot to respond.Dog In Da Grass wrote:Is it possible to start an event after grabbing a stopwatch down from your reserve power-ups? I had an idea where it could be used similarly to a p-switch but I'm not sure if my idea is valid or could work.
So you want to detect the time freeze and trigger an event? I think this should be doable with LunaLua using a mem call. I'll have to check if the time freeze status memory address is known though. I'll check that tonight.
- Dog In Da Grass
- Woof!
- Posts: 522
- Joined: 11 years ago
- First name: Dog
- Pronouns: that dog
- Location: Da Grass
Re: Help Thread
Okay, thanks, sorry I had to double post itRednaxela wrote:Whoops, I saw you post this a few times when I was busy and forgot to respond.Dog In Da Grass wrote:Is it possible to start an event after grabbing a stopwatch down from your reserve power-ups? I had an idea where it could be used similarly to a p-switch but I'm not sure if my idea is valid or could work.
So you want to detect the time freeze and trigger an event? I think this should be doable with LunaLua using a mem call. I'll have to check if the time freeze status memory address is known though. I'll check that tonight.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Help Thread
Don't have time to test right now but something likeDog In Da Grass wrote:Okay, thanks, sorry I had to double post it
Code: Select all
local event_triggered = false
function onLoop()
if (mem(0xB2C8B4, FIELD_WORD) ~= 0) then
if (not event_triggered) then
event_triggered = true
triggerEvent("SomeEvent")
end
else
event_triggered = false
end
end