虽然小弟我勉强能看懂F1帮助文档所有的脚本啦,但唯独制作传送物品这个脚本一直看不懂(如果大家有其他脚本入门实践篇的问题的话,我也能尽力解决啦
)
虽然本人对脚本不是太懂,可我已经尽力按照手册上的方法做了,但是还是没有成功实现传送物品的效果—在包含城镇等地点的菜单中选择任意地点之后选择物品进行传送一次
class Window_Teleport < Window_Command def initialize super(0, 0) hide deactivate end end def window_width return 240 end def window_height Graphics.height end TELEPORT_PLACES = [ [2, "草地2", 2, 7, 7], [3, "草地3", 3, 7, 7], [4, "草地4", 4, 7, 7], ] def make_command_list TELEPORT_PLACES.each do |place| if $game_switches[place[0]] add_command(place[1], :teleport, true, place) end end end class Scene_ItemBase alias xxx001_start start def start xxx001_start @teleport_window = Window_Teleport.new @teleport_window.set_handler(:teleport, method(:on_teleport)) @teleport_window.set_handler(:cancel, method(:on_teleport_cancel)) end alias xxx001_determine_item determine_item def determine_item if item.note.include?("<TELEPORT>") show_sub_window(@teleport_window) end else xxx001_determine_item end end def on_teleport place = @teleport_window.current_ext $game_player.reserve_transfer(place[2], place[3], place[4]) SceneManager.goto(Scene_Map) end def on_teleport_cancel hide_sub_window(@teleport_window) end
結果.png (406.66 KB, 下载次数: 53)
失败的结果
1.43 MB, 下载次数: 103
试验范例
喵呜喵5 发表于 2017-4-18 23:01
允许传送的开关打开了吗?
魔法丶小肉包 发表于 2017-4-19 16:01
从上往下数第二个end去掉,然后在
if $game_switches]
add_command(place[1], :teleport, true, pl ...
| 欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |