Quiversee wrote:Is there a way to break a loop of events? I have a layer moving up and down in a loop, and I want to have another event stop the movement and keep the layer still. If possible, I'd like to do this without LunaLua; but if there's no other way then of course will do.
I assume you already have your events set up to cause the movement and activate each other in an infinite loop. So, starting from there...
1. Create two new layers. Name them whatever you want, but I'll refer to them as 'Layer X' and 'Layer Y' here.
2. Create two new events (I'll call them 'Event X' and 'Event Y'.) Event X should show Layer X. Event Y should show Layer Y.
3. Open the two events that you use to cause the movement. Cause one of the events to hide Layer X
and trigger Event Y
, while the other hides Layer Y
and triggers Event X
. Change the Delay to 0.1 seconds (not instant.) Whatever the delay had previously been set to will be plugged back into something else in step 5. Anyway, while you're editing these events, make sure you click the 'No Smoke' box at the top of the event editor.
4. Select an NPC in the NPC window. It doesn't matter which. In the top right corner of the events menu is 'Events: Show'. Open that menu and select one of your two layer movement events in the 'Activate' drop down menu.
5. Just to the left of 'Events: Show' button is the 'Generator: Show' button. Open that menu and turn this NPC into a generator. Set the delay timer to whatever the delay had previously been for your layer movement events.
6. Now open the layers menu. If the NPC you're working with activates the event that hides Layer X, then select Layer X and place the generator someplace where nothing can block it from generating its NPC. Create copies of this generator throughout the area that you want the layers to move. Make sure that all of the copies are on the same layer.
7. Once those generators have been placed, open up the 'Events: Show' menu and select your other movement event. Open the layers menu and select the other layer. Now place copies of this generator throughout the area with moving layers.
8. Hide both of the layers, and when you test the level it should behave basically the same as it did before you took any of these steps. The bad news is that your layer movements can now be messed up if the player ever enters an area that doesn't have any unblocked generators. The good news is that you can easily disable the layer movement with the next step.
9. Create an event (I'll call this one 'Halt 1') that causes the moving layer to stop moving and hides both Layer X and Layer Y. Set the event to be triggered whenever you want the layers to stop moving.
10. If you want to be extra sure that the layers stop moving, create another event (I'll call it 'Halt 2') that stops the layer from moving and hides the two layers. Cause the Halt 1 to trigger this event with a 0.2 second delay.
How this works: As soon as the generator starts to create an NPC, the 'Activate' event will fire. This will hide the layer that is generating the NPC. Since the NPC hasn't fully initialized, it will disappear before the player even sees it, but not before causing the layer to move. 0.1 seconds later, the other layer will become active. That layer will eventually spawn an NPC that will likewise vanish before being seen by the player, but after causing the moving layer to change direction.
When both layers are hidden, the NPCs will no longer spawn, so the events that cause the layer to move will no longer be triggered. There can be a problem if Halt 1 activates during the 0.1 seconds after one layer has been hidden, but before the other layer has been shown. But if you follow step 10, that problem will be cleared up 0.2 seconds later.
Quiversee wrote:Also, how do you allow the Lava Lotus pollen to spawn by itself via generator?
The pollen is in a hidden category. It'd be easy to access if you had the PGE editor, but since it's not working for you, this tutorial
should help you access the category in the normal editor.
Quiversee wrote:How do you get a friendly NPC to spawn inside a "?" block? Ideally, one that could activate an event.
The best non-lua solution I can think of is going to be slightly wonky, but should work.
1. Create a new layer. I'll call this one 'Friend Layer.'
2. Create a new event that causes Friend Layer to show.
3. Open the blocks and tiles menu and select the ? block you want to use. The content should be a single coin. You might consider using the large ? block if the NPC is larger than the small ? block.
4. In the bottom of the Blocks and Tiles menu is 'Events: Show.' Open that menu, and in the 'Hit' drop down menu select the event you just created.
5. Make your friendly NPC a generator and set it on top of the ? block. Make sure the friendly NPC is in Friend Layer.
6. Hide Friend Layer.
If the NPC moves, you may need to take extra steps to prevent the NPC from infinitely spawning, but leaving the generator on permanently shouldn't be a problem as long as the NPC stands still.