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

[转载发布] Easy Teleport Script Redux

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-2 07:07:05 | 显示全部楼层 |阅读模式
    This is actually utilizing Balrogic's "easy teleport" so all credit for the base product is due thereof. What this post is for compared to the other is two things:

    • For the avoidance of doubt (and because the last word on the subject was in 2015) I am posting this separately, both to analyze the support request cliffhanger (an unresolved cancel crash) and to differentiate accordingly; and
    • The inclusion of a very useful modification that I don't know if anyone has ever considered before, and one which is basically genre-standard by now so I was thinking like "what the hell" and put it in.
    On the first point, what I mean by cancel crash is just that: it crashes the game if you cancel the request. On the other, I have given thought to add a twist of my own. I'm using the script as a hyperwarp function in my own project and noticed that it doesn't have built-in handling for vehicular transport (e.g. ship teleport to dock near your destination upon arrival). I am therefore 1: requesting analysis of the script call that crashes on cancel, and 2: posting with my additions in case they are of use to anyone.

    First, add this "between materials and main" (or "yanfly and main" if you're using ace message, ace save, etc.)

    Spoiler                Code:       
    1. # Easy Teleport 1.0c by Balrogic (with BreakerZero ship warp extension)
    2. =begin
    3. This script enables a very simple teleportation system that
    4. requires minimal configuration by you, the game developer.
    5. There are two teleport lists. Both can be used at the same
    6. time if you feel like it. One is unsorted and adds locations
    7. to the list in the same order they are added. The other needs
    8. to be told which location belongs where in the list. Both lists
    9. automatically set the new location equal to the current map's
    10. display name and the player's location. You can override this
    11. behavior if you so choose by adding arguments when you call
    12. the method.
    13. To add a location to the unsorted list put this in a script call.
    14. I like making the player step on an event set to event touch.
    15. Balrogic::Teleport::nosetup
    16. To add a location to the sorted list put this in a script call.
    17. Replace 0 with whatever sorting number you want for that location.
    18. Balrogic::Teleport::somesetup(0)
    19. For finer control, include as many of the following arguments as
    20. you want.
    21. For direction, 0 is retain. 2 is down. 4 is left. 6 is right. 8 is up.
    22. Balrogic::Teleport::nosetup("name", map_id, x, y, direction)
    23. Balrogic::Teleport::somesetup(sorting, "name", map_id, x, y, direction)
    24. To access the teleport list put the following in a script call.
    25. For the unsorted list:
    26. Balrogic::Teleport::unsorted
    27. For the sorted list:
    28. Balrogic::Teleport::sorted
    29. To disable access to teleportation, use script call below.
    30. Balrogic::Teleport::disable
    31. To re-enable:
    32. Balrogic::Teleport::enable
    33. For the breaker zero vehicular warp addition there is some required setup.
    34. Once configured, use a pair of common event calls to ensure proper behaviour.
    35. Note that when configured properly the teleport will crossfade to black several
    36. times during the process when cast at sea or in the sky. There's nothing to be
    37. done about this, however I don't give two dimes about it due to the intent of
    38. the script so consider it an added bonus for the purpose of visual effect.
    39. Note also that commercial use is permitted with the proper credit.
    40. =end
    41. module Balrogic   # Module 1
    42.   module Teleport # Module 2
    43. # Configuration - Comment out anything you don't want to use.
    44. # Display message when selecting teleport destination.
    45.   @destination = "Please select your destination."
    46. # Message to show when you don't know any destinations.
    47.   @nodestination = "You don't know where to go!"
    48. # Message to show when teleportation is disabled.
    49.   @disabled = "Can't warp from here..."
    50. # Sound effect to play on teleportation.
    51.   @sound = Proc.new {
    52.   RPG::SE.new("Teleport", 100, 100).play # Sound name, volume and pitch.
    53.   } # Leave this alone.
    54. # Transition effect. 0 is default black, 1 is white, 2 for none.
    55.   @transition = Proc.new {
    56.   $game_temp.fade_type = 1
    57.   } # Leave this alone too.
    58. # Setup continues at line 107 for the ship warp. Don't change anything else.
    59.   def self.unsorted
    60.     $game_self_switches[[:balrogic, :teleport, :override]] = true
    61.     if $game_self_switches[[:balrogic, :teleport, :disabled]]
    62.       $game_message.add(@disabled) if @disabled
    63.       $game_self_switches[[:balrogic, :teleport, :override]] = nil
    64.     else
    65.       if $game_self_switches[[:balrogic, :teleport]]
    66.         $game_message.choice_cancel_type = 999999999999
    67.         $game_self_switches[[:balrogic, :teleport]].each{ |x|
    68.           $game_message.choices << x[0]
    69.           }
    70.         $game_message.choice_proc = Proc.new { |x|
    71.           $game_player.reserve_transfer($game_self_switches[[:balrogic, :teleport]][x][1], $game_self_switches[[:balrogic, :teleport]][x][2], $game_self_switches[[:balrogic, :teleport]][x][3], $game_self_switches[[:balrogic, :teleport]][x][4])
    72.           #---------------------------------------------------------------------
    73.           #This line begins control variable setup. Ship and airship have been
    74.           #predefined, but you can substitute the boat for one or the other (or
    75.           #add another definition thereof if you so choose).
    76.           #Change only the number for $game_variables to whichever ones are to.
    77.           #be used - the other side defines the control point from the list of
    78.           #destinations that will be stored accordingly.
    79.           #---------------------------------------------------------------------
    80.           $game_variables[75]=$game_self_switches[[:balrogic, :teleport]][x][2]
    81.           $game_variables[76]=$game_self_switches[[:balrogic, :teleport]][x][3]
    82.           $game_variables[79]=$game_self_switches[[:balrogic, :teleport]][x][5]
    83.           $game_variables[80]=$game_self_switches[[:balrogic, :teleport]][x][6]
    84.           $game_variables[77]=$game_self_switches[[:balrogic, :teleport]][x][7]
    85.           $game_variables[78]=$game_self_switches[[:balrogic, :teleport]][x][8]
    86.           #---------------------------------------------------------------------
    87.           #Do not change anything in the next definitions block.
    88.           #Control Variable setup continues at line 150.
    89.           #---------------------------------------------------------------------
    90.           Balrogic::Teleport::configuration
    91.           }
    92.         $game_message.add(@destination) if @destination
    93.       else
    94.         $game_message.add(@nodestination) if @nodestination
    95.         $game_self_switches[[:balrogic, :teleport, :override]] = nil
    96.       end
    97.     end
    98.   end
    99.   def self.sorted
    100.     $game_self_switches[[:balrogic, :teleport, :override]] = true
    101.     if $game_self_switches[[:balrogic, :teleport, :disabled]]
    102.       $game_message.add(@disabled) if @disabled
    103.       $game_self_switches[[:balrogic, :teleport, :override]] = nil
    104.     else
    105.       if $game_self_switches[[:balrogic, :teleport_manual]]
    106.         $game_message.choice_cancel_type = 999999999999
    107.         @sorted_list = []
    108.         $game_self_switches[[:balrogic, :teleport_manual]].each{ |x|
    109.           @sorted_list << x if x
    110.           }
    111.         @sorted_list.each{ |x|
    112.           $game_message.choices << x[0]
    113.           }
    114.         $game_message.choice_proc = Proc.new { |x|
    115.           $game_player.reserve_transfer(@sorted_list[x][1], @sorted_list[x][2], @sorted_list[x][3], @sorted_list[x][4])
    116.           #---------------------------------------------------------------------
    117.           #You can change control variable use here as well, even if separate
    118.           #from those used for unsorted warp calls.
    119.           #Again, change only the number for $game_variables or you'll brick
    120.           #your game.
    121.           #---------------------------------------------------------------------
    122.           $game_variables[75]=@sorted_list[x][2]
    123.           $game_variables[76]=@sorted_list[x][3]
    124.           $game_variables[79]=@sorted_list[x][5]
    125.           $game_variables[80]=@sorted_list[x][6]
    126.           $game_variables[77]=@sorted_list[x][7]
    127.           $game_variables[78]=@sorted_list[x][8]
    128.           #---------------------------------------------------------------------
    129.           #This line ends all user setup - do not change anything from here on.
    130.           #---------------------------------------------------------------------
    131.           Balrogic::Teleport::configuration
    132.           }
    133.         $game_message.add(@destination) if @destination
    134.       else
    135.         $game_message.add(@nodestination) if @nodestination
    136.         $game_self_switches[[:balrogic, :teleport, :override]] = nil
    137.       end
    138.     end
    139.   end
    140.   def self.nosetup(name=$game_map.display_name, map=$game_map.map_id, x=$game_player.x, y=$game_player.y, dir=2, sx=$shipX, sy=$shipY, ax=$airX, ay=$airY)
    141.     $game_self_switches[[:balrogic, :teleport]] ||= []
    142.     $game_self_switches[[:balrogic, :teleport]] << [name, map, x, y, dir]
    143.   end
    144.   def self.somesetup(sort, name=$game_map.display_name, map=$game_map.map_id, x=$game_player.x, y=$game_player.y, dir=2, sx=$shipX, sy=$shipY, ax=$airX, ay=$airY)
    145.     $game_self_switches[[:balrogic, :teleport_manual]] ||= []
    146.     $game_self_switches[[:balrogic, :teleport_manual]][sort] = [name, map, x, y, dir, sx, sy, ax, ay]
    147.   end
    148.   def self.disable
    149.     $game_self_switches[[:balrogic, :teleport, :disabled]] = true
    150.   end
    151.   def self.enable
    152.     $game_self_switches[[:balrogic, :teleport, :disabled]] = nil
    153.   end
    154.   def self.configuration
    155.     @transition.call if @transition
    156.     @sound.call if @sound
    157.     $game_self_switches[[:balrogic, :teleport, :override]] = nil
    158.   end
    159.   def self.update
    160.     $game_self_switches[[:balrogic, :teleport]] = $game_self_switches["Balrogic Teleport"] if $game_self_switches["Balrogic Teleport"]
    161.     $game_self_switches[[:balrogic, :teleport_manual]] = $game_self_switches["Balrogic Teleport Manual"] if $game_self_switches["Balrogic Teleport Manual"]
    162.     $game_self_switches[[:balrogic, :teleport, :disabled]] = $game_self_switches["Balrogic Teleport Disabled"] if $game_self_switches["Balrogic Teleport Disabled"]
    163.     $game_self_switches["Balrogic Teleport"] = nil
    164.     $game_self_switches["Balrogic Teleport Manual"] = nil
    165.     $game_self_switches["Balrogic Teleport Disabled"] = nil
    166.   end
    167.   end # Module 2
    168. end   # Module 1
    169. class Window_ChoiceList < Window_Command
    170.   alias balrogic_old_update_placement update_placement
    171.   def update_placement
    172.     if $game_self_switches[[:balrogic, :teleport, :override]]
    173.       self.width = [max_choice_width + 12, 96].max + padding * 2
    174.       self.width = [width, Graphics.width].min
    175.       self.height = fitting_height($game_message.choices.size) if $game_message.choices.size <= 8
    176.       self.height = fitting_height(8) if $game_message.choices.size >= 9
    177.       self.x = Graphics.width - width
    178.       if @message_window.y >= Graphics.height / 2
    179.         self.y = @message_window.y - height
    180.       else
    181.         self.y = @message_window.y + @message_window.height
    182.       end
    183.     else
    184.       balrogic_old_update_placement
    185.     end
    186.   end
    187. end
    188. class Game_SelfSwitches
    189.   def [](key)
    190.     @data[key] || false
    191.   end
    192. end
    复制代码






    Once that's done, go into the database and create this common event:

    Spoiler






    Then create a second entry in common events that looks like this:

    Spoiler






    Finally you should assign the hyperwarp base accordingly:

    Spoiler






    Again, the cancel crash is a holdover from the base script and therefore I could use some extra analysis to figure out what the hell is going on that does it. Furthermore, since the base product is unrestricted then so is my extended interpretation (commercial or otherwise).

    EDIT: In case it helps, the problematic call is at line 86 in the original script (or 96 in my extended version).

    EDIT 2: This is also not the high priority it originally was regarding the bugfix as I have recently transitioned all project development to MV. However, I'm keeping the analysis request out there for anyone who can still use it.


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-18 07:55 , Processed in 0.119346 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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