永发信息网

rpg制作大师VX商店脚本问题

答案:1  悬赏:0  手机版
解决时间 2021-11-10 00:29
  • 提问者网友:孤山下
  • 2021-11-09 14:30
rpg制作大师VX商店脚本问题
最佳答案
  • 五星知识达人网友:三千妖杀
  • 2021-11-09 14:37
抱歉....上一个看错了= = 脚本和范例游戏发到你的邮箱里了已经
  #==============================================================================
  # ■ Scene_Map
  #------------------------------------------------------------------------------
  # 处理地图画面的类。
  #==============================================================================

  class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
  super
  $game_map.refresh
  @spriteset = Spriteset_Map.new
  @message_window = Window_Message.new
  end
  #--------------------------------------------------------------------------
  # ● 执行渐变
  #--------------------------------------------------------------------------
  def perform_transition
  if Graphics.brightness == 0 # 战斗后或载入后等
  fadein(30)
  else # 从菜单中回来等
  Graphics.transition(15)
  end
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  def terminate
  super
  if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
  @spriteset.dispose_characters # 隐藏角色来生成战斗背景
  end
  snapshot_for_background
  @spriteset.dispose
  @message_window.dispose
  if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
  perform_battle_transition # 执行战斗渐变
  end
  end
  #--------------------------------------------------------------------------
  # ● 基本更新处理
  #--------------------------------------------------------------------------
  def update_basic
  Graphics.update # 更新游戏画面
  Input.update # 更新输入信息
  $game_map.update # 更新地图
  @spriteset.update # 更新活动块组
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
  super
  $game_map.interpreter.update # 更新解释器
  $game_map.update # 更新地图
  $game_player.update # 更新主角
  $game_system.update # 更新计时器
  @spriteset.update # 更新活动块组
  @message_window.update # 更新信息窗口
  unless $game_message.visible # 信息窗口显示中除外
  update_transfer_player
  update_encounter
  update_call_menu
  update_call_debug
  update_scene_change
  end
  end
  #--------------------------------------------------------------------------
  # ● 淡入画面
  # duration : 时间
  # 如果直接使用 Graphics.fadeout 的话会出现一些状况,如天候效果和远景
  # 滚动都会被强迫停止,所以用动态的 fade-in 效果会好些。
  #--------------------------------------------------------------------------
  def fadein(duration)
  Graphics.transition(0)
  for i in 0..duration-1
  Graphics.brightness = 255 * i / duration
  update_basic
  end
  Graphics.brightness = 255
  end
  #--------------------------------------------------------------------------
  # ● 淡出画面
  # duration : 时间
  # 与上面的 fadein 一样,不是直接调用 Graphics.fadein。
  #--------------------------------------------------------------------------
  def fadeout(duration)
  Graphics.transition(0)
  for i in 0..duration-1
  Graphics.brightness = 255 - 255 * i / duration
  update_basic
  end
  Graphics.brightness = 0
  end
  #--------------------------------------------------------------------------
  # ● 场所移动处理
  #--------------------------------------------------------------------------
  def update_transfer_player
  return unless $game_player.transfer?
  fade = (Graphics.brightness > 0)
  fadeout(30) if fade
  @spriteset.dispose # 释放活动块组
  $game_player.perform_transfer # 执行场所移动
  $game_map.autoplay # 自动更改 BGM 和 BGS
  $game_map.update
  Graphics.wait(15)
  @spriteset = Spriteset_Map.new # 重新生成活动块组
  fadein(30) if fade
  Input.update
  end
  #--------------------------------------------------------------------------
  # ● 遇敌处理
  #--------------------------------------------------------------------------
  def update_encounter
  return if $game_player.encounter_count > 0 # 检查步数
  return if $game_map.interpreter.running? # 判断是否有事件正在执行
  return if $game_system.encounter_disabled # 判断是否禁止遇敌
  troop_id = $game_player.make_encounter_troop_id # 判断敌人队伍
  return if $data_troops[troop_id] == nil # 判断队伍是否无效
  $game_troop.setup(troop_id)
  $game_troop.can_escape = true
  $game_temp.battle_proc = nil
  $game_temp.next_scene = "battle"
  preemptive_or_surprise
  end
  #--------------------------------------------------------------------------
  # ● 判断先下手或被偷袭
  #--------------------------------------------------------------------------
  def preemptive_or_surprise
  actors_agi = $game_party.average_agi
  enemies_agi = $game_troop.average_agi
  if actors_agi >= enemies_agi
  percent_preemptive = 5
  percent_surprise = 3
  else
  percent_preemptive = 3
  percent_surprise = 5
  end
  if rand(100) < percent_preemptive
  $game_troop.preemptive = true
  elsif rand(100) < percent_surprise
  $game_troop.surprise = true
  end
  end
  #--------------------------------------------------------------------------
  # ● 判断是否呼叫菜单(按下B键)
  #--------------------------------------------------------------------------
  def update_call_menu
  if Input.trigger?(Input::B)
  return if $game_map.interpreter.running? # 判断是否有事件正在执行
  return if $game_system.menu_disabled # 判断是否禁止菜单呼叫
  $game_temp.menu_beep = true # 设置音效标志
  $game_temp.next_scene = "menu"
  end
  end
  #--------------------------------------------------------------------------
  # ● 判断是否呼叫DEBUG场景(按下F9键)
  #--------------------------------------------------------------------------
  def update_call_debug
  if $TEST and Input.press?(Input::F9) # 游戏测试并按下F9
  $game_temp.next_scene = "debug"
  end
  end
  #--------------------------------------------------------------------------
  # ● 执行场景交替
  #--------------------------------------------------------------------------
  def update_scene_change
  return if $game_player.moving? # 判断主角是否移动中
  case $game_temp.next_scene
  when "battle"
  call_battle
  when "shop"
  call_shop
  when "name"
  call_name
  when "menu"
  call_menu
  when "save"
  call_save
  when "debug"
  call_debug
  when "gameover"
  call_gameover
  when "title"
  call_title
  else
  $game_temp.next_scene = nil
  end
  end
  #--------------------------------------------------------------------------
  # ● 切换至战斗画面
  #--------------------------------------------------------------------------
  def call_battle
  @spriteset.update
  Graphics.update
  $game_player.make_encounter_count
  $game_player.straighten
  $game_temp.map_bgm = RPG::BGM.last
  $game_temp.map_bgs = RPG::BGS.last
  RPG::BGM.stop
  RPG::BGS.stop
  Sound.play_battle_start
  $game_system.battle_bgm.play
  $game_temp.next_scene = nil
  $scene = Scene_Battle.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至商店画面
  #--------------------------------------------------------------------------
  def call_shop
  $game_temp.next_scene = nil
  $scene = Scene_Shop.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至名称输入画面
  #--------------------------------------------------------------------------
  def call_name
  $game_temp.next_scene = nil
  $scene = Scene_Name.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至菜单画面
  #--------------------------------------------------------------------------
  def call_menu
  if $game_temp.menu_beep
  Sound.play_decision
  $game_temp.menu_beep = false
  end
  $game_temp.next_scene = nil
  $scene = Scene_Menu.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至存档画面
  #--------------------------------------------------------------------------
  def call_save
  $game_temp.next_scene = nil
  $scene = Scene_File.new(true, false, true)
  end
  #--------------------------------------------------------------------------
  # ● 切换至DEBUG画面
  #--------------------------------------------------------------------------
  def call_debug
  Sound.play_decision
  $game_temp.next_scene = nil
  $scene = Scene_Debug.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至游戏结束画面
  #--------------------------------------------------------------------------
  def call_gameover
  $game_temp.next_scene = nil
  $scene = Scene_Gameover.new
  end
  #--------------------------------------------------------------------------
  # ● 切换至标题画面
  #--------------------------------------------------------------------------
  def call_title
  $game_temp.next_scene = nil
  $scene = Scene_Title.new
  fadeout(60)
  end
  #--------------------------------------------------------------------------
  # ● 执行战斗渐变
  #--------------------------------------------------------------------------
  def perform_battle_transition
  Graphics.transition(80, "Graphics/System/BattleStart", 80)
  Graphics.freeze
  end
  end
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯