设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2017|回复: 7
打印 上一主题 下一主题

[已经解决] 关于显示音乐名脚本有时出错的问题。。。

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
跳转到指定楼层
1
发表于 2018-4-27 12:46:40 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我用了一个显示音乐名的脚本。。。
然后发现在一定条件下会出错。。

第一个是在一个未设BGM的地图开始测试游戏,战斗结束会出错


第二个是,设置一个未设BGM的地图为角色初期位置。
读取以前的存档后,返回标题画面,开始新游戏,然后在哪个未设BGM的地图直接读取存档,会出错。

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
2
 楼主| 发表于 2018-4-27 12:47:12 | 只看该作者
Scene_Battle 1

  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 初始化战斗用的各种暂时数据
  12.     $game_temp.in_battle = true
  13.     $game_temp.battle_turn = 0
  14.     $game_temp.battle_event_flags.clear
  15.     $game_temp.battle_abort = false
  16.     $game_temp.battle_main_phase = false
  17.     $game_temp.battleback_name = $game_map.battleback_name
  18.     $game_temp.forcing_battler = nil
  19.     # 初始化战斗用事件解释器
  20.     $game_system.battle_interpreter.setup(nil, 0)
  21.     # 准备队伍
  22.     @troop_id = $game_temp.battle_troop_id
  23.     $game_troop.setup(@troop_id)
  24.     # 生成角色命令窗口
  25.     s1 = $data_system.words.attack
  26.     s2 = $data_system.words.skill
  27.     s3 = $data_system.words.guard
  28.     s4 = $data_system.words.item
  29.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  30.     @actor_command_window.y = 160
  31.     @actor_command_window.back_opacity = 160
  32.     @actor_command_window.active = false
  33.     @actor_command_window.visible = false
  34.     # 生成其它窗口
  35.     @party_command_window = Window_PartyCommand.new
  36.     @help_window = Window_Help.new
  37.     @help_window.back_opacity = 160
  38.     @help_window.visible = false
  39.     @status_window = Window_BattleStatus.new
  40.     @message_window = Window_Message.new
  41.     # 生成活动块
  42.     @spriteset = Spriteset_Battle.new
  43.     # 初始化等待计数
  44.     @wait_count = 0
  45.    ###########################################################################
  46.     if $game_system.playing_bgm != nil
  47.       $Name2 = $game_system.playing_bgm.name
  48.       @Music2 = Window_Music.new
  49.     end
  50.   ###########################################################################
  51. # 执行过渡
  52.    if $data_system.battle_transition == ""
  53.      Graphics.transition(20)
  54.    else
  55.       randtra = rand(19)
  56.   case randtra
  57.   when 0
  58.      Graphics.transition(40, "Graphics/Transitions/001-Blind01.png" )
  59.   when 1
  60.     Graphics.transition(40, "Graphics/Transitions/002-Blind02.png")
  61.   when 2
  62.     Graphics.transition(40, "Graphics/Transitions/003-Blind03.png" )
  63.   when 3
  64.     Graphics.transition(40, "Graphics/Transitions/004-Blind04.png" )
  65.   when 4
  66.     Graphics.transition(40, "Graphics/Transitions/005-Stripe01.png" )
  67.   when 5
  68.    Graphics.transition(40, "Graphics/Transitions/006-Stripe02.png")
  69.   when 6
  70.    Graphics.transition(40, "Graphics/Transitions/007-Line01.png")
  71.   when 7
  72.    Graphics.transition(40, "Graphics/Transitions/008-Line02.png")
  73.   when 8
  74.    Graphics.transition(40, "Graphics/Transitions/009-Random01.png")
  75.   when 9
  76.    Graphics.transition(40, "Graphics/Transitions/010-Random02.png")
  77.   when 10
  78.    Graphics.transition(40, "Graphics/Transitions/011-Random03.png")
  79.   when 11
  80.    Graphics.transition(40, "Graphics/Transitions/012-Random04.png")
  81.   when 12
  82.    Graphics.transition(40, "Graphics/Transitions/013-Square01.png")
  83.   when 13
  84.    Graphics.transition(40, "Graphics/Transitions/014-Square02.png")
  85.   when 14
  86.    Graphics.transition(40, "Graphics/Transitions/015-Diamond01.png")
  87.   when 15
  88.    Graphics.transition(40, "Graphics/Transitions/016-Diamond02.png")
  89.   when 16
  90.    Graphics.transition(40, "Graphics/Transitions/017-Brick01.png")
  91.   when 17
  92.    Graphics.transition(40, "Graphics/Transitions/018-Brick02.png")
  93.   when 18
  94.    Graphics.transition(40, "Graphics/Transitions/019-Whorl01.png")
  95.   when 19
  96.    Graphics.transition(40, "Graphics/Transitions/020-Flat01.png")
  97.    end  
  98.    end

  99.     # 开始自由战斗回合
  100.     start_phase1
  101.     # 主循环
  102.     loop do
  103.       # 刷新游戏画面
  104.       Graphics.update
  105.       # 刷新输入信息
  106.       Input.update
  107.       # 刷新画面
  108.       update
  109.   ###########################################################################
  110.     if $game_system.playing_bgm != nil#一号开关控制是否显示
  111.       if $game_system.playing_bgm.name != $Name2 and $game_system.playing_bgm.name != ""
  112.         if @Music2 != nil
  113.           @Music2.contents.clear
  114.         end
  115.         @Music2 = Window_Music.new
  116.         $Name2 = $game_system.playing_bgm.name
  117.       else
  118.               @Music2.y = 67
  119.          @Music2.update
  120.       end
  121.     end
  122.   ###########################################################################
  123.       # 如果画面切换的话就中断循环
  124.       if $scene != self
  125.         break
  126.       end
  127.     end
  128.     # 刷新地图
  129.     $game_map.refresh
  130.     # 准备过渡
  131.     Graphics.freeze
  132.     # 释放窗口
  133.     @actor_command_window.dispose
  134.     @party_command_window.dispose
  135.     @help_window.dispose
  136.     @status_window.dispose
  137.     @message_window.dispose
  138.     if @skill_window != nil
  139.       @skill_window.dispose
  140.     end
  141.     if @item_window != nil
  142.       @item_window.dispose
  143.     end
  144.     if @result_window != nil
  145.       @result_window.dispose
  146.     end
  147.     # 释放活动块
  148.     @spriteset.dispose
  149.     @Music2.dispose
  150.     # 标题画面切换中的情况
  151.     if $scene.is_a?(Scene_Title)
  152.       # 淡入淡出画面
  153.       Graphics.transition
  154.       Graphics.freeze
  155.     end
  156.     # 战斗测试或者游戏结束以外的画面切换中的情况
  157.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  158.       $scene = nil
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 胜负判定
  163.   #--------------------------------------------------------------------------
  164.   def judge
  165.     # 全灭判定是真、并且同伴人数为 0 的情况下
  166.     if $game_party.all_dead? or $game_party.actors.size == 0
  167.       # 允许失败的情况下
  168.       if $game_temp.battle_can_lose
  169.         # 还原为战斗开始前的 BGM
  170.         $game_system.bgm_play($game_temp.map_bgm)
  171.         # 战斗结束
  172.         battle_end(2)
  173.         # 返回 true
  174.         return true
  175.       end
  176.       # 设置游戏结束标志
  177.       $game_temp.gameover = true
  178.       # 返回 true
  179.       return true
  180.     end
  181.     # 如果存在任意 1 个敌人就返回 false
  182.     for enemy in $game_troop.enemies
  183.       if enemy.exist?
  184.         return false
  185.       end
  186.     end
  187.     # 开始结束战斗回合 (胜利)
  188.     start_phase5
  189.     # 返回 true
  190.     return true
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 战斗结束
  194.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  195.   #--------------------------------------------------------------------------
  196.   def battle_end(result)
  197.     # 清除战斗中标志
  198.     $game_temp.in_battle = false
  199.     # 清除全体同伴的行动
  200.     $game_party.clear_actions
  201.     # 解除战斗用状态
  202.     for actor in $game_party.actors
  203.       actor.remove_states_battle
  204.     end
  205.     # 清除敌人
  206.     $game_troop.enemies.clear
  207.     # 调用战斗返回
  208.     if $game_temp.battle_proc != nil
  209.       $game_temp.battle_proc.call(result)
  210.       $game_temp.battle_proc = nil
  211.     end
  212.     # 切换到地图画面
  213.     $scene = Scene_Map.new
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 设置战斗事件
  217.   #--------------------------------------------------------------------------
  218.   def setup_battle_event
  219.     # 正在执行战斗事件的情况下
  220.     if $game_system.battle_interpreter.running?
  221.       return
  222.     end
  223.     # 搜索全部页的战斗事件
  224.     for index in 0...$data_troops[@troop_id].pages.size
  225.       # 获取事件页
  226.       page = $data_troops[@troop_id].pages[index]
  227.       # 事件条件可以参考 c
  228.       c = page.condition
  229.       # 没有指定任何条件的情况下转到下一页
  230.       unless c.turn_valid or c.enemy_valid or
  231.              c.actor_valid or c.switch_valid
  232.         next
  233.       end
  234.       # 执行完毕的情况下转到下一页
  235.       if $game_temp.battle_event_flags[index]
  236.         next
  237.       end
  238.       # 确认回合条件
  239.       if c.turn_valid
  240.         n = $game_temp.battle_turn
  241.         a = c.turn_a
  242.         b = c.turn_b
  243.         if (b == 0 and n != a) or
  244.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  245.           next
  246.         end
  247.       end
  248.       # 确认敌人条件
  249.       if c.enemy_valid
  250.         enemy = $game_troop.enemies[c.enemy_index]
  251.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  252.           next
  253.         end
  254.       end
  255.       # 确认角色条件
  256.       if c.actor_valid
  257.         actor = $game_actors[c.actor_id]
  258.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  259.           next
  260.         end
  261.       end
  262.       # 确认开关条件
  263.       if c.switch_valid
  264.         if $game_switches[c.switch_id] == false
  265.           next
  266.         end
  267.       end
  268.       # 设置事件
  269.       $game_system.battle_interpreter.setup(page.list, 0)
  270.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  271.       if page.span <= 1
  272.         # 设置执行结束标志
  273.         $game_temp.battle_event_flags[index] = true
  274.       end
  275.       return
  276.     end
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● 刷新画面
  280.   #--------------------------------------------------------------------------
  281.   def update
  282.     # 执行战斗事件中的情况下
  283.     if $game_system.battle_interpreter.running?
  284.       # 刷新解释器
  285.       $game_system.battle_interpreter.update
  286.       # 强制行动的战斗者不存在的情况下
  287.       if $game_temp.forcing_battler == nil
  288.         # 执行战斗事件结束的情况下
  289.         unless $game_system.battle_interpreter.running?
  290.           # 继续战斗的情况下、再执行战斗事件的设置
  291.           unless judge
  292.             setup_battle_event
  293.           end
  294.         end
  295.         # 如果不是结束战斗回合的情况下
  296.         if @phase != 5
  297.         @status_window.refresh
  298.         end
  299.       end
  300.     end
  301.     # 系统 (计时器)、刷新画面
  302.     $game_system.update
  303.     $game_screen.update
  304.     # 计时器为 0 的情况下
  305.     if $game_system.timer_working and $game_system.timer == 0
  306.       # 中断战斗
  307.       $game_temp.battle_abort = true
  308.     end
  309.     # 刷新窗口
  310.     @help_window.update
  311.     @party_command_window.update
  312.     @actor_command_window.update
  313.     @status_window.update
  314.     @message_window.update
  315.     # 刷新活动块
  316.     @spriteset.update
  317.     # 处理过渡中的情况下
  318.     if $game_temp.transition_processing
  319.       # 清除处理过渡中标志
  320.       $game_temp.transition_processing = false
  321.       # 执行过渡
  322.       if $game_temp.transition_name == ""
  323.         Graphics.transition(20)
  324.       else
  325.         Graphics.transition(40, "Graphics/Transitions/" +
  326.           $game_temp.transition_name)
  327.       end
  328.     end
  329.     # 显示信息窗口中的情况下
  330.     if $game_temp.message_window_showing
  331.       return
  332.     end
  333.     # 显示效果中的情况下
  334.     if @spriteset.effect?
  335.       return
  336.     end
  337.     # 游戏结束的情况下
  338.     if $game_temp.gameover
  339.       # 切换到游戏结束画面
  340.       $scene = Scene_Gameover.new
  341.       return
  342.     end
  343.     # 返回标题画面的情况下
  344.     if $game_temp.to_title
  345.       # 切换到标题画面
  346.       $scene = Scene_Title.new
  347.       return
  348.     end
  349.     # 中断战斗的情况下
  350.     if $game_temp.battle_abort
  351.       # 还原为战斗前的 BGM
  352.       $game_system.bgm_play($game_temp.map_bgm)
  353.       # 战斗结束
  354.       battle_end(1)
  355.       return
  356.     end
  357.     # 等待中的情况下
  358.     if @wait_count > 0
  359.       # 减少等待计数
  360.       @wait_count -= 1
  361.       return
  362.     end
  363.     # 强制行动的角色存在、
  364.     # 并且战斗事件正在执行的情况下
  365.     if $game_temp.forcing_battler == nil and
  366.        $game_system.battle_interpreter.running?
  367.       return
  368.     end
  369.     # 回合分支
  370.     case @phase
  371.     when 1  # 自由战斗回合
  372.       update_phase1
  373.     when 2  # 同伴命令回合
  374.       update_phase2
  375.     when 3  # 角色命令回合
  376.       update_phase3
  377.     when 4  # 主回合
  378.       update_phase4
  379.     when 5  # 战斗结束回合
  380.       update_phase5
  381.     end
  382.   end
  383. end
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
3
 楼主| 发表于 2018-4-27 12:47:55 | 只看该作者
战斗不变BGM  Scene_Map
  1. #==============================================================================

  2. # ■ Scene_Map

  3. #------------------------------------------------------------------------------

  4. #  处理地图画面的类。

  5. #==============================================================================


  6. class Scene_Map

  7.   #--------------------------------------------------------------------------

  8.   # ● 主处理

  9.   #--------------------------------------------------------------------------

  10.   def main
  11.    ###########################################################################
  12.     if $game_system.playing_bgm != nil
  13.       $Name = $game_system.playing_bgm.name
  14.       @Music = Window_Music.new
  15.     end
  16.   ###########################################################################
  17.     # 生成活动块

  18.     @spriteset = Spriteset_Map.new

  19.     # 生成信息窗口

  20.     @message_window = Window_Message.new

  21.     # 执行过渡

  22.     Graphics.transition

  23.     # 主循环

  24.     loop do

  25.       # 刷新游戏画面

  26.       Graphics.update

  27.       # 刷新输入信息

  28.       Input.update

  29.       # 刷新画面

  30.       update

  31.       # 如果画面切换的话就中断循环

  32.       if $scene != self

  33.         break

  34.       end

  35.     end

  36.     # 准备过渡

  37.     Graphics.freeze

  38.     # 释放活动块

  39.     @spriteset.dispose

  40.     # 释放信息窗口
  41.      @message_window.dispose
  42.   ###########################################################################
  43.       if $game_system.playing_bgm != nil
  44.      @Music.dispose
  45.    end
  46.   
  47.   ###########################################################################

  48.     # 标题画面切换中的情况下

  49.     if $scene.is_a?(Scene_Title)

  50.       # 淡入淡出画面

  51.       Graphics.transition

  52.       Graphics.freeze

  53.     end

  54.   end

  55.   #--------------------------------------------------------------------------

  56.   # ● 刷新画面

  57.   #--------------------------------------------------------------------------

  58.   def update

  59.     # 循环

  60.     loop do

  61.       # 按照地图、实例、主角的顺序刷新

  62.       # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动

  63.       #  的机会的重要因素)

  64.       $game_map.update

  65.       $game_system.map_interpreter.update

  66.       $game_player.update

  67.       # 系统 (计时器)、画面刷新

  68.       $game_system.update

  69.       $game_screen.update

  70.       # 如果主角在场所移动中就中断循环

  71.       unless $game_temp.player_transferring

  72.         break

  73.       end

  74.       # 执行场所移动

  75.       transfer_player

  76.       # 处理过渡中的情况下、中断循环

  77.       if $game_temp.transition_processing

  78.         break

  79.       end

  80.     end

  81.     # 刷新活动块

  82.     @spriteset.update

  83.     # 刷新信息窗口

  84.     @message_window.update
  85.   ###########################################################################
  86.     if $game_system.playing_bgm != nil#一号开关控制是否显示
  87.       if $game_system.playing_bgm.name != $Name and $game_system.playing_bgm.name != ""
  88.         if @Music != nil
  89.           @Music.contents.clear
  90.         end
  91.         @Music = Window_Music.new
  92.         $Name = $game_system.playing_bgm.name
  93.       else
  94.          @Music.update
  95.       end
  96.     end
  97.   ###########################################################################

  98.     # 游戏结束的情况下

  99.     if $game_temp.gameover

  100.       # 切换的游戏结束画面

  101.       $scene = Scene_Gameover.new

  102.       return

  103.     end

  104.     # 返回标题画面的情况下

  105.     if $game_temp.to_title

  106.       # 切换到标题画面

  107.       $scene = Scene_Title.new

  108.       return

  109.     end

  110.     # 处理过渡中的情况下

  111.     if $game_temp.transition_processing

  112.       # 清除过渡处理中标志

  113.       $game_temp.transition_processing = false

  114.       # 执行过渡

  115.       if $game_temp.transition_name == ""

  116.         Graphics.transition(20)

  117.       else

  118.         Graphics.transition(40, "Graphics/Transitions/" +

  119.           $game_temp.transition_name)

  120.       end

  121.     end

  122.     # 显示信息窗口中的情况下

  123.     if $game_temp.message_window_showing

  124.       return

  125.     end

  126.     # 遇敌计数为 0 且、且遇敌列表不为空的情况下

  127.     if $game_player.encounter_count == 0 and $game_map.encounter_list != []

  128.       # 不是在事件执行中或者禁止遇敌中

  129.       unless $game_system.map_interpreter.running? or

  130.              $game_system.encounter_disabled

  131.         # 确定队伍

  132.         n = rand($game_map.encounter_list.size)

  133.         troop_id = $game_map.encounter_list[n]

  134.         # 队伍有效的话

  135.         if $data_troops[troop_id] != nil

  136.           # 设置调用战斗标志

  137.           $game_temp.battle_calling = true

  138.           $game_temp.battle_troop_id = troop_id

  139.           $game_temp.battle_can_escape = true

  140.           $game_temp.battle_can_lose = false

  141.           $game_temp.battle_proc = nil

  142.         end

  143.       end

  144.     end

  145.     # 按下 B 键的情况下

  146.     if Input.trigger?(Input::B)

  147.       # 不是在事件执行中或菜单禁止中

  148.       unless $game_system.map_interpreter.running? or

  149.              $game_system.menu_disabled

  150.         # 设置菜单调用标志以及 SE 演奏

  151.         $game_temp.menu_calling = true

  152.         $game_temp.menu_beep = true

  153.       end

  154.     end

  155.     # 调试模式为 ON 并且按下 F9 键的情况下

  156.     if $DEBUG and Input.press?(Input::F9)

  157.       # 设置调用调试标志

  158.       $game_temp.debug_calling = true

  159.     end

  160.     # 不在主角移动中的情况下

  161.     unless $game_player.moving?

  162.       # 执行各种画面的调用

  163.       if $game_temp.battle_calling

  164.         call_battle

  165.       elsif $game_temp.shop_calling

  166.         call_shop

  167.       elsif $game_temp.name_calling

  168.         call_name

  169.       elsif $game_temp.menu_calling

  170.         call_menu

  171.       elsif $game_temp.save_calling

  172.         call_save

  173.       elsif $game_temp.debug_calling

  174.         call_debug

  175.       end

  176.     end

  177.   end

  178.   #--------------------------------------------------------------------------

  179.   # ● 调用战斗

  180.   #--------------------------------------------------------------------------

  181.   def call_battle

  182.     # 清除战斗调用标志

  183.     $game_temp.battle_calling = false

  184.     # 清除菜单调用标志

  185.     $game_temp.menu_calling = false

  186.     $game_temp.menu_beep = false

  187.     # 生成遇敌计数

  188.     $game_player.make_encounter_count

  189.     # 记忆地图 BGM 、停止 BGM

  190.     $game_temp.map_bgm = $game_system.playing_bgm

  191.     # 演奏战斗开始 SE

  192.     $game_system.se_play($data_system.battle_start_se)

  193.     # 演奏战斗 BGM

  194.     # 矫正主角姿势

  195.     $game_player.straighten

  196.     # 切换到战斗画面

  197.     $scene = Scene_Battle.new

  198.   end

  199.   #--------------------------------------------------------------------------

  200.   # ● 调用商店

  201.   #--------------------------------------------------------------------------

  202.   def call_shop

  203.     # 清除商店调用标志

  204.     $game_temp.shop_calling = false

  205.     # 矫正主角姿势

  206.     $game_player.straighten

  207.     # 切换到商店画面

  208.     $scene = Scene_Shop.new

  209.   end

  210.   #--------------------------------------------------------------------------

  211.   # ● 调用名称输入

  212.   #--------------------------------------------------------------------------

  213.   def call_name

  214.     # 清除商店调用名称输入标志

  215.     $game_temp.name_calling = false

  216.     # 矫正主角姿势

  217.     $game_player.straighten

  218.     # 切换到名称输入画面

  219.     $scene = Scene_Name.new

  220.   end

  221.   #--------------------------------------------------------------------------

  222.   # ● 调用菜单

  223.   #--------------------------------------------------------------------------

  224.   def call_menu

  225.     # 清除商店调用菜单标志

  226.     $game_temp.menu_calling = false

  227.     # 已经设置了菜单 SE 演奏标志的情况下

  228.     if $game_temp.menu_beep

  229.       # 演奏确定 SE

  230.       $game_system.se_play($data_system.decision_se)

  231.       # 清除菜单演奏 SE 标志

  232.       $game_temp.menu_beep = false

  233.     end

  234.     # 矫正主角姿势

  235.     $game_player.straighten

  236.     # 切换到菜单画面

  237.     $scene = Scene_Menu.new

  238.   end

  239.   #--------------------------------------------------------------------------

  240.   # ● 调用存档

  241.   #--------------------------------------------------------------------------

  242.   def call_save

  243.     # 矫正主角姿势

  244.     $game_player.straighten

  245.     # 切换到存档画面

  246.     $scene = Scene_Save.new

  247.   end

  248.   #--------------------------------------------------------------------------

  249.   # ● 调用调试

  250.   #--------------------------------------------------------------------------

  251.   def call_debug

  252.     # 清除商店调用调试标志

  253.     $game_temp.debug_calling = false

  254.     # 演奏确定 SE

  255.     $game_system.se_play($data_system.decision_se)

  256.     # 矫正主角姿势

  257.     $game_player.straighten

  258.     # 切换到调试画面

  259.     $scene = Scene_Debug.new

  260.   end

  261.   #--------------------------------------------------------------------------

  262.   # ● 主角的场所移动

  263.   #--------------------------------------------------------------------------

  264.   def transfer_player

  265.     # 清除主角场所移动调试标志

  266.     $game_temp.player_transferring = false

  267.     # 移动目标与现在的地图有差异的情况下

  268.     if $game_map.map_id != $game_temp.player_new_map_id

  269.       # 设置新地图

  270.       $game_map.setup($game_temp.player_new_map_id)

  271.     end

  272.     # 设置主角位置

  273.     $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)

  274.     # 设置主角朝向

  275.     case $game_temp.player_new_direction

  276.     when 2  # 下

  277.       $game_player.turn_down

  278.     when 4  # 左

  279.       $game_player.turn_left

  280.     when 6  # 右

  281.       $game_player.turn_right

  282.     when 8  # 上

  283.       $game_player.turn_up

  284.     end

  285.     # 矫正主角姿势

  286.     $game_player.straighten

  287.     # 刷新地图 (执行并行事件)

  288.     $game_map.update

  289.     # 在生成活动块

  290.     @spriteset.dispose

  291.     @spriteset = Spriteset_Map.new

  292.     # 处理过渡中的情况下

  293.     if $game_temp.transition_processing

  294.       # 清除过渡处理中标志

  295.       $game_temp.transition_processing = false

  296.       # 执行过渡

  297.       Graphics.transition(20)

  298.     end

  299.     # 执行地图设置的 BGM、BGS 的自动切换

  300.     $game_map.autoplay

  301.     # 设置画面

  302.     Graphics.frame_reset

  303.     # 刷新输入信息

  304.     Input.update

  305.   end

  306. end
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
4
 楼主| 发表于 2018-4-27 12:48:37 | 只看该作者
本帖最后由 CR~ 于 2018-4-27 13:24 编辑

显示音乐名脚本
  1. #==============================================================================
  2. # ■Window_Music by nanikoyizi
  3. #------------------------------------------------------------------------------
  4. # 在地图上显示当前演奏的音乐的窗口脚本
  5. # 这个是为了给注重音乐的游戏使用的(σ ̄▽ ̄)σ
  6. #==============================================================================

  7. class Window_Music < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ●初始化
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0,0,640,96)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.contents.font.size = 22 #这里可以调文字大小
  15.     @OP = 0
  16.     @OP2 = 0
  17.     @r = 100 #字幕持续时间
  18.       $MusicName = "摘自网络"
  19.       $Artist = "无"
  20.     @Turn = false
  21.     case $game_system.playing_bgm.name
  22.     when "山路"
  23.       $MusicName = "平均律第一册 BWV846前奏曲"
  24.       $Artist = "巴赫"
  25.     when "起始城教堂"
  26.       $MusicName = "BWV565 赋格"
  27.       $Artist = "巴赫"   
  28.   end
  29.     self.opacity = 0

  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ●更新
  33.   #--------------------------------------------------------------------------
  34.   def update
  35.     if @OP > 0 or @Turn == false
  36.       self.contents.clear
  37.       if @Turn == false
  38.         @OP += 4 #字幕出现渐变速度
  39.         @OP2 += 160/51 #((4*200/5)/(255/5))
  40.       else
  41.         @OP -= 4 #字幕消失渐变速度
  42.         @OP2 -= 160/51 #((4*200/5)/(255/5))
  43.       end
  44.       self.contents.font.color = Color.new(0, 0, 0, @OP2)
  45.       self.contents.font.name = "Arial Black"
  46.       self.contents.draw_text(2, 2, 10, 32, "♪ ")
  47.       self.contents.font.name = "黑体"
  48.       self.contents.draw_text(12, 4, 640, 32, $MusicName)
  49.       self.contents.font.color = Color.new(255, 255, 255, @OP)
  50.       self.contents.font.name = "Arial Black"
  51.       self.contents.draw_text(0, 0, 10, 32, "♪ ")
  52.       self.contents.font.name = "黑体"
  53.       self.contents.draw_text(10, 2, 640, 32, $MusicName)
  54.       if $Artist != nil
  55.         self.contents.font.color = Color.new(0, 0, 0, @OP2)
  56.         self.contents.draw_text(2, 34, 640, 32, "作者:" + $Artist)
  57.         self.contents.font.color = Color.new(255, 255, 255, @OP)
  58.         self.contents.draw_text(0, 32, 640, 32, "作者:" + $Artist)
  59.       end
  60.       if @OP >= 255
  61.         @r -= 1
  62.         if @r == 0
  63.           @Turn = true
  64.         end
  65.       end
  66.     end
  67.   end
  68. end
复制代码

点评

这么长的脚本你还不如传工程...  发表于 2018-4-27 15:12

评分

参与人数 1+1 收起 理由
guoxiaomi + 1 这脚本写的都是些什么,还是删了吧.

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
5
 楼主| 发表于 2018-4-27 13:25:43 | 只看该作者
那还有类似功能的脚本吗。。。
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
38732
在线时间
5702 小时
注册时间
2006-11-10
帖子
6608
6
发表于 2018-4-27 14:55:47 | 只看该作者
这个是找不到对象引起的,不管三七二十一,在出错的地方套if

if $game_system.playing_bgm != nil
     @Music.dispose if @Music != nil
   end

评分

参与人数 2星屑 +50 +1 收起 理由
RyanBern + 50 认可答案
CR~ + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
7
 楼主| 发表于 2018-4-27 22:12:07 | 只看该作者
灯笼菜刀王 发表于 2018-4-27 14:55
这个是找不到对象引起的,不管三七二十一,在出错的地方套if

if $game_system.playing_bgm !=  ...

感谢!解决了!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-21 13:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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