Help Thread
Posted: 19 Mar 2015, 21:40
Get help making SMBX behave desirably here.
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.
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
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?
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.
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.
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.
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?
Code: Select all
function onLoadSection0(playerIndex)
player.powerup = PLAYER_SMALL
end
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?
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.
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.
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