赞 | 1 |
VIP | 10 |
好人卡 | 0 |
积分 | 1 |
经验 | 68279 |
最后登录 | 2021-10-20 |
在线时间 | 232 小时 |
Lv1.梦旅人 青天
- 梦石
- 0
- 星屑
- 86
- 在线时间
- 232 小时
- 注册时间
- 2007-12-15
- 帖子
- 2091
|
事件-并行处理-条件分歧-当XXXX键按下时-呼叫存档或者菜单画面
这是最简单的
如果想要多呼叫几个其他菜单的脚本
- #==============================================================================
- # ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
- #==============================================================================
- #==============================================================================
- # 菜单快捷键 by Claimh
- #------------------------------------------------------------------------------
- # http://www.k3.dion.ne.jp/~claimh/
- #==============================================================================
- module SHORTCUT
- USE_ITEM_SHORT = true #——开启物品菜单快捷键
- USE_SKILL_SHORT = true #——开启特技菜单快捷键
- USE_EQUIP_SHORT = true #——开启装备菜单快捷键
- USE_SAVE_SHORT = true #——开启储存菜单快捷键
- CHANGE_ITEM = Input::X #——物品快捷键的键位
- CHANGE_SKILL = Input::Y #——特技快捷键的键位
- CHANGE_EQUIP = Input::Z #——装备快捷键的键位
- CHANGE_SAVE = Input::A #——储存快捷键的键位
- #----------------------------------------------------------------------------
- #----------------------------------------------------------------------------
- end
- #==============================================================================
- # Scene_Map
- #==============================================================================
- class Scene_Map
- include SHORTCUT
- alias update_short update
- def update
- update_short
- menu_shortcut
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def menu_shortcut
- if Input.trigger?(CHANGE_ITEM) and USE_ITEM_SHORT
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- $item_short = true
- call_item
- end
- end
- if Input.trigger?(CHANGE_SKILL) and USE_SKILL_SHORT
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- $skill_short = true
- call_skill
- end
- end
- if Input.trigger?(CHANGE_EQUIP) and USE_EQUIP_SHORT
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- $equip_short = true
- call_equip
- end
- end
- if Input.trigger?(CHANGE_SAVE) and USE_SAVE_SHORT
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- $save_short = true
- call_save
- end
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def call_item
- $game_temp.menu_calling = false
- if $game_temp.menu_beep
- $game_system.se_play($data_system.decision_se)
- $game_temp.menu_beep = false
- end
- $game_player.straighten
- $scene = Scene_Item.new
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def call_skill
- $game_temp.menu_calling = false
- if $game_temp.menu_beep
- $game_system.se_play($data_system.decision_se)
- $game_temp.menu_beep = false
- end
- $game_player.straighten
- $scene = Scene_Skill.new
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def call_equip
- $game_temp.menu_calling = false
- if $game_temp.menu_beep
- $game_system.se_play($data_system.decision_se)
- $game_temp.menu_beep = false
- end
- $game_player.straighten
- $scene = Scene_Equip.new
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def call_save
- $game_temp.menu_calling = false
- if $game_temp.menu_beep
- $game_system.se_play($data_system.decision_se)
- $game_temp.menu_beep = false
- end
- $game_player.straighten
- $scene = Scene_Save.new
- end
- end
- #==============================================================================
- # Scene_Item
- #==============================================================================
- class Scene_Item
- alias update_item_short update_item
- def update_item
- if Input.trigger?(Input::B) and $item_short
- $item_short = false
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- update_item_short
- end
- end
- #==============================================================================
- # Scene_Skill
- #==============================================================================
- class Scene_Skill
- alias update_skill_short update_skill
- def update_skill
- if Input.trigger?(Input::B) and $skill_short
- $skill_short = false
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- update_skill_short
- end
- end
- #==============================================================================
- # Scene_Equip
- #==============================================================================
- class Scene_Equip
- alias update_equip_short update_right
- def update_right
- if Input.trigger?(Input::B) and $equip_short
- $equip_short = false
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- update_equip_short
- end
- end
- #==============================================================================
- # ■ Scene_Save
- #------------------------------------------------------------------------------
- # 处理存档画面的类。
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super("要保存到这个文件吗?")
- end
- #--------------------------------------------------------------------------
- # ● 确定时的处理
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # 演奏存档 SE
- $game_system.se_play($data_system.save_se)
- # 写入存档数据
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- # 如果被事件调用
- if $game_temp.save_calling
- # 清除存档调用标志
- $game_temp.save_calling = false
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- # 切换到菜单画面
- $scene = Scene_Menu.new(4)
- end
- #--------------------------------------------------------------------------
- # ● 取消时的处理
- #--------------------------------------------------------------------------
- def on_cancel
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 如果被事件调用
- if $game_temp.save_calling
- # 清除存档调用标志
- $game_temp.save_calling = false
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- # 切换到菜单画面
- $scene = Scene_Menu.new(4)
- end
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入用文件对像 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # 生成描绘存档文件用的角色图形
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- # 写入描绘存档文件用的角色数据
- Marshal.dump(characters, file)
- # 写入测量游戏时间用画面计数
- Marshal.dump(Graphics.frame_count, file)
- # 增加 1 次存档次数
- $game_system.save_count += 1
- # 保存魔法编号
- # (将编辑器保存的值以随机值替换)
- $game_system.magic_number = $data_system.magic_number
- # 写入各种游戏对像
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|