Portal Gun (teleport players/events between blue and red portal)

rpgLord69

Regular
Regular
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.

PortalGun1.png

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).

PortalGun2.png

PortalGun3.png

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.

PortalGun4.png

PortalGun5.png

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.

PortalGun6.png

Tags:
RPG Maker MZ Portal Gun Puzzle
 
Last edited:

rpgLord69

Regular
Regular
Joined
Oct 23, 2021
Messages
688
Reaction score
906
First Language
Finnish
Primarily Uses
RMMZ
Don't see why it wouldn't work in ACE. It does have event spawn plugins too. And anyway, you could just use on map events instead, with additional pages.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,231
Reaction score
3,504
First Language
Dutch
Primarily Uses
RMMV
this looks funny, but do you have a gif of the result?
so they know what they make?

I didn't read everything, but I assume you can shoot or set range of those
portals?

so you can increase it by powerups for example?
but nicely done though.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,231
Reaction score
3,504
First Language
Dutch
Primarily Uses
RMMV
well, that looks different than expected, so it looks like only the blue portal can port
you, but but is it always "blue first", than red? or assigned differently.

but this looks damn nice for a puzzle mechanic, thank you alot for making this
lovely tutorial :)
 

rpgLord69

Regular
Regular
Joined
Oct 23, 2021
Messages
688
Reaction score
906
First Language
Finnish
Primarily Uses
RMMZ
Yes, only the blue portal teleports you. The blue and red portal shots have different keys. In the example I'm using a plugin to use 'a' and 's' keys. But you can also use the basic keys RPG maker has programmed (though using page up/page down or something is kind of clumsy).
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,231
Reaction score
3,504
First Language
Dutch
Primarily Uses
RMMV
I save it, might replicate in MV project to make it work, MV dont have the keys
part, but have a plugin to use the entire keyboard buttons :)

I love puzzle games, so I might add this to my game if I get it work though :)
 

Latest Threads

Latest Profile Posts

Yknow what? Im seriously considering recruiting a manager to oversee my games development.
Because I cannot focus or complete these tasks by myself. I need someone to give me orders, without having them be my boss.
yp_4vS.png

Remember my latest plugin for rpg maker mz:

Acknowledgement Window is now available!

Take a look here:

Got my focus back, 9/59 maps have the door fix in place now.

Forum statistics

Threads
136,803
Messages
1,270,184
Members
180,558
Latest member
Kev03
Top