设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 80|回复: 0

[制作教程] Portal Gun (teleport players/events between blue and red portal)

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4609

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23225
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28728

    灌水之王

    发表于 2026-7-8 07:34:18 | 显示全部楼层 |阅读模式
    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:
    Spoiler
    https://www.youtube.com/embed/vyvImhknzS8





    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.

    Spoiler






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

    Spoiler










    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.

    Spoiler










    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.

    Spoiler






    Tags:
    RPG Maker MZ Portal Gun Puzzle


    本贴来自国际rpgmaker官方论坛作者:rpgLord69处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/portal-gun-teleport-players-events-between-blue-and-red-portal.161645/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-16 17:25 , Processed in 0.142474 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表