- Joined
- Oct 23, 2021
- Messages
- 688
- Reaction score
- 906
- First Language
- Finnish
- Primarily Uses
- RMMZ
Tutorial Title:
Portal Gun
Brief description:
Creating a portal gun that allows player and event teleportation between two different portals (from blue to red). The portals are meant to appear only next to select objects, but you could modify this to make them appear in wider locations.
Requirements:
RPG Maker MZ, VisuStella events and movement core (or other event spawner)
Tutorial body:
You need 3 events for this. The one controlling your shots and two for the different colored portals. The portal events are on a different map where they are spawned from by the event spawner plugin. I have also set up regions on the map to set boundaries where the projectiles will vanish and also to check on what objects the projectiles will form a portal depending on player direction. There are different ways you can set up the event pages and how to control the movement of the projectiles. Below I'm giving an example you can modify.
The events are using the script $gameMap.lastSpawnedEventID() to get the event IDs of the blue and red portals. Also at the start I have put into variables the current map ID and also the number of original events on the map [$gameMap.events().length]
VIDEO:
GUN EVENT:
The gun event is a parallel event, where by pressing a key, it will spawn a blue or red portal event from a map defined in the plugin parameters. The event IDs for blue and red portal are stored in separate variables. In the example variables for player direction and the existance of the portals are also defined. The gun event will also always despawn the earlier portal event, since we only want one of each to exist.
If the spawn is successful, there is a script call to start the event page of the spawned portal. In my event I'm also turning on a switch to control that the player has to wait for the portal shot to finish, before they can act again.
BLUE PORTAL EVENT:
The shots will loop to move forward and check what region they are in. Based on what region they are in they will either despawn or switch to their page 2 if a portal can form in that place. Here I've set up different regions depending on what direction the shot is coming from.
On their second page the portal is a player touch event that checks if a red portal exists and it also checks if there are events blocking the red portal exit. It does that by comparing the event ID on the red portal to the highest original event ID on the map. If the red portal exists and is not blocked, the player will be teleported there (you can also play an animation there).
RED PORTAL EVENT:
This is basically the same as the blue portal event. Their page 2 doesn't have to run any checks though, since it's the exit place. I've set up the player to jump in place if they step on the red portal.
TELEPORTABLE EVENTS:
This is an example of a movable an teleportable event. If will compare location variables and if it's pushed onto a blue portal it will check for the existence of the red portal and also that the red portal isn't blocked (as explained above). If everything is fine, it will play an animation and transfer this event to the red portal location.
Tags:
RPG Maker MZ Portal Gun Puzzle
Portal Gun
Brief description:
Creating a portal gun that allows player and event teleportation between two different portals (from blue to red). The portals are meant to appear only next to select objects, but you could modify this to make them appear in wider locations.
Requirements:
RPG Maker MZ, VisuStella events and movement core (or other event spawner)
Tutorial body:
You need 3 events for this. The one controlling your shots and two for the different colored portals. The portal events are on a different map where they are spawned from by the event spawner plugin. I have also set up regions on the map to set boundaries where the projectiles will vanish and also to check on what objects the projectiles will form a portal depending on player direction. There are different ways you can set up the event pages and how to control the movement of the projectiles. Below I'm giving an example you can modify.
The events are using the script $gameMap.lastSpawnedEventID() to get the event IDs of the blue and red portals. Also at the start I have put into variables the current map ID and also the number of original events on the map [$gameMap.events().length]
VIDEO:
GUN EVENT:
The gun event is a parallel event, where by pressing a key, it will spawn a blue or red portal event from a map defined in the plugin parameters. The event IDs for blue and red portal are stored in separate variables. In the example variables for player direction and the existance of the portals are also defined. The gun event will also always despawn the earlier portal event, since we only want one of each to exist.
If the spawn is successful, there is a script call to start the event page of the spawned portal. In my event I'm also turning on a switch to control that the player has to wait for the portal shot to finish, before they can act again.
BLUE PORTAL EVENT:
The shots will loop to move forward and check what region they are in. Based on what region they are in they will either despawn or switch to their page 2 if a portal can form in that place. Here I've set up different regions depending on what direction the shot is coming from.
On their second page the portal is a player touch event that checks if a red portal exists and it also checks if there are events blocking the red portal exit. It does that by comparing the event ID on the red portal to the highest original event ID on the map. If the red portal exists and is not blocked, the player will be teleported there (you can also play an animation there).
RED PORTAL EVENT:
This is basically the same as the blue portal event. Their page 2 doesn't have to run any checks though, since it's the exit place. I've set up the player to jump in place if they step on the red portal.
TELEPORTABLE EVENTS:
This is an example of a movable an teleportable event. If will compare location variables and if it's pushed onto a blue portal it will check for the existence of the red portal and also that the red portal isn't blocked (as explained above). If everything is fine, it will play an animation and transfer this event to the red portal location.
Tags:
RPG Maker MZ Portal Gun Puzzle
Last edited: