Project1

标题: 關於精英怪物的另一個問題 [打印本页]

作者: e900003    时间: 2015-5-18 13:44
标题: 關於精英怪物的另一個問題
本帖最后由 e900003 于 2015-5-18 14:23 编辑

如題 前幾天發的帖子
我還想要的效果是精英怪物裡面有分很多種類

然後一種精英怪會施放自己額外設定的技能

最後種類名稱就自己命名 並且命名在怪物名稱的前面或後面 例如 XX的幽靈

請問腳本要怎麼改成這種效果
作者: 芯☆淡茹水    时间: 2015-5-18 18:34
唉~,已经帮了一次,第二次就顺手了
  1. #==============================================================================
  2. class Game_Enemy < Game_Battler
  3. #精英怪使用的技能的开关标志,这个开关处于常闭状态,不需要打开,只是一个精英怪
  4. #特有技能的判断标志。在设置精英怪特有的行动技能时,勾选上该开关。
  5. SIGN_SWITCH_ID = 1
  6. #精英怪前缀名。
  7. PERFIX_NAME = "精英·"
  8.   #--------------------------------------------------------------------------
  9.   # ● 获取名称
  10.   #--------------------------------------------------------------------------
  11.   def name
  12.     return is_by? ? PERFIX_NAME + $data_enemies[@enemy_id].name : $data_enemies[@enemy_id].name
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 生成行动
  16.   #--------------------------------------------------------------------------
  17.   def make_action
  18.     # 清除当前行动
  19.     self.current_action.clear
  20.     # 无法行动的情况
  21.     unless self.movable?
  22.       # 过程结束
  23.       return
  24.     end
  25.     # 抽取现在有效的行动
  26.     available_actions = []
  27.     rating_max = 0
  28.     for action in self.actions
  29.       # 确认回合条件
  30.       n = $game_temp.battle_turn
  31.       a = action.condition_turn_a
  32.       b = action.condition_turn_b
  33.       if (b == 0 and n != a) or
  34.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  35.         next
  36.       end
  37.       # 确认 HP 条件
  38.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  39.         next
  40.       end
  41.       # 确认等级条件
  42.       if $game_party.max_level < action.condition_level
  43.         next
  44.       end
  45.       # 确认开关条件
  46.       switch_id = action.condition_switch_id
  47.       if switch_id > 0
  48.         #===X☆R ====================================
  49.         if switch_id != SIGN_SWITCH_ID or ! is_by?
  50.           next if $game_switches[switch_id] == false
  51.         end
  52.         #============================================
  53.       end
  54.       # 符合条件 : 添加本行动
  55.       available_actions.push(action)
  56.       if action.rating > rating_max
  57.         rating_max = action.rating
  58.       end
  59.     end
  60.     # 最大概率值作为 3 合计计算(0 除外)
  61.     ratings_total = 0
  62.     for action in available_actions
  63.       if action.rating > rating_max - 3
  64.         ratings_total += action.rating - (rating_max - 3)
  65.       end
  66.     end
  67.     # 概率合计不为 0 的情况下
  68.     if ratings_total > 0
  69.       # 生成随机数
  70.       value = rand(ratings_total)
  71.       # 设置对应生成随机数的当前行动
  72.       for action in available_actions
  73.         if action.rating > rating_max - 3
  74.           if value < action.rating - (rating_max - 3)
  75.             self.current_action.kind = action.kind
  76.             self.current_action.basic = action.basic
  77.             self.current_action.skill_id = action.skill_id
  78.             self.current_action.decide_random_target_for_enemy
  79.             return
  80.           else
  81.             value -= action.rating - (rating_max - 3)
  82.           end
  83.         end
  84.       end
  85.     end
  86.   end
  87. end
  88. #==============================================================================
复制代码

作者: e900003    时间: 2015-5-19 15:17
芯☆淡茹水 发表于 2015-5-18 18:34
唉~,已经帮了一次,第二次就顺手了

剛測試過  變成精英怪物之後 放不出精英怪的專有技能...




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1