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

Project1

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

[已经解决] 1个脚本有问题求解 1个脚本需要略修改

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1759
在线时间
2524 小时
注册时间
2010-10-12
帖子
1454

开拓者

跳转到指定楼层
1
发表于 2014-6-25 16:24:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
10星屑
本帖最后由 刺夜之枪 于 2014-6-25 19:44 编辑

一个是我这个菜鸟瞎写的在指定事件上显示箭头的脚本。
主要写完了有一个问题就是每次打开菜单再关闭后箭头就消失了

RUBY 代码复制
  1. #==============================================================================
  2. # ■ EFS_Point_Arrow
  3. #------------------------------------------------------------------------------
  4. #  定义命令箭头的类
  5. #==============================================================================
  6. class EFS_Point_Arrow < Sprite
  7.  
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化数据
  10.   #--------------------------------------------------------------------------
  11.   def initialize(viewport)
  12.     super(viewport)
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 显示
  16.   #--------------------------------------------------------------------------
  17.   def display(figher)
  18.     @event = figher.event
  19.     @figher = figher
  20.     if self.bitmap==nil
  21.     @bitm = RPG::Cache.picture("wodeshib")
  22.     self.bitmap=@bitm
  23.     self.x = @event.screen_x-16
  24.     self.y = @event.screen_y-80
  25.     self.opacity = 205
  26.     end
  27.   end  
  28.   #--------------------------------------------------------------------------
  29.   # ● 刷新画面
  30.   #--------------------------------------------------------------------------
  31.   def update
  32.     self.x = @event.screen_x-16
  33.     self.y = @event.screen_y-80
  34.     self.opacity = 190
  35.     #hide if $lisenter != @figher.group_id and $lisenter != 0 else show
  36.     hide
  37.     show if $lisenter == @figher.group_id or $lisenter == 0
  38.  
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 隐藏
  42.   #--------------------------------------------------------------------------     
  43.   def hide
  44.     self.bitmap = RPG::Cache.picture("blank")
  45.   end  
  46.   #--------------------------------------------------------------------------
  47.   # ● 显示
  48.   #--------------------------------------------------------------------------     
  49.   def do_it
  50.      show if $lisenter == @figher.group_id or $lisenter == 0
  51.   end   
  52.   #--------------------------------------------------------------------------
  53.   # ● 不隐藏
  54.   #--------------------------------------------------------------------------     
  55.   def show
  56.     return if @figher.dead?
  57.     self.bitmap = @bitm
  58.   end   
  59.  
  60.  
  61.  
  62. end


这里调用的。

我尝试过在Scene_Menu
      # 切换的地图画面
      $scene = Scene_Map.new
的时候重新调用一次

但是结果只是闪了一下又没有了

很费劲




第二个脚本是搜来的防网游即时消息
RUBY 代码复制
  1. #------------------制作by bluefool,转载请保留------------------
  2. module Blue
  3.   #这个是控制显示最近的多少条信息的,当超出一屏能显示的值的话可通过先按一下shift
  4.   #然后用上下翻看内容。再按一次shift则解除激活
  5.   Blue_max = 12
  6.   #这个填写进如游戏时生成的系统语言,
  7.   INTRO = ""
  8.   #战斗画面时即时消息窗口的x坐标
  9.   BATAM_X = 0
  10.   #战斗画面时即时消   息窗口的y坐标
  11.   BATAM_Y = 400
  12.   #用于清空hash表,可以不管它,但不要让Blue_max大于它,当然,它的值也可以改变
  13.   NAM_MAX = 50
  14.   #主要传递信息参数为函数$am,参见脚本内容
  15. end
  16. #-------------------------------------------
  17. class Scene_Load < Scene_File
  18.   #--------------------------------------------------------------------------
  19.   # ● 确定时的处理
  20.   #--------------------------------------------------------------------------
  21.   def on_decision(filename)
  22.     # 文件不存在的情况下
  23.     unless FileTest.exist?(filename)
  24.       # 演奏冻结 SE
  25.       $game_system.se_play($data_system.buzzer_se)
  26.       return
  27.     end
  28.     # 演奏读档 SE
  29.     $game_system.se_play($data_system.load_se)
  30.     # 写入存档数据
  31.     file = File.open(filename, "rb")
  32.     read_save_data(file)
  33.     file.close
  34.     # 还原 BGM、BGS
  35.     $game_system.bgm_play($game_system.playing_bgm)
  36.     $game_system.bgs_play($game_system.playing_bgs)
  37.     # 刷新地图 (执行并行事件)
  38.     $a = {}
  39.     $game_map.update
  40.     # 切换到地图画面
  41.     $scene = Scene_Map.new
  42.   end
  43. end  
  44. #==============================================================================
  45. # ■ Scene_Title
  46. #------------------------------------------------------------------------------
  47. #  处理标题画面的类。
  48. #==============================================================================
  49.  
  50. class Scene_Title
  51.   #--------------------------------------------------------------------------
  52.   # ● 命令 : 新游戏
  53.   #--------------------------------------------------------------------------
  54.   def command_new_game
  55.     # 演奏确定 SE
  56.     $game_system.se_play($data_system.decision_se)
  57.     # 停止 BGM
  58.     Audio.bgm_stop
  59.     # 重置测量游戏时间用的画面计数器
  60.     Graphics.frame_count = 0
  61.     # 生成各种游戏对像
  62.     $game_temp          = Game_Temp.new
  63.     $game_system        = Game_System.new
  64.     $game_switches      = Game_Switches.new
  65.     $game_variables     = Game_Variables.new
  66.     $game_self_switches = Game_SelfSwitches.new
  67.     $game_screen        = Game_Screen.new
  68.     $game_actors        = Game_Actors.new
  69.     $game_party         = Game_Party.new
  70.     $game_troop         = Game_Troop.new
  71.     $game_map           = Game_Map.new
  72.     $game_player        = Game_Player.new
  73.     # 设置初期同伴位置
  74.     $game_party.setup_starting_members
  75.     # 设置初期位置的地图
  76.     $game_map.setup($data_system.start_map_id)
  77.     # 主角向初期位置移动
  78.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  79.     # 刷新主角
  80.     $game_player.refresh
  81.     # 执行地图设置的 BGM 与 BGS 的自动切换
  82.     $game_map.autoplay
  83.     # 刷新地图 (执行并行事件)
  84.     $game_map.update
  85.     $a = {}
  86.     $am = Blue::INTRO
  87.     $ccc = 0
  88.     # 切换地图画面
  89.     $scene = Scene_Map.new
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 命令 : 继续
  93.   #--------------------------------------------------------------------------
  94.   def command_continue
  95.     # 继续无效的情况下
  96.     unless @continue_enabled
  97.       # 演奏无效 SE
  98.       $game_system.se_play($data_system.buzzer_se)
  99.       return
  100.     end
  101.     # 演奏确定 SE
  102.     $game_system.se_play($data_system.decision_se)
  103.     # 切换到读档画面
  104.     $scene = Scene_Load.new
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 命令 : 退出
  108.   #--------------------------------------------------------------------------
  109.   def command_shutdown
  110.     # 演奏确定 SE
  111.     $game_system.se_play($data_system.decision_se)
  112.     # BGM、BGS、ME 的淡入淡出
  113.     Audio.bgm_fade(800)
  114.     Audio.bgs_fade(800)
  115.     Audio.me_fade(800)
  116.     # 退出
  117.     $scene = nil
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 战斗测试
  121.   #--------------------------------------------------------------------------
  122.   def battle_test
  123.     # 载入数据库 (战斗测试用)
  124.     $data_actors        = load_data("Data/BT_Actors.rxdata")
  125.     $data_classes       = load_data("Data/BT_Classes.rxdata")
  126.     $data_skills        = load_data("Data/BT_Skills.rxdata")
  127.     $data_items         = load_data("Data/BT_Items.rxdata")
  128.     $data_weapons       = load_data("Data/BT_Weapons.rxdata")
  129.     $data_armors        = load_data("Data/BT_Armors.rxdata")
  130.     $data_enemies       = load_data("Data/BT_Enemies.rxdata")
  131.     $data_troops        = load_data("Data/BT_Troops.rxdata")
  132.     $data_states        = load_data("Data/BT_States.rxdata")
  133.     $data_animations    = load_data("Data/BT_Animations.rxdata")
  134.     $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
  135.     $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
  136.     $data_system        = load_data("Data/BT_System.rxdata")
  137.     # 重置测量游戏时间用的画面计数器
  138.     Graphics.frame_count = 0
  139.     # 生成各种游戏对像
  140.     $game_temp          = Game_Temp.new
  141.     $game_system        = Game_System.new
  142.     $game_switches      = Game_Switches.new
  143.     $game_variables     = Game_Variables.new
  144.     $game_self_switches = Game_SelfSwitches.new
  145.     $game_screen        = Game_Screen.new
  146.     $game_actors        = Game_Actors.new
  147.     $game_party         = Game_Party.new
  148.     $game_troop         = Game_Troop.new
  149.     $game_map           = Game_Map.new
  150.     $game_player        = Game_Player.new
  151.     $a = {0=>"进入战斗测试."}
  152.     # 设置战斗测试用同伴
  153.     $game_party.setup_battle_test_members
  154.     # 设置队伍 ID、可以逃走标志、战斗背景
  155.     $game_temp.battle_troop_id = $data_system.test_troop_id
  156.     $game_temp.battle_can_escape = true
  157.     $game_map.battleback_name = $data_system.battleback_name
  158.     # 演奏战斗开始 BGM
  159.     $game_system.se_play($data_system.battle_start_se)
  160.     # 演奏战斗 BGM
  161.     $game_system.bgm_play($game_system.battle_bgm)
  162.     # 切换到战斗画面
  163.     $scene = Scene_Battle.new
  164.   end
  165. end
  166. #-------------------------------------------------------
  167. class Scene_Map
  168.   #--------------------------------------------------------------------------
  169.   # ● 主处理
  170.   #--------------------------------------------------------------------------
  171.   def main
  172.     @spriteset = Spriteset_Map.new
  173.     @message_window = Window_Message.new
  174.     @down_window = Window_Down.new
  175.     Graphics.transition
  176.     # 主循环
  177.     loop do
  178.       Graphics.update
  179.       Input.update
  180.       update
  181.       if $scene != self
  182.         break
  183.       end
  184.     end
  185.     Graphics.freeze
  186.     @spriteset.dispose
  187.     @message_window.dispose
  188.     @down_window.dispose
  189.     if $scene.is_a?(Scene_Title)
  190.       Graphics.transition
  191.       Graphics.freeze
  192.     end
  193.     @am_size = $a.size
  194.   end
  195.   #---------------------
  196.   def bluefool_sort
  197.     if $am != nil
  198.        if $a.size > Blue::NAM_MAX
  199.           a_temp = {}
  200.           j = 0
  201.           for i in ($a.size - Blue::Blue_max)...$a.size
  202.             a_temp[j] = $a[i]
  203.             j += 1
  204.           end  
  205.          $a = a_temp
  206.        end  
  207.        if $am.length < 54
  208.           $a[$a.size] = $am
  209.         else
  210.           while $am.length > 53
  211.             i = 53
  212.             while (/\W/ =~ $am[i-3,3]) != nil
  213.               i -= 1
  214.             end
  215.             $a[$a.size] = $am[0,i]
  216.             $am = $am[i ,$am.length - i]
  217.           end
  218.           $a[$a.size] = $am
  219.        end
  220.        $am = nil
  221.     end
  222.   end  
  223.   #--------------------------------------------------------------------------
  224.   # ● 刷新画面
  225.   #--------------------------------------------------------------------------
  226.   def update
  227.     # 循环
  228.     loop do
  229.       # 按照地图、实例、主角的顺序刷新
  230.       # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
  231.       #  的机会的重要因素)
  232.       $game_map.update
  233.       $game_system.map_interpreter.update
  234.       $game_player.update
  235.       # 系统 (计时器)、画面刷新
  236.       $game_system.update
  237.       $game_screen.update
  238.       # 如果主角在场所移动中就中断循环
  239.       unless $game_temp.player_transferring
  240.         break
  241.       end
  242.       # 执行场所移动
  243.       transfer_player
  244.       # 处理过渡中的情况下、中断循环
  245.       if $game_temp.transition_processing
  246.         break
  247.       end
  248.     end
  249.     # 刷新活动块
  250.     @spriteset.update
  251.     # 刷新信息窗口
  252.     @message_window.update
  253.     # 游戏结束的情况下
  254.     if $game_temp.gameover
  255.       # 切换的游戏结束画面
  256.       $scene = Scene_Gameover.new
  257.       return
  258.     end
  259.     # 返回标题画面的情况下
  260.     if $game_temp.to_title
  261.       # 切换到标题画面
  262.       $scene = Scene_Title.new
  263.       return
  264.     end
  265.     # 处理过渡中的情况下
  266.     if $game_temp.transition_processing
  267.       # 清除过渡处理中标志
  268.       $game_temp.transition_processing = false
  269.       # 执行过渡
  270.       if $game_temp.transition_name == ""
  271.         Graphics.transition(20)
  272.       else
  273.         Graphics.transition(40, "Graphics/Transitions/" +
  274.           $game_temp.transition_name)
  275.       end
  276.     end
  277.     # 显示信息窗口中的情况下
  278.     if $game_temp.message_window_showing
  279.       return
  280.     end
  281.     # 遇敌计数为 0 且、且遇敌列表不为空的情况下
  282.     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
  283.       # 不是在事件执行中或者禁止遇敌中
  284.       unless $game_system.map_interpreter.running? or
  285.              $game_system.encounter_disabled
  286.         # 确定队伍
  287.         n = rand($game_map.encounter_list.size)
  288.         troop_id = $game_map.encounter_list[n]
  289.         # 队伍有效的话
  290.         if $data_troops[troop_id] != nil
  291.           # 设置调用战斗标志
  292.           $game_temp.battle_calling = true
  293.           $game_temp.battle_troop_id = troop_id
  294.           $game_temp.battle_can_escape = true
  295.           $game_temp.battle_can_lose = false
  296.           $game_temp.battle_proc = nil
  297.         end
  298.       end
  299.     end
  300.     #---------------------------------------------
  301.     bluefool_sort
  302.     if @am_size != $a.size
  303.        @down_window.refresh
  304.        if $a != nil and $a.size < Blue::Blue_max + 1
  305.         @down_window.index = $a.size/2 - 1
  306.         elsif $a != nil and $a.size > Blue::Blue_max
  307.         @down_window.index = Blue::Blue_max/2 - 1
  308.        end  
  309.        @am_size = $a.size
  310.     end  
  311.     if Input.trigger?(Input::A)
  312.       if @down_window.active == false
  313.         @down_window.active = true
  314.         $ccc = 1
  315.       else
  316.         @down_window.active = false
  317.         $ccc = 0
  318.       end  
  319.     end
  320.     if Input.trigger?(Input::DOWN)#输入DOWN键的情况
  321.       if @down_window.active == true and @down_window.index < (@down_window.item_max-1)/2
  322.         @down_window.index += 1
  323.       end  
  324.     end  
  325.     if Input.trigger?(Input::UP)#输入UP键的情况
  326.       if @down_window.active == true and @down_window.index > 0
  327.         @down_window.index -= 1
  328.       end  
  329.     end  
  330.     #----------------------------------------------
  331.     # 按下 B 键的情况下
  332.     if Input.trigger?(Input::B)
  333.       # 不是在事件执行中或菜单禁止中
  334.       unless $game_system.map_interpreter.running? or
  335.              $game_system.menu_disabled
  336.         # 设置菜单调用标志以及 SE 演奏
  337.         $game_temp.menu_calling = true
  338.         $game_temp.menu_beep = true
  339.       end
  340.     end
  341.     # 调试模式为 ON 并且按下 F9 键的情况下
  342.     if $DEBUG and Input.press?(Input::F9)
  343.       # 设置调用调试标志
  344.       $game_temp.debug_calling = true
  345.     end
  346.     # 不在主角移动中的情况下
  347.     unless $game_player.moving?
  348.       # 执行各种画面的调用
  349.       if $game_temp.battle_calling
  350.         call_battle
  351.       elsif $game_temp.shop_calling
  352.         call_shop
  353.       elsif $game_temp.name_calling
  354.         call_name
  355.       elsif $game_temp.menu_calling
  356.         call_menu
  357.       elsif $game_temp.save_calling
  358.         call_save
  359.       elsif $game_temp.debug_calling
  360.         call_debug
  361.       end
  362.     end
  363.   end
  364. end
  365. class Game_Battler
  366.   def bluefool_sort
  367.       if $am != nil
  368.         if $am.length < 54
  369.            $a[$a.size] = $am
  370.         else
  371.            while $am.length > 53
  372.              i = 53
  373.              while (/\W/ =~ $am[i-3,3]) != nil
  374.               i -= 1
  375.              end
  376.              $a[$a.size] = $am[0,i]
  377.              $am = $am[i ,$am.length - i]
  378.            end
  379.            $a[$a.size] = $am
  380.         end
  381.        $am = nil
  382.       end
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 应用连续伤害效果
  386.   #--------------------------------------------------------------------------
  387.   def slip_damage_effect
  388.     # 设置伤害
  389.     self.damage = self.maxhp / 10
  390.     # 分散
  391.     if self.damage.abs > 0
  392.       amp = [self.damage.abs * 15 / 100, 1].max
  393.       self.damage += rand(amp+1) + rand(amp+1) - amp
  394.     end
  395.     # HP 的伤害减法运算
  396.     self.hp -= self.damage
  397.     if self.damage > 0
  398.       $am = "异常状态使#{self.name}受到了#{self.damage}点伤害."
  399.     elsif self.damage < 0
  400.       $am = "异常状态使#{self.name}恢复了#{self.damage.abs}点#{$data_system.words.hp}"
  401.     end
  402.     bluefool_sort
  403.     # 过程结束
  404.     return true
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● 应用通常攻击效果
  408.   #     attacker : 攻击者 (battler)
  409.   #--------------------------------------------------------------------------
  410.   def attack_effect(attacker)
  411.     # 清除会心一击标志
  412.     self.critical = false
  413.     # 第一命中判定
  414.     hit_result = (rand(100) < attacker.hit)
  415.     # 命中的情况下
  416.     if hit_result == true
  417.       # 计算基本伤害
  418.       atk = [attacker.atk - self.pdef / 2, 0].max
  419.       self.damage = atk * (20 + attacker.str) / 20
  420.       # 属性修正
  421.       self.damage *= elements_correct(attacker.element_set)
  422.       self.damage /= 100
  423.       # 伤害符号正确的情况下
  424.       if self.damage > 0
  425.         # 会心一击修正
  426.         if rand(100) < 4 * attacker.dex / self.agi
  427.           self.damage *= 2
  428.           self.critical = true
  429.         end
  430.         # 防御修正
  431.         if self.guarding?
  432.           self.damage /= 2
  433.         end
  434.       end
  435.       # 分散
  436.       if self.damage.abs > 0
  437.         amp = [self.damage.abs * 15 / 100, 1].max
  438.         self.damage += rand(amp+1) + rand(amp+1) - amp
  439.       end
  440.       # 第二命中判定
  441.       eva = 8 * self.agi / attacker.dex + self.eva
  442.       hit = self.damage < 0 ? 100 : 100 - eva
  443.       hit = self.cant_evade? ? 100 : hit
  444.       hit_result = (rand(100) < hit)
  445.     end
  446.     # 命中的情况下
  447.     if hit_result == true
  448.       # 状态冲击解除
  449.       remove_states_shock
  450.       # HP 的伤害计算
  451.       self.hp -= self.damage
  452.       $am = "#{attacker.name}对#{self.name}造成了#{self.damage}伤害."
  453.       bluefool_sort
  454.       # 状态变化
  455.       @state_changed = false
  456.       states_plus(attacker.plus_state_set)
  457.       states_minus(attacker.minus_state_set)
  458.     # Miss 的情况下
  459.     else
  460.       # 伤害设置为 "Miss"
  461.       self.damage = "Miss"
  462.       $am = "#{attacker.name}击空了."
  463.       bluefool_sort
  464.       # 清除会心一击标志
  465.       self.critical = false
  466.     end
  467.     # 过程结束
  468.     return true
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ● 应用特技效果
  472.   #     user  : 特技的使用者 (battler)
  473.   #     skill : 特技
  474.   #--------------------------------------------------------------------------
  475.   def skill_effect(user, skill)
  476.     # 清除会心一击标志
  477.     self.critical = false
  478.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  479.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  480.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  481.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  482.       # 过程结束
  483.       return false
  484.     end
  485.     # 清除有效标志
  486.     effective = false
  487.     # 公共事件 ID 是有效的情况下,设置为有效标志
  488.     effective |= skill.common_event_id > 0
  489.     # 第一命中判定
  490.     hit = skill.hit
  491.     if skill.atk_f > 0
  492.       hit *= user.hit / 100
  493.     end
  494.     hit_result = (rand(100) < hit)
  495.     # 不确定的特技的情况下设置为有效标志
  496.     effective |= hit < 100
  497.     # 命中的情况下
  498.     if hit_result == true
  499.       # 计算威力
  500.       power = skill.power + user.atk * skill.atk_f / 100
  501.       if power > 0
  502.         power -= self.pdef * skill.pdef_f / 200
  503.         power -= self.mdef * skill.mdef_f / 200
  504.         power = [power, 0].max
  505.       end
  506.       # 计算倍率
  507.       rate = 20
  508.       rate += (user.str * skill.str_f / 100)
  509.       rate += (user.dex * skill.dex_f / 100)
  510.       rate += (user.agi * skill.agi_f / 100)
  511.       rate += (user.int * skill.int_f / 100)
  512.       # 计算基本伤害
  513.       self.damage = power * rate / 20
  514.       # 属性修正
  515.       self.damage *= elements_correct(skill.element_set)
  516.       self.damage /= 100
  517.       # 伤害符号正确的情况下
  518.       if self.damage > 0
  519.         # 防御修正
  520.         if self.guarding?
  521.           self.damage /= 2
  522.         end
  523.       end
  524.       # 分散
  525.       if skill.variance > 0 and self.damage.abs > 0
  526.         amp = [self.damage.abs * skill.variance / 100, 1].max
  527.         self.damage += rand(amp+1) + rand(amp+1) - amp
  528.       end
  529.       # 第二命中判定
  530.       eva = 8 * self.agi / user.dex + self.eva
  531.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  532.       hit = self.cant_evade? ? 100 : hit
  533.       hit_result = (rand(100) < hit)
  534.       # 不确定的特技的情况下设置为有效标志
  535.       effective |= hit < 100
  536.     end
  537.     # 命中的情况下
  538.     if hit_result == true
  539.       # 威力 0 以外的物理攻击的情况下
  540.       if skill.power != 0 and skill.atk_f > 0
  541.         # 状态冲击解除
  542.         remove_states_shock
  543.         # 设置有效标志
  544.         effective = true
  545.       end
  546.       # HP 的伤害减法运算
  547.       last_hp = self.hp
  548.       self.hp -= self.damage
  549.         if self.damage > 0
  550.          $am = "#{user.name}对#{self.name}造成了#{self.damage}伤害."
  551.          elsif self.damage < 0
  552.           if user == self
  553.            $am = "#{user.name}恢复了自己#{self.damage.abs}点#{$data_system.words.hp}."
  554.            else
  555.            $am = "#{user.name}恢复了#{self.name}#{self.damage.abs}点#{$data_system.words.hp}."
  556.           end
  557.         end
  558.       bluefool_sort
  559.       effective |= self.hp != last_hp
  560.       # 状态变化
  561.       @state_changed = false
  562.       effective |= states_plus(skill.plus_state_set)
  563.       effective |= states_minus(skill.minus_state_set)
  564.       # 威力为 0 的场合
  565.       if skill.power == 0
  566.         # 伤害设置为空的字串
  567.         self.damage = ""
  568.         # 状态没有变化的情况下
  569.         unless @state_changed
  570.           # 伤害设置为 "Miss"
  571.           self.damage = "Miss"
  572.           $am = "#{user.name}没有击中."
  573.           bluefool_sort
  574.         end
  575.       end
  576.     # Miss 的情况下
  577.     else
  578.       # 伤害设置为 "Miss"
  579.       self.damage = "Miss"
  580.       $am = "#{user.name}没有击中."
  581.       bluefool_sort
  582.     end
  583.     # 不在战斗中的情况下
  584.     unless $game_temp.in_battle
  585.       # 伤害设置为 nil
  586.       self.damage = nil
  587.     end
  588.     # 过程结束
  589.     return effective
  590.   end
  591. end
  592. class Scene_Battle
  593.   #--------------------------------------------------------------------------
  594.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  595.   #--------------------------------------------------------------------------
  596.   def update_phase4_step1
  597.     # 隐藏帮助窗口
  598.     @help_window.visible = false
  599.     # 判定胜败
  600.     if judge
  601.       # 胜利或者失败的情况下 : 过程结束
  602.       return
  603.     end
  604.     # 强制行动的战斗者不存在的情况下
  605.     if $game_temp.forcing_battler == nil
  606.       # 设置战斗事件
  607.       setup_battle_event
  608.       # 执行战斗事件中的情况下
  609.       if $game_system.battle_interpreter.running?
  610.         return
  611.       end
  612.     end
  613.     # 强制行动的战斗者存在的情况下
  614.     if $game_temp.forcing_battler != nil
  615.       # 在头部添加后移动
  616.       @action_battlers.delete($game_temp.forcing_battler)
  617.       @action_battlers.unshift($game_temp.forcing_battler)
  618.     end
  619.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  620.     if @action_battlers.size == 0
  621.       # 开始同伴命令回合
  622.       start_phase2
  623.       return
  624.     end
  625.     # 初始化动画 ID 和公共事件 ID
  626.     @animation1_id = 0
  627.     @animation2_id = 0
  628.     @common_event_id = 0
  629.     # 未行动的战斗者移动到序列的头部
  630.     @active_battler = @action_battlers.shift
  631.     # 如果已经在战斗之外的情况下
  632.     if @active_battler.index == nil
  633.       return
  634.     end
  635.     # 连续伤害
  636.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  637.       @active_battler.slip_damage_effect
  638.       @active_battler.damage_pop = true
  639.       @down_window.refresh
  640.     end
  641.     # 自然解除状态
  642.     @active_battler.remove_states_auto
  643.     # 刷新状态窗口
  644.     @status_window.refresh
  645.     # 移至步骤 2
  646.     @phase4_step = 2
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● 开始结束战斗回合
  650.   #--------------------------------------------------------------------------
  651.   def start_phase5
  652.     # 转移到回合 5
  653.     @phase = 5
  654.     # 演奏战斗结束 ME
  655.     $game_system.me_play($game_system.battle_end_me)
  656.     # 还原为战斗开始前的 BGM
  657.     $game_system.bgm_play($game_temp.map_bgm)
  658.     # 初始化 EXP、金钱、宝物
  659.     exp = 0
  660.     gold = 0
  661.     treasures = []
  662.     # 循环
  663.     for enemy in $game_troop.enemies
  664.       # 敌人不是隐藏状态的情况下
  665.       unless enemy.hidden
  666.         # 获得 EXP、增加金钱
  667.         exp += enemy.exp
  668.         gold += enemy.gold
  669.         # 出现宝物判定
  670.         if rand(100) < enemy.treasure_prob
  671.           if enemy.item_id > 0
  672.             treasures.push($data_items[enemy.item_id])
  673.           end
  674.           if enemy.weapon_id > 0
  675.             treasures.push($data_weapons[enemy.weapon_id])
  676.           end
  677.           if enemy.armor_id > 0
  678.             treasures.push($data_armors[enemy.armor_id])
  679.           end
  680.         end
  681.       end
  682.     end
  683.     # 限制宝物数为 6 个
  684.     treasures = treasures[0..5]
  685.     # 获得 EXP
  686.     for i in 0...$game_party.actors.size
  687.       actor = $game_party.actors[i]
  688.       if actor.cant_get_exp? == false
  689.         last_level = actor.level
  690.         actor.exp += exp
  691.         if actor.level > last_level
  692.           @status_window.level_up(i)
  693.         end
  694.       end
  695.     end
  696.     # 获得金钱
  697.     $game_party.gain_gold(gold)
  698.     $am = "获得#{exp}经验,#{gold}#{$data_system.words.gold}"
  699.     bluefool_sort
  700.     @down_window.refresh
  701.     # 获得宝物
  702.     for item in treasures
  703.       case item
  704.       when RPG::Item
  705.         $game_party.gain_item(item.id, 1)
  706.         $am = "获得#{$data_items[item.id].name}"
  707.         bluefool_sort
  708.       when RPG::Weapon
  709.         $game_party.gain_weapon(item.id, 1)
  710.         $am = "获得#{$data_weapons[item.id].name}"
  711.         bluefool_sort
  712.       when RPG::Armor
  713.         $game_party.gain_armor(item.id, 1)
  714.         $am = "获得#{$data_armors[item.id].name}"
  715.         bluefool_sort
  716.       end
  717.       @down_window.refresh
  718.     end
  719.     # 生成战斗结果窗口
  720.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  721.     # 设置等待计数
  722.     @phase5_wait_count = 100
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● 生成基本行动结果
  726.   #--------------------------------------------------------------------------
  727.   def make_basic_action_result
  728.     # 攻击的情况下
  729.     if @active_battler.current_action.basic == 0
  730.       # 设置攻击 ID
  731.       @animation1_id = @active_battler.animation1_id
  732.       @animation2_id = @active_battler.animation2_id
  733.       # 行动方的战斗者是敌人的情况下
  734.       if @active_battler.is_a?(Game_Enemy)
  735.         if @active_battler.restriction == 3
  736.           target = $game_troop.random_target_enemy
  737.         elsif @active_battler.restriction == 2
  738.           target = $game_party.random_target_actor
  739.         else
  740.           index = @active_battler.current_action.target_index
  741.           target = $game_party.smooth_target_actor(index)
  742.         end
  743.       end
  744.       # 行动方的战斗者是角色的情况下
  745.       if @active_battler.is_a?(Game_Actor)
  746.         if @active_battler.restriction == 3
  747.           target = $game_party.random_target_actor
  748.         elsif @active_battler.restriction == 2
  749.           target = $game_troop.random_target_enemy
  750.         else
  751.           index = @active_battler.current_action.target_index
  752.           target = $game_troop.smooth_target_enemy(index)
  753.         end
  754.       end
  755.       # 设置对像方的战斗者序列
  756.       @target_battlers = [target]
  757.       for target in @target_battlers
  758.         $am = "#{@active_battler.name}对#{target.name}发起了进攻!"
  759.         bluefool_sort
  760.         target.attack_effect(@active_battler)
  761.       end
  762.       return
  763.     end
  764.     # 防御的情况下
  765.     if @active_battler.current_action.basic == 1
  766.       @help_window.set_text($data_system.words.guard, 1)
  767.       $am = "#{@active_battler.name}选择了防御."
  768.       bluefool_sort
  769.       return
  770.     end
  771.     # 逃跑的情况下
  772.     if @active_battler.is_a?(Game_Enemy) and
  773.        @active_battler.current_action.basic == 2
  774.       #  帮助窗口显示"逃跑"
  775.       @help_window.set_text("逃跑", 1)
  776.       # 逃跑
  777.       @active_battler.escape
  778.       return
  779.     end
  780.     # 什么也不做的情况下
  781.     if @active_battler.current_action.basic == 3
  782.       # 清除强制行动对像的战斗者
  783.       $game_temp.forcing_battler = nil
  784.       # 移至步骤 1
  785.       @phase4_step = 1
  786.       return
  787.     end
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # ● 生成特技行动结果
  791.   #--------------------------------------------------------------------------
  792.   def make_skill_action_result
  793.     # 获取特技
  794.     [url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[@active_battler.current_action.skill_id]
  795.     # 如果不是强制行动
  796.     unless @active_battler.current_action.forcing
  797.       # 因为 SP 耗尽而无法使用的情况下
  798.       unless @active_battler.skill_can_use?(@skill.id)
  799.         # 清除强制行动对像的战斗者
  800.         $game_temp.forcing_battler = nil
  801.         # 移至步骤 1
  802.         @phase4_step = 1
  803.         return
  804.       end
  805.     end
  806.     # 消耗 SP
  807.     @active_battler.sp -= @skill.sp_cost
  808.     # 刷新状态窗口
  809.     @status_window.refresh
  810.     # 在帮助窗口显示特技名
  811.     @help_window.set_text(@skill.name, 1)
  812.     # 设置动画 ID
  813.     @animation1_id = @skill.animation1_id
  814.     @animation2_id = @skill.animation2_id
  815.     # 设置公共事件 ID
  816.     @common_event_id = @skill.common_event_id
  817.     # 设置对像侧战斗者
  818.     set_target_battlers(@skill.scope)
  819.     # 应用特技效果
  820.     for target in @target_battlers
  821.       case @skill.scope
  822.       when 1  
  823.        $am = "#{@active_battler.name}使用#{@skill.name}攻击#{target.name}!"
  824.       when 2  
  825.        $am = "#{@active_battler.name}使用#{@skill.name}攻击#{target.name}!"
  826.       when 7  
  827.         $am = "#{@active_battler.name}对自己使用#{@skill.name}."
  828.       else
  829.         if target == @active_battler
  830.           $am = "#{@active_battler.name}对自己使用#{@skill.name}."
  831.           else
  832.           $am = "#{@active_battler.name}对#{target.name}使用#{@skill.name}."
  833.         end  
  834.       end
  835.       bluefool_sort
  836.       target.skill_effect(@active_battler, @skill)
  837.     end
  838.   end
  839.   #--------------------------------------------------------------------------
  840.   # ● 生成物品行动结果
  841.   #--------------------------------------------------------------------------
  842.   def make_item_action_result
  843.     # 获取物品
  844.     @item = $data_items[@active_battler.current_action.item_id]
  845.     # 因为物品耗尽而无法使用的情况下
  846.     unless $game_party.item_can_use?(@item.id)
  847.       # 移至步骤 1
  848.       @phase4_step = 1
  849.       return
  850.     end
  851.     # 消耗品的情况下
  852.     if @item.consumable
  853.       # 使用的物品减 1
  854.       $game_party.lose_item(@item.id, 1)
  855.     end
  856.     # 在帮助窗口显示物品名
  857.     @help_window.set_text(@item.name, 1)
  858.     # 设置动画 ID
  859.     @animation1_id = @item.animation1_id
  860.     @animation2_id = @item.animation2_id
  861.     # 设置公共事件 ID
  862.     @common_event_id = @item.common_event_id
  863.     # 确定对像
  864.     index = @active_battler.current_action.target_index
  865.     target = $game_party.smooth_target_actor(index)
  866.     # 设置对像侧战斗者
  867.     set_target_battlers(@item.scope)
  868.     # 应用物品效果
  869.     for target in @target_battlers
  870.       target.item_effect(@item)
  871.       if target == @active_battler
  872.         $am = "#{@active_battler.name}对自己使用了#{@item.name}"
  873.        else
  874.         $am = "#{@active_battler.name}对#{target.name}使用了#{@item.name}"
  875.       end
  876.       bluefool_sort
  877.     end
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  881.   #--------------------------------------------------------------------------
  882.   def update_phase4_step4
  883.     # 对像方动画
  884.     for target in @target_battlers
  885.       target.animation_id = @animation2_id
  886.       target.animation_hit = (target.damage != "Miss")
  887.     end
  888.     @down_window.refresh
  889.     @wait_count = 8
  890.     # 移至步骤 5
  891.     @phase4_step = 5
  892.   end
  893.   def bluefool_sort
  894.       if $am != nil
  895.        if $a.size > Blue::NAM_MAX
  896.           a_temp = {}
  897.           j = 0
  898.           for i in ($a.size - Blue::Blue_max)...$a.size
  899.             a_temp[j] = $a[i]
  900.             j += 1
  901.           end  
  902.          $a = a_temp
  903.        end  
  904.         if $am.length < 54
  905.            $a[$a.size] = $am
  906.         else
  907.            while $am.length > 53
  908.              i = 53
  909.              while (/\W/ =~ $am[i-3,3]) != nil
  910.               i -= 1
  911.              end
  912.              $a[$a.size] = $am[0,i]
  913.              $am = $am[i ,$am.length - i]
  914.            end
  915.            $a[$a.size] = $am
  916.         end
  917.        $am = nil
  918.       end
  919.   end
  920.   def main
  921.     $am = "队伍进入战斗!"
  922.     bluefool_sort
  923.     $game_temp.in_battle = true
  924.     $game_temp.battle_turn = 0
  925.     $game_temp.battle_event_flags.clear
  926.     $game_temp.battle_abort = false
  927.     $game_temp.battle_main_phase = false
  928.     $game_temp.battleback_name = $game_map.battleback_name
  929.     $game_temp.forcing_battler = nil
  930.     $game_system.battle_interpreter.setup(nil, 0)
  931.     @troop_id = $game_temp.battle_troop_id
  932.     $game_troop.setup(@troop_id)
  933.     #生成角色命令窗口
  934.     s1 = $data_system.words.attack
  935.     s2 = $data_system.words.skill
  936.     s3 = $data_system.words.guard
  937.     s4 = $data_system.words.item
  938.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  939.     @actor_command_window.y = 160
  940.     @actor_command_window.back_opacity = 160
  941.     @actor_command_window.active = false
  942.     @actor_command_window.visible = false
  943.     # 生成其它窗口
  944.     @party_command_window = Window_PartyCommand.new
  945.     @help_window = Window_Help.new
  946.     @help_window.back_opacity = 160
  947.     @help_window.visible = false
  948.     @status_window = Window_BattleStatus.new
  949.     @message_window = Window_Message.new
  950.     @down_window = Window_Down.new
  951.     @down_window.y = Blue::BATAM_Y
  952.     @down_window.z = @actor_command_window.z - 10
  953.     # 生成活动块
  954.     @spriteset = Spriteset_Battle.new
  955.     # 初始化等待计数
  956.     @wait_count = 0
  957.     # 执行过渡
  958.     if $data_system.battle_transition == ""
  959.       Graphics.transition(20)
  960.     else
  961.       Graphics.transition(40, "Graphics/Transitions/" +
  962.         $data_system.battle_transition)
  963.     end
  964.     # 开始自由战斗回合
  965.     start_phase1
  966.     # 主循环
  967.     loop do
  968.       Graphics.update
  969.       Input.update
  970.       update
  971.       if $scene != self
  972.         break
  973.       end
  974.     end
  975.     # 刷新地图
  976.     $game_map.refresh
  977.     # 准备过渡
  978.     Graphics.freeze
  979.     # 释放窗口
  980.     @actor_command_window.dispose
  981.     @party_command_window.dispose
  982.     @help_window.dispose
  983.     @status_window.dispose
  984.     @message_window.dispose
  985.     @down_window.dispose
  986.     $am = "战斗结束"
  987.     bluefool_sort
  988.     if @skill_window != nil
  989.       @skill_window.dispose
  990.     end
  991.     if @item_window != nil
  992.       @item_window.dispose
  993.     end
  994.     if @result_window != nil
  995.       @result_window.dispose
  996.     end
  997.     # 释放活动块
  998.     @spriteset.dispose
  999.     # 标题画面切换中的情况
  1000.     if $scene.is_a?(Scene_Title)
  1001.       # 淡入淡出画面
  1002.       Graphics.transition
  1003.       Graphics.freeze
  1004.     end
  1005.     # 战斗测试或者游戏结束以外的画面切换中的情况
  1006.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1007.       $scene = nil
  1008.     end
  1009.   end
  1010. end
  1011. #---------------------------------------------------------
  1012. class Interpreter
  1013.   def bluefool_sort
  1014.       if $am != nil
  1015.        if $a.size > Blue::NAM_MAX
  1016.           a_temp = {}
  1017.           j = 0
  1018.           for i in ($a.size - Blue::Blue_max)...$a.size
  1019.             a_temp[j] = $a[i]
  1020.             j += 1
  1021.           end  
  1022.          $a = a_temp
  1023.        end  
  1024.         if $am.length < 54
  1025.            $a[$a.size] = $am
  1026.         else
  1027.            while $am.length > 53
  1028.              i = 53
  1029.              while (/\W/ =~ $am[i-3,3]) != nil
  1030.               i -= 1
  1031.              end
  1032.              $a[$a.size] = $am[0,i]
  1033.              $am = $am[i ,$am.length - i]
  1034.            end
  1035.            $a[$a.size] = $am
  1036.         end
  1037.        $am = nil
  1038.       end
  1039.   end
  1040.   def command_101
  1041.     if $game_temp.message_text != nil
  1042.       return false
  1043.     end
  1044.     # 设置信息结束后待机和返回调用标志
  1045.     @message_waiting = true
  1046.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  1047.     # message_text 设置为 1 行
  1048.     $game_temp.message_text = @list[@index].parameters[0] + "\n"
  1049.     if (@list[@index].parameters[0]).split(/\\/)[1] != nil
  1050.      $am = @list[@index].parameters[0].split(/\\/)[0]
  1051.      else
  1052.      $am = @list[@index].parameters[0]
  1053.     end  
  1054.     bluefool_sort
  1055.     line_count = 1
  1056.     # 循环
  1057.     loop do
  1058.       # 下一个事件指令为文章两行以上的情况
  1059.       if @list[@index+1].code == 401
  1060.         # message_text 添加到第 2 行以下
  1061.         $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
  1062.         $am = @list[@index+1].parameters[0]
  1063.         bluefool_sort
  1064.         line_count += 1
  1065.       # 事件指令不在文章两行以下的情况
  1066.       else
  1067.         # 下一个事件指令为显示选择项的情况下
  1068.         if @list[@index+1].code == 102
  1069.           # 如果选择项能收纳在画面里
  1070.           if @list[@index+1].parameters[0].size <= 4 - line_count
  1071.             # 推进索引
  1072.             @index += 1
  1073.             # 设置选择项
  1074.             $game_temp.choice_start = line_count
  1075.             setup_choices(@list[@index].parameters)
  1076.           end
  1077.         # 下一个事件指令为处理输入数值的情况下
  1078.         elsif @list[@index+1].code == 103
  1079.           # 如果数值输入窗口能收纳在画面里
  1080.           if line_count < 4
  1081.             # 推进索引
  1082.             @index += 1
  1083.             # 设置输入数值
  1084.             $game_temp.num_input_start = line_count
  1085.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  1086.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  1087.           end
  1088.         end
  1089.         # 继续
  1090.         return true
  1091.       end
  1092.       # 推进索引
  1093.       @index += 1
  1094.     end
  1095.   end
  1096.   def command_125
  1097.     value = operate_value(@parameters[0], @parameters[1], @parameters[2])
  1098.     $game_party.gain_gold(value)
  1099.     if value >= 0
  1100.       $am = "#{$game_party.actors[0].name}得到了#{value}#{$data_system.words.gold}"
  1101.     else
  1102.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}#{$data_system.words.gold}"
  1103.     end  
  1104.     bluefool_sort
  1105.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1106.     return true
  1107.   end
  1108.   def command_126
  1109.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1110.     # 增减物品
  1111.     $game_party.gain_item(@parameters[0], value)
  1112.     if value >= 0
  1113.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_items[@parameters[0]].name}"
  1114.     else
  1115.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_items[@parameters[0]].name}"
  1116.     end
  1117.     bluefool_sort
  1118.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1119.     return true
  1120.   end
  1121.   def command_127
  1122.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1123.     # 增减武器
  1124.     $game_party.gain_weapon(@parameters[0], value)
  1125.     if value >= 0
  1126.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_weapons[@parameters[0]].name}"
  1127.     else
  1128.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_weapons[@parameters[0]].name}"
  1129.     end
  1130.     bluefool_sort
  1131.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1132.     return true
  1133.   end
  1134.   def command_128
  1135.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1136.     # 增减防具
  1137.     $game_party.gain_armor(@parameters[0], value)
  1138.     if value >= 0
  1139.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_armors[@parameters[0]].name}"
  1140.     else
  1141.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_armors[@parameters[0]].name}"
  1142.     end
  1143.     bluefool_sort
  1144.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1145.     return true
  1146.   end
  1147.   def command_129
  1148.     # 获取角色
  1149.     actor = $game_actors[@parameters[0]]
  1150.     # 角色有效的情况下
  1151.     if actor != nil
  1152.       # 操作分支
  1153.       if @parameters[1] == 0
  1154.         if @parameters[2] == 1
  1155.           $game_actors[@parameters[0]].setup(@parameters[0])
  1156.         end
  1157.         $game_party.add_actor(@parameters[0])
  1158.         Audio.me_play("Audio/ME/"+"002-Victory02",100,100)
  1159.         $am = "#{$game_actors[@parameters[0]].name}加入队伍!"
  1160.         bluefool_sort
  1161.       else
  1162.         $game_party.remove_actor(@parameters[0])
  1163.         Audio.me_play("Audio/ME/"+"015-Mystery01",100,100)
  1164.         $am = "#{$game_actors[@parameters[0]].name}离开队伍!"
  1165.         bluefool_sort
  1166.       end
  1167.     end
  1168.     # 继续
  1169.     return true
  1170.   end
  1171.   #-------------------------
  1172. end
  1173. #==============================================================================
  1174. # ■ Window_Down
  1175. #------------------------------------------------------------------------------
  1176. #   信息窗口。
  1177. #==============================================================================
  1178.  
  1179. class Window_Down < Window_Selectable
  1180.   #--------------------------------------------------------------------------
  1181.   # ● 初始化对像
  1182.   #--------------------------------------------------------------------------
  1183.   def initialize
  1184.     super(0, 240, 330, 240)
  1185.     @column_max = 1
  1186.     self.opacity = 0
  1187.     if $a != nil and $a.size < 21
  1188.       self.index = $a.size/2
  1189.       elsif $a != nil and $a.size > 20
  1190.       self.index = 9
  1191.     end  
  1192.     refresh
  1193.     self.active = false
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 刷新
  1197.   #--------------------------------------------------------------------------
  1198.   def refresh
  1199.     if self.contents != nil
  1200.       self.contents.dispose
  1201.       self.contents = nil
  1202.     end
  1203.     if $a != nil and $a.size < Blue::Blue_max + 1
  1204.       @item_max = $a.size
  1205.       elsif $a != nil and $a.size > Blue::Blue_max
  1206.       @item_max = Blue::Blue_max
  1207.     end  
  1208.     if @item_max > 0
  1209.       self.contents = Bitmap.new(width - 32, row_max * 16)
  1210.       for i in 0...@item_max
  1211.          draw_item(i)
  1212.       end
  1213.     end
  1214.   end
  1215.   def item_max
  1216.     return @item_max
  1217.   end  
  1218.   #--------------------------------------------------------------------------
  1219.   # ● 描绘项目
  1220.   #     index : 项目编号
  1221.   #--------------------------------------------------------------------------
  1222.   def draw_item(index)
  1223.     if $a.size < Blue::Blue_max + 1
  1224.      item = $a[index]
  1225.      else
  1226.      item = $a[index + $a.size - Blue::Blue_max]
  1227.     end
  1228.     x = 0
  1229.     y = index * 16
  1230.     self.contents.font.size = 14
  1231.     self.contents.font.color = $abc
  1232.     self.contents.draw_text(x + 6, y + 1, self.contents.text_size(item).width, 16, item, 0)
  1233.     self.contents.font.color = normal_color
  1234.     self.contents.draw_text(x + 5, y, self.contents.text_size(item).width, 16, item, 0)
  1235.   end
  1236.   #--------------------------------------
  1237.   #  ● 刷新光标
  1238.   #--------------------------------------
  1239.   def update_cursor_rect
  1240.     # 光标位置不满 0 的情况下
  1241.     if @index < 0
  1242.       self.cursor_rect.empty
  1243.       return
  1244.     end
  1245.     # 获取当前的行
  1246.     row = @index / @column_max
  1247.     # 当前行被显示开头行前面的情况下
  1248.     if row < self.top_row
  1249.       # 从当前行向开头行滚动
  1250.       self.top_row = row
  1251.     end
  1252.     # 当前行被显示末尾行之后的情况下
  1253.     if row > self.top_row + (self.page_row_max - 1)
  1254.       # 从当前行向末尾滚动
  1255.       self.top_row = row - (self.page_row_max - 1)
  1256.     end
  1257.     # 计算光标的宽
  1258.     cursor_width = self.width / @column_max - 32
  1259.     cursor_width = 0
  1260.     # 计算光标坐标
  1261.     x = @index % @column_max * (cursor_width + 32)
  1262.     y = @index / @column_max * 32 - self.oy
  1263.     # 更新国标矩形
  1264.     self.cursor_rect.set(x, y, cursor_width, 16)
  1265.   end
  1266. end

表示这个脚本的位置不好,底部被血条什么的挡住了。
想请人把他修改得底部网上移一些。最好能调。

还想改一下让下一段字的颜色可以调。
比如这句话“XXX”是红的
“YYY”是绿的

嗯还有,需要加一个开关控制
打开的话就不显示文字


最佳答案

查看完整内容

纯理论脚本,有效与否请自行验证使用前先把截图中的那段先注释掉,顺便吐槽那脚本怎么用了这么多全局变量=w=

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
2
发表于 2014-6-25 16:24:29 | 只看该作者
刺夜之枪 发表于 2014-6-28 13:16
【我把全部给了】

不过我觉得可能看着很费眼,,内容多

纯理论脚本,有效与否请自行验证
  1. Spriteset_Map.instance_eval do
  2.         alias org_init_4_arrow initialize
  3.         alias org_update_4_arrow update
  4.         alias org_dispose_4_arrow update
  5.         def initialize
  6.                 @point_arrow_object = []
  7.                 org_init_4_arrow
  8.                 display_point_arrow_team
  9.         end
  10.         def update
  11.                 @point_arrow_object.each{|a|a.update}
  12.                 org_update_4_arrow
  13.         end
  14.         def dispose
  15.                 for a in @point_arrow_object
  16.                         a.delete
  17.                         a.dispose
  18.                 end
  19.                 org_dispose_4_arrow
  20.         end
  21.         def display_point_arrow_team
  22.                 for team in $Team_Fighter
  23.                         next if team.is_a?(Game_Player)
  24.                         @point_arrow_object.push(EFS_Point_Arrow.new(@viewport3))
  25.                         @point_arrow_object[-1].display(team)
  26.                 end
  27.         end
  28. end
复制代码
使用前先把截图中的那段先注释掉,顺便吐槽那脚本怎么用了这么多全局变量=w=
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
3
发表于 2014-6-26 17:24:30 | 只看该作者
本帖最后由 英顺的马甲 于 2014-6-26 17:26 编辑

第一个问题有多种可能,单凭一个脚本难以鉴定
第二个问题简单,但需要花点时间来改脚本

p/s:第二个问题需要你对你的要求的详细说明
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1759
在线时间
2524 小时
注册时间
2010-10-12
帖子
1454

开拓者

4
 楼主| 发表于 2014-6-26 18:16:21 | 只看该作者
本帖最后由 刺夜之枪 于 2014-6-26 05:19 编辑
英顺的马甲 发表于 2014-6-26 04:24
第一个问题有多种可能,单凭一个脚本难以鉴定
第二个问题简单,但需要花点时间来改脚本


首先位置问题,,因为底部的这些字被血条什么的挡住了。
然后就想修改成底部的坐标可以又某变量X指定

接着,颜色问题。
举个例子。本来这个脚本可以输入$am = “XXXX” 来显示一句话
但现在想添加一个功能改变颜色。举个例子输入$color = "red"  【或者 Color.new(xxx,xxx,xxx,xxx)
然后再输入$am = “XXXX”,这句XXXX颜色就变了
当然有其他办法改颜色更方便的话更好

然后就可以做出这样的效果↑


然后我的第一个问题,,有没有什么解决办法。或者估计是什么原因导致的呢

点评

写了个脚本,你可以试试看  发表于 2014-6-27 01:15

回复

使用道具 举报

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
5
发表于 2014-6-27 01:01:00 | 只看该作者
本帖最后由 英顺的马甲 于 2014-6-27 16:45 编辑

RUBY 代码复制下载
  1. # 使用说明:
  2. # Notification.post(信息)          发一则提示
  3. # Notification.move(x,y,宽,高)     移动提示框位置(必须执行至少一次)
  4. # Notification.clear               清除所有提示
  5. # Notification.pause               为true期间post失效
  6. # Notification.delay               新提示发布后提示延迟消失的时间(秒)
  7. # Notification.opacity             不透明度,请配合pause一起使用
  8. # Notification.font                提示字体(包括大小及颜色)
  9. # Notification.limit               提示限制
  10.  
  11. Notification = Class.new do
  12.   attr_accessor :font, :msg
  13.   @@font = nil
  14.   @@sprite = Sprite.new
  15.   @@sprite.bitmap = Bitmap.new(1,1)
  16.   @@sprite.z = 999999
  17.   @@limit = 20
  18.   @@delay = 3
  19.   @@opacity = 0
  20.   @@pause = false
  21.   @@count = @@delay * 40
  22.   def self.move(x,y,width,height)
  23.     @@sprite.x = x
  24.     @@sprite.y = y
  25.     @@sprite.bitmap.dispose
  26.     @@sprite.bitmap = Bitmap.new(width, height)
  27.     self.redraw unless $game_system == nil
  28.   end
  29.   def self.limit=(max)
  30.     @@limit = max
  31.   end
  32.   def self.font
  33.     return @@font.nil? ? Font.new : @@font
  34.   end
  35.   def self.font=(fon)
  36.     @@font = fon
  37.   end
  38.   def self.post(msg)
  39.     return if @@pause
  40.     $game_system.notifications.push(new(msg))
  41.     while $game_system.notifications.size > 50
  42.       $game_system.notifications.delete_at(0)
  43.     end
  44.     self.redraw unless $game_system == nil
  45.     self.opacity = 255
  46.     @@count = @@delay * 40
  47.   end
  48.   def self.clear
  49.     $game_system.notifications = []
  50.     self.redraw
  51.   end
  52.   def self.redraw
  53.     b = @@sprite.bitmap
  54.     b.clear
  55.     b2 = Bitmap.new(b.width,640)
  56.     y = b.height
  57.     for n in $game_system.notifications.reverse[0,@@limit]
  58.       x = 0
  59.       y2 = 0
  60.       b2.font = n.font
  61.       h = b2.text_size(n.msg).height
  62.       n.msg.split('').each do |char|
  63.         if (x + b2.text_size(char).width) > b2.width
  64.           x = 0
  65.           y2 += h
  66.         end
  67.         b2.draw_text(x,y2,b2.width,h,char)
  68.         x += b2.text_size(char).width + 2
  69.       end
  70.       y -= (y2 + h)
  71.       b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
  72.       b2.clear
  73.       y -= 4
  74.     end
  75.     b2.dispose
  76.   end
  77.   def self.update
  78.     return @@count -= 1 if @@count > 0
  79.     self.opacity -= 10 if self.opacity > 0
  80.   end
  81.   def initialize(msg)
  82.     @font = @@font.nil? ? Font.new : @@font.clone
  83.     @msg = msg
  84.   end
  85.   def self.show
  86.     @@sprite.visible = true
  87.   end
  88.   def self.hide
  89.     @@sprite.visible = false
  90.   end
  91.   def self.pause
  92.     return @@pause
  93.   end
  94.   def self.pause=(bool)
  95.     @@pause = true
  96.   end
  97.   def self.delay
  98.     return @@delay
  99.   end
  100.   def self.delay=(val)
  101.  
  102.     @@delay = val
  103.   end
  104.   def self.opacity
  105.     return @@sprite.opacity
  106.   end
  107.   def self.opacity=(val)
  108.     @@sprite.opacity = val
  109.   end
  110.   def _dump(limit)
  111.     bin = []
  112.     bin.push(@font.size)
  113.     bin.push((@font.bold ? 1 : 0) + (@font.italic ? 16 : 0))
  114.     bin.push(@font.color.red)
  115.     bin.push(@font.color.green)
  116.     bin.push(@font.color.blue)
  117.     bin.push(@font.color.alpha)
  118.     bin = bin.pack("C*")
  119.     @font.name = [@font.name] unless !@font.name.is_a?(Array)
  120.     bin += (@font.name + [@msg]).join("\000:\000")
  121.     return bin
  122.   end
  123.   def self._load(bin)
  124.     bin = bin.unpack("C*")
  125.     no = new("")
  126.     no.font.size = bin.delete_at(0)
  127.     no.font.bold = (bin[0] % 16 > 0)
  128.     no.font.italic = (bin.delete_at(0) / 16 > 0)
  129.     no.font.color = Color.new(*bin[0,4])
  130.     bin[0,4]=[]
  131.     strs = bin.pack("C*").split("\000:\000")
  132.     no.msg = strs.delete_at(-1)
  133.     no.font.name = strs
  134.     return no
  135.   end
  136. end
  137. Game_System.class_eval do
  138.   attr_accessor :notifications
  139.   OrgInitialize4Notf = instance_method('initialize')
  140.   def initialize(*args)
  141.     OrgInitialize4Notf.bind(self).call(*args)
  142.     @notifications = []
  143.   end
  144. end
  145. Scene_Map.class_eval do
  146.   OrgMain4Notf = instance_method('main')
  147.   OrgUpdate4Notf = instance_method('update')
  148.   def main(*args)
  149.     Notification.show
  150.     OrgMain4Notf.bind(self).call(*args)
  151.     Notification.hide
  152.   end
  153.   def update(*args)
  154.     Notification.update
  155.     OrgUpdate4Notf.bind(self).call(*args)
  156.   end
  157. end
  158. Scene_Load.class_eval do
  159.   OrgReadData4Notf = instance_method('read_save_data')
  160.   def read_save_data(*args)
  161.     OrgReadData4Notf.bind(self).call(*args)
  162.     Notification.redraw
  163.     Notification.opacity = 0
  164.   end
  165. end
  166. Game_Party.class_eval do
  167.   OrgMeth4Notf = {}
  168.   ["add_actor","remove_actor","gain_gold","gain_item","gain_weapon","gain_armor"].each do |meth|
  169.     OrgMeth4Notf[meth] = instance_method(meth)
  170.   end
  171.   def add_actor(id,*args)
  172.     actor = $game_actors[id]
  173.     if @actors.size < 4 and not @actors.include?(actor)
  174.       Notification.push(actor.name + "加入队伍!")
  175.     end
  176.     OrgMeth4Notf['add_actor'].bind(self).call(id,*args)
  177.   end
  178.   def remove_actor(id,*args)
  179.     actor = $game_actors[id]
  180.     if @actors.include?(actor)
  181.       Notification.push(actor.name + "离开队伍!")
  182.     end
  183.     OrgMeth4Notf['remove_actor'].bind(self).call(id,*args)
  184.   end
  185.   def gain_gold(*args)
  186.     gold_old = @gold
  187.     OrgMeth4Notf['gain_gold'].bind(self).call(*args)
  188.     if gold_old != @gold
  189.       value = @gold - gold_old
  190.       msg = "#{$game_party.actors[0].name}"+(value > 0 ? "得到" : "失去")+"了#{value.abs}#{$data_system.words.gold}"
  191.       Notification.post(msg)
  192.     end
  193.   end
  194.   def gain_item(id,*args)
  195.     num_old = item_number(id)
  196.     OrgMeth4Notf['gain_item'].bind(self).call(id,*args)
  197.     if num_old != item_number(id)
  198.       value = item_number(id) - num_old
  199.       msg = "#{$game_party.actors[0].name}"+(value > 0 ? "得到" : "失去")+"了#{value.abs}个#{$data_items[id].name}"
  200.       Notification.post(msg)
  201.     end
  202.   end
  203.   def gain_weapon(id,*args)
  204.     num_old = weapon_number(id)
  205.     OrgMeth4Notf['gain_weapon'].bind(self).call(id,*args)
  206.     if num_old != @gold
  207.       value = weapon_number(id) - num_old
  208.       msg = "#{$game_party.actors[0].name}"+(value > 0 ? "得到" : "失去")+"了#{value.abs}个#{$data_weapons[id].name}"
  209.       Notification.post(msg)
  210.     end
  211.   end
  212.   def gain_armor(id,*args)
  213.     num_old = armor_number(id)
  214.     OrgMeth4Notf['gain_armor'].bind(self).call(id,*args)
  215.     if num_old != @gold
  216.       value = armor_number(id) - num_old
  217.       msg = "#{$game_party.actors[0].name}"+(value > 0 ? "得到" : "失去")+"了#{value.abs}个#{$data_armors[id].name}"
  218.       Notification.post(msg)
  219.     end
  220.   end
  221. end
你给的脚本看似雷人,于是我重写了一个更雷人的,怎么用自己研究(反正你会脚本)
有图有真相:

如果懒惰改脚本的话就加上这句(我的脚本是自动换行,所以那blue啥sort的能全删了)
RUBY 代码复制
  1. trace_var :$am do |val|
  2.   Notification.post(val)
  3. end
p/s:第一个问题出现的原因的可能性有被释放,被遮挡,被隐藏和被清除

点评

顺便-A- 我的第一问题您会么  发表于 2014-6-27 17:52
终于成功了!辛苦您了。 其实刚才我就在纠结这个为什么不显示 研究了半天发现是Notification.move 的数值输得不对。 真心感谢了,用起来比原来的好  发表于 2014-6-27 17:51
求工程  发表于 2014-6-27 16:54
那么,,怎么才能用呢  发表于 2014-6-27 16:44
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1759
在线时间
2524 小时
注册时间
2010-10-12
帖子
1454

开拓者

6
 楼主| 发表于 2014-6-27 07:55:13 | 只看该作者
英顺的马甲 发表于 2014-6-26 12:01
# 使用说明:
# Notification.post(信息)          发一则提示
# Notification.move(x,y,宽,高)     移动提 ...

果然很雷人的写法= =
上来就报错,有拼写错误,然后陆陆续续还有别的报错

我以为是脚本冲突了,重新开了一个又这样

点评

要解决第一个问题的第一步就是先找到哪行出错  发表于 2014-6-27 18:14
你不是会一些脚本么?==  发表于 2014-6-27 17:02
已更新,请验收,顺便加了个功能==  发表于 2014-6-27 16:55
抱歉,改了点东西后忘记运行试试看了==  发表于 2014-6-27 16:34
纳尼?!错误提示呢?  发表于 2014-6-27 16:29

回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1759
在线时间
2524 小时
注册时间
2010-10-12
帖子
1454

开拓者

7
 楼主| 发表于 2014-6-27 18:55:11 | 只看该作者
英顺的马甲 发表于 2014-6-26 12:01
# 使用说明:
# Notification.post(信息)          发一则提示
# Notification.move(x,y,宽,高)     移动提 ...

-A-
找不出来,可能跟我写的太烂然后就不知不觉错了
估计要重写了、、  

点评

在每行脚本前都p点不同的东西,看是哪行过后出错的==  发表于 2014-6-27 21:30

回复

使用道具 举报

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
8
发表于 2014-6-27 23:01:07 | 只看该作者
本帖最后由 英顺的马甲 于 2014-6-27 23:02 编辑
刺夜之枪 发表于 2014-6-27 18:55
-A-
找不出来,可能跟我写的太烂然后就不知不觉错了
估计要重写了、、  


刚刚仔细看了你的截图,你试着把第48行的@viewport1换成@viewport2看看吧==
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1759
在线时间
2524 小时
注册时间
2010-10-12
帖子
1454

开拓者

9
 楼主| 发表于 2014-6-28 08:25:49 | 只看该作者
英顺的马甲 发表于 2014-6-27 10:01
刚刚仔细看了你的截图,你试着把第48行的@viewport1换成@viewport2看看吧==


我改成vieport2了
然后又简单改了下。
于是变成下面这样了


一开始确实是在应该在的地方


一打开菜单,箭头出现在菜单里了


关闭菜单后箭头就没了

不过每次打开菜单后都出现在了同一个位置

没有报错,所以不知道哪行出了问题

点评

要不然把有问题的脚本脱离出来让我看看也行==  发表于 2014-6-28 13:05

回复

使用道具 举报

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
10
发表于 2014-6-28 11:41:18 | 只看该作者
你忘了释放了==
能给上完整脚本不?这样实在难以鉴定问题所在 OTZ

点评

求QQ,工程不方便放上来 QuQ  发表于 2014-6-28 12:43
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 05:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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