累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
58883
OK点
16
推广点
0
同能卷
50
积分 68848
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:
# Easy Teleport 1.0c by Balrogic (with BreakerZero ship warp extension) =begin This script enables a very simple teleportation system that requires minimal configuration by you, the game developer. There are two teleport lists. Both can be used at the same time if you feel like it. One is unsorted and adds locations to the list in the same order they are added. The other needs to be told which location belongs where in the list. Both lists automatically set the new location equal to the current map's display name and the player's location. You can override this behavior if you so choose by adding arguments when you call the method. To add a location to the unsorted list put this in a script call. I like making the player step on an event set to event touch. Balrogic::Teleport::nosetup To add a location to the sorted list put this in a script call. Replace 0 with whatever sorting number you want for that location. Balrogic::Teleport::somesetup(0) For finer control, include as many of the following arguments as you want. For direction, 0 is retain. 2 is down. 4 is left. 6 is right. 8 is up. Balrogic::Teleport::nosetup("name", map_id, x, y, direction) Balrogic::Teleport::somesetup(sorting, "name", map_id, x, y, direction) To access the teleport list put the following in a script call. For the unsorted list: Balrogic::Teleport::unsorted For the sorted list: Balrogic::Teleport::sorted To disable access to teleportation, use script call below. Balrogic::Teleport::disable To re-enable: Balrogic::Teleport::enable For the breaker zero vehicular warp addition there is some required setup. Once configured, use a pair of common event calls to ensure proper behaviour. Note that when configured properly the teleport will crossfade to black several times during the process when cast at sea or in the sky. There's nothing to be done about this, however I don't give two dimes about it due to the intent of the script so consider it an added bonus for the purpose of visual effect. Note also that commercial use is permitted with the proper credit. =end module Balrogic # Module 1 module Teleport # Module 2 # Configuration - Comment out anything you don't want to use. # Display message when selecting teleport destination. @destination = "Please select your destination." # Message to show when you don't know any destinations. @nodestination = "You don't know where to go!" # Message to show when teleportation is disabled. @disabled = "Can't warp from here..." # Sound effect to play on teleportation. @sound = Proc.new { RPG::SE.new("Teleport", 100, 100).play # Sound name, volume and pitch. } # Leave this alone. # Transition effect. 0 is default black, 1 is white, 2 for none. @transition = Proc.new { $game_temp.fade_type = 1 } # Leave this alone too. # Setup continues at line 107 for the ship warp. Don't change anything else. def self.unsorted $game_self_switches[[:balrogic, :teleport, :override]] = true if $game_self_switches[[:balrogic, :teleport, :disabled]] $game_message.add(@disabled) if @disabled $game_self_switches[[:balrogic, :teleport, :override]] = nil else if $game_self_switches[[:balrogic, :teleport]] $game_message.choice_cancel_type = 999999999999 $game_self_switches[[:balrogic, :teleport]].each{ |x| $game_message.choices << x[0] } $game_message.choice_proc = Proc.new { |x| $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]) #--------------------------------------------------------------------- #This line begins control variable setup. Ship and airship have been #predefined, but you can substitute the boat for one or the other (or #add another definition thereof if you so choose). #Change only the number for $game_variables to whichever ones are to. #be used - the other side defines the control point from the list of #destinations that will be stored accordingly. #--------------------------------------------------------------------- $game_variables[75]=$game_self_switches[[:balrogic, :teleport]][x][2] $game_variables[76]=$game_self_switches[[:balrogic, :teleport]][x][3] $game_variables[79]=$game_self_switches[[:balrogic, :teleport]][x][5] $game_variables[80]=$game_self_switches[[:balrogic, :teleport]][x][6] $game_variables[77]=$game_self_switches[[:balrogic, :teleport]][x][7] $game_variables[78]=$game_self_switches[[:balrogic, :teleport]][x][8] #--------------------------------------------------------------------- #Do not change anything in the next definitions block. #Control Variable setup continues at line 150. #--------------------------------------------------------------------- Balrogic::Teleport::configuration } $game_message.add(@destination) if @destination else $game_message.add(@nodestination) if @nodestination $game_self_switches[[:balrogic, :teleport, :override]] = nil end end end def self.sorted $game_self_switches[[:balrogic, :teleport, :override]] = true if $game_self_switches[[:balrogic, :teleport, :disabled]] $game_message.add(@disabled) if @disabled $game_self_switches[[:balrogic, :teleport, :override]] = nil else if $game_self_switches[[:balrogic, :teleport_manual]] $game_message.choice_cancel_type = 999999999999 @sorted_list = [] $game_self_switches[[:balrogic, :teleport_manual]].each{ |x| @sorted_list << x if x } @sorted_list.each{ |x| $game_message.choices << x[0] } $game_message.choice_proc = Proc.new { |x| $game_player.reserve_transfer(@sorted_list[x][1], @sorted_list[x][2], @sorted_list[x][3], @sorted_list[x][4]) #--------------------------------------------------------------------- #You can change control variable use here as well, even if separate #from those used for unsorted warp calls. #Again, change only the number for $game_variables or you'll brick #your game. #--------------------------------------------------------------------- $game_variables[75]=@sorted_list[x][2] $game_variables[76]=@sorted_list[x][3] $game_variables[79]=@sorted_list[x][5] $game_variables[80]=@sorted_list[x][6] $game_variables[77]=@sorted_list[x][7] $game_variables[78]=@sorted_list[x][8] #--------------------------------------------------------------------- #This line ends all user setup - do not change anything from here on. #--------------------------------------------------------------------- Balrogic::Teleport::configuration } $game_message.add(@destination) if @destination else $game_message.add(@nodestination) if @nodestination $game_self_switches[[:balrogic, :teleport, :override]] = nil end end end 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) $game_self_switches[[:balrogic, :teleport]] ||= [] $game_self_switches[[:balrogic, :teleport]] << [name, map, x, y, dir] end 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) $game_self_switches[[:balrogic, :teleport_manual]] ||= [] $game_self_switches[[:balrogic, :teleport_manual]][sort] = [name, map, x, y, dir, sx, sy, ax, ay] end def self.disable $game_self_switches[[:balrogic, :teleport, :disabled]] = true end def self.enable $game_self_switches[[:balrogic, :teleport, :disabled]] = nil end def self.configuration @transition.call if @transition @sound.call if @sound $game_self_switches[[:balrogic, :teleport, :override]] = nil end def self.update $game_self_switches[[:balrogic, :teleport]] = $game_self_switches["Balrogic Teleport"] if $game_self_switches["Balrogic Teleport"] $game_self_switches[[:balrogic, :teleport_manual]] = $game_self_switches["Balrogic Teleport Manual"] if $game_self_switches["Balrogic Teleport Manual"] $game_self_switches[[:balrogic, :teleport, :disabled]] = $game_self_switches["Balrogic Teleport Disabled"] if $game_self_switches["Balrogic Teleport Disabled"] $game_self_switches["Balrogic Teleport"] = nil $game_self_switches["Balrogic Teleport Manual"] = nil $game_self_switches["Balrogic Teleport Disabled"] = nil end end # Module 2 end # Module 1 class Window_ChoiceList < Window_Command alias balrogic_old_update_placement update_placement def update_placement if $game_self_switches[[:balrogic, :teleport, :override]] self.width = [max_choice_width + 12, 96].max + padding * 2 self.width = [width, Graphics.width].min self.height = fitting_height($game_message.choices.size) if $game_message.choices.size <= 8 self.height = fitting_height(8) if $game_message.choices.size >= 9 self.x = Graphics.width - width if @message_window.y >= Graphics.height / 2 self.y = @message_window.y - height else self.y = @message_window.y + @message_window.height end else balrogic_old_update_placement end end end class Game_SelfSwitches def [](key) @data[key] || false end 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