Project1

标题: 请问一下VA的敌人等级脚本怎么设置 [打印本页]

作者: ♂雨    时间: 2015-6-30 15:37
标题: 请问一下VA的敌人等级脚本怎么设置
VA整合系统的敌人等级脚本不知道怎么给敌人设置,找了很多方法都没用,求解答脚本如下。
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Enemy Levels v1.01
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-EnemyLevels"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.24 - Added <hide level> notetag for enemies.
  17. #            - Option to change Party Level function in Action Conditions to
  18. #              enemy level requirements.
  19. # 2011.12.30 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ▼ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # RPG's with enemies that level up with the party enforces the player to stay
  25. # on their toes the whole time. This is both a good and bad thing as it can
  26. # cause the player to stay alert, but can also cause the player to meet some
  27. # roadblocks. This script will not only provide enemies the ability to level up
  28. # but also allow the script's user to go around these roadblocks using various
  29. # tags to limit or slow down the rate of growth across all enemies.
  30. #
  31. #==============================================================================
  32. # ▼ Instructions
  33. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. # To install this script, open up your script editor and copy/paste this script
  35. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  36. #
  37. # -----------------------------------------------------------------------------
  38. # Skill Notetags - These notetags go in the skill notebox in the database.
  39. # -----------------------------------------------------------------------------
  40. # <enemy level: +x>
  41. # <enemy level: -x>
  42. # This causes the enemy to raise or drop x levels depending on the tag used.
  43. # The new level will readjust the enemy's stats (including HP and MP).
  44. #
  45. # <enemy level reset>
  46. # This resets the enemy's level back to the typical range it should be plus or
  47. # minus any level fluctuations it was given. This occurs before enemy level +
  48. # and enemy level - tags.
  49. #
  50. # -----------------------------------------------------------------------------
  51. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  52. # -----------------------------------------------------------------------------
  53. # <hide level>
  54. # This notetag will hide the level of the enemy. If YEA - Enemy Target Info is
  55. # installed, the level will be revealed upon a parameter scan.
  56. #
  57. # <min level: x>
  58. # <max level: x>
  59. # This will adjust the minimum and maximum levels for the enemy. By default,
  60. # the minimum level is 1 and the maximum level is whatever is set in the module
  61. # as MAX_LEVEL.
  62. #
  63. # <set level: x>
  64. # This will set the enemy's level to exactly x. It a sense, this is just the
  65. # usage of both the min and max level tags together as the same value.
  66. #
  67. # <level type: x>
  68. # Choosing a value from 0 to 4, you can adjust the different leveling rulesets
  69. # for the enemy. See the list below.
  70. # Type 0 - Lowest level of all actors that have joined.
  71. # Type 1 - Lowest level in the battle party.
  72. # Type 2 - Average level of the battle party.
  73. # Type 3 - Highest level of the battle party.
  74. # Type 4 - Highest level of all actors that have joined.
  75. #
  76. # <level random: x>
  77. # This will give the level a random flunctuation in either direction. Set this
  78. # value to 0 if you don't wish to use it. Adjust RANDOM_FLUCTUATION inside the
  79. # module to change the default fluctuation value.
  80. #
  81. # <stat: +x per level>
  82. # <stat: -x per level>
  83. # <stat: +x% per level>
  84. # <stat: -x% per level>
  85. # This will raise or lower the stat by x or x% per level (depending on the tag
  86. # used). This will override the default growth settings found inside the module
  87. # hash called DEFAULT_GROWTH. You may replace stat with:
  88. # MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, GOLD, EXP
  89. #
  90. #==============================================================================
  91. # ▼ Compatibility
  92. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  93. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  94. # it will run with RPG Maker VX without adjusting.
  95. #
  96. #==============================================================================
  97.  
  98. module YEA
  99.   module ENEMY_LEVEL
  100.  
  101.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  102.     # - General Level Settings -
  103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104.     # These settings adjust the general level setup for your enemies from the
  105.     # way levels appear in the game to the default maximum level for enemies,
  106.     # to the way their levels are calculated by default, and the random level
  107.     # fluctuation they have. If you want enemies to have different settings,
  108.     # use notetags to change the respective setting.
  109.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  110.     # This is how the level text will appear whenever enemy levels are shown.
  111.     LEVEL_TEXT = "LV%s %s"
  112.  
  113.     # This is the maximum level your enemies can achieve. They cannot go higher
  114.     # no exceptions. Adjust this accordingly to fit your game.
  115.     MAX_LEVEL = 1000
  116.  
  117.     # Default level calculations for your enemies will be adjusted as such.
  118.     # Type 0 - Lowest level of all actors that have joined.
  119.     # Type 1 - Lowest level in the battle party.
  120.     # Type 2 - Average level of the battle party.
  121.     # Type 3 - Highest level of the battle party.
  122.     # Type 4 - Highest level of all actors that have joined.
  123.     DEFAULT_LEVEL_TYPE = 2
  124.  
  125.     # If you want your enemies to have random +/- levels of some degree, change
  126.     # this number to something other than 0. This is the default value.
  127.     RANDOM_FLUCTUATION = 2
  128.  
  129.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  130.     # - Parameter Growth Settings -
  131.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  132.     # Here, you adjust how much stats grow for enemies by default, including
  133.     # the formula used to calculate those stats. If you wish for enemies to
  134.     # have different growth settings, use notetags to change them.
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # These settings adjust the default growth rates (not the base stat formula)
  137.     # for each stat. These are the values that will exist for each enemy unless
  138.     # defined otherwise by the tags inside their noteboxes.
  139.     DEFAULT_GROWTH ={
  140.     # ParamID => [:param, per%, +set],
  141.             0 => [:maxhp, 0.15,   50],
  142.             1 => [:maxmp, 0.10,   10],
  143.             2 => [  :atk, 0.05,    5],
  144.             3 => [  :def, 0.05,    5],
  145.             4 => [  :mat, 0.05,    5],
  146.             5 => [  :mdf, 0.05,    5],
  147.             6 => [  :agi, 0.05,    5],
  148.             7 => [  :luk, 0.05,    5],
  149.             8 => [ :gold, 0.15,   10],
  150.             9 => [  :exp, 0.05,   10],
  151.     } # Do not remove this.
  152.  
  153.     # The following hash will adjust each of the formulas for each base stat.
  154.     # Adjust them as you see fit but only if you know what you're doing.
  155.     #   base  - The base stat from the enemy database.
  156.     #   per   - Growth rate which has not been yet converted to a percent.
  157.     #   set   - Set growth rate. Modified
  158.     # Default:   "base * (1.00 + (level-1) * per) + (set * (level-1))"
  159.     STAT_FORMULA = "base * (1.00 + (level-1) * per) + (set * (level-1))"
  160.  
  161.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  162.     # - Party Level to Enemy Level Action Conditions -
  163.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  164.     # Setting the below to true will cause the Party Level requirement under
  165.     # Action Conditions in the Action Patterns list to become an Enemy Level
  166.     # requirement. The enemy must be at least the level or else it cannot use
  167.     # the listed action.
  168.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  169.     PARTY_LEVEL_TO_ENEMY_LEVEL = true
  170.  
  171.   end # ENEMY_LEVEL
  172. end # YEA
  173.  
  174. #==============================================================================
  175. # ▼ Editting anything past this point may potentially result in causing
  176. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  177. # halitosis so edit at your own risk.
  178. #==============================================================================
  179.  
  180. module YEA
  181.   module REGEXP
  182.   module USABLEITEM
  183.  
  184.     LEVEL_CHANGE = /<(?:ENEMY LEVEL|enemy level):[ ]([\+\-]\d+)>/i
  185.     LEVEL_RESET  = /<(?:ENEMY LEVEL RESET|enemy level reset)>/i
  186.  
  187.   end # USABLEITEM
  188.   module ENEMY
  189.  
  190.     LEVEL_TYPE = /<(?:LEVEL_TYPE|level type):[ ](\d+)>/i
  191.     LEVEL_MIN = /<(?:MIN_LEVEL|min level|minimum level):[ ](\d+)>/i
  192.     LEVEL_MAX = /<(?:MAX_LEVEL|max level|maximum level):[ ](\d+)>/i
  193.     LEVEL_SET = /<(?:SET_LEVEL|set level|permanent level):[ ](\d+)>/i
  194.  
  195.     LEVEL_RAND = /<(?:LEVEL_RANDOM|level random):[ ](\d+)>/i
  196.     GROWTH_PER = /<(.*):[ ]([\+\-]\d+)([%%])[ ](?:PER_LEVEL|per level)>/i
  197.     GROWTH_SET = /<(.*):[ ]([\+\-]\d+)[ ](?:PER_LEVEL|per level)>/i
  198.  
  199.     HIDE_LEVEL = /<(?:HIDE_LEVEL|hide level)>/i
  200.  
  201.   end # ENEMY
  202.   end # REGEXP
  203. end # YEA
  204.  
  205. #==============================================================================
  206. # ■ Numeric
  207. #==============================================================================
  208.  
  209. class Numeric
  210.  
  211.   #--------------------------------------------------------------------------
  212.   # new method: group_digits
  213.   #--------------------------------------------------------------------------
  214.   unless $imported["YEA-CoreEngine"]
  215.   def group; return self.to_s; end
  216.   end # $imported["YEA-CoreEngine"]
  217.  
  218. end # Numeric
  219.  
  220. #==============================================================================
  221. # ■ DataManager
  222. #==============================================================================
  223.  
  224. module DataManager
  225.  
  226.   #--------------------------------------------------------------------------
  227.   # alias method: load_database
  228.   #--------------------------------------------------------------------------
  229.   class <<self; alias load_database_elv load_database; end
  230.   def self.load_database
  231.     load_database_elv
  232.     load_notetags_elv
  233.   end
  234.  
  235.   #--------------------------------------------------------------------------
  236.   # new method: load_notetags_elv
  237.   #--------------------------------------------------------------------------
  238.   def self.load_notetags_elv
  239.     groups = [$data_enemies, $data_skills, $data_items]
  240.     for group in groups
  241.       for obj in group
  242.         next if obj.nil?
  243.         obj.load_notetags_elv
  244.       end
  245.     end
  246.   end
  247.  
  248. end # DataManager
  249.  
  250. #==============================================================================
  251. # ■ RPG::UsableItem
  252. #==============================================================================
  253.  
  254. class RPG::UsableItem < RPG::BaseItem
  255.  
  256.   #--------------------------------------------------------------------------
  257.   # public instance variables
  258.   #--------------------------------------------------------------------------
  259.   attr_accessor :level_change
  260.   attr_accessor :level_reset
  261.  
  262.   #--------------------------------------------------------------------------
  263.   # common cache: load_notetags_elv
  264.   #--------------------------------------------------------------------------
  265.   def load_notetags_elv
  266.     @level_change = 0
  267.     @level_reset = false
  268.     #---
  269.     self.note.split(/[\r\n]+/).each { |line|
  270.       case line
  271.       #---
  272.       when YEA::REGEXP::USABLEITEM::LEVEL_CHANGE
  273.         @level_change = $1.to_i
  274.       when YEA::REGEXP::USABLEITEM::LEVEL_RESET
  275.         @level_reset = true
  276.       end
  277.     } # self.note.split
  278.     #---
  279.   end
  280.  
  281. end # RPG::UsableItem
  282.  
  283. #==============================================================================
  284. # ■ RPG::Enemy
  285. #==============================================================================
  286.  
  287. class RPG::Enemy < RPG::BaseItem
  288.  
  289.   #--------------------------------------------------------------------------
  290.   # public instance variables
  291.   #--------------------------------------------------------------------------
  292.   attr_accessor :hide_level
  293.   attr_accessor :level_type
  294.   attr_accessor :level_min
  295.   attr_accessor :level_max
  296.   attr_accessor :level_rand
  297.   attr_accessor :level_growth
  298.  
  299.   #--------------------------------------------------------------------------
  300.   # common cache: load_notetags_elv
  301.   #--------------------------------------------------------------------------
  302.   def load_notetags_elv
  303.     @hide_level = false
  304.     @level_type = YEA::ENEMY_LEVEL::DEFAULT_LEVEL_TYPE
  305.     @level_min = 1
  306.     @level_max = YEA::ENEMY_LEVEL::MAX_LEVEL
  307.     @level_rand = YEA::ENEMY_LEVEL::RANDOM_FLUCTUATION
  308.     @level_growth = YEA::ENEMY_LEVEL::DEFAULT_GROWTH.clone
  309.     #---
  310.     self.note.split(/[\r\n]+/).each { |line|
  311.       case line
  312.       #---
  313.       when YEA::REGEXP::ENEMY::HIDE_LEVEL
  314.         @hide_level = true
  315.       when YEA::REGEXP::ENEMY::LEVEL_TYPE
  316.         @level_type = $1.to_i
  317.       when YEA::REGEXP::ENEMY::LEVEL_MIN
  318.         @level_min = [$1.to_i, 1].max
  319.       when YEA::REGEXP::ENEMY::LEVEL_MAX
  320.         @level_max = [$1.to_i, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  321.       when YEA::REGEXP::ENEMY::LEVEL_SET
  322.         @level_min = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  323.         @level_max = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  324.       when YEA::REGEXP::ENEMY::LEVEL_RAND
  325.         @level_rand = $1.to_i
  326.       #---
  327.       when YEA::REGEXP::ENEMY::GROWTH_PER
  328.         case $1.upcase
  329.         when "MAXHP", "MHP", "HP"
  330.           type = 0
  331.         when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
  332.           type = 1
  333.         when "ATK", "ATTACK"
  334.           type = 2
  335.         when "DEF", "DEFENSE"
  336.           type = 3
  337.         when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
  338.           type = 4
  339.         when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
  340.           type = 5
  341.         when "AGI", "AGILITY"
  342.           type = 6
  343.         when "LUK", "LUCK"
  344.           type = 7
  345.         when "GOLD", "MONEY"
  346.           type = 8
  347.         when "EXP", "EXPERIENCE", "XP"
  348.           type = 9
  349.         else; next
  350.         end
  351.         @level_growth[type][1] = $2.to_i * 0.01
  352.       when YEA::REGEXP::ENEMY::GROWTH_SET
  353.         case $1.upcase
  354.         when "MAXHP", "MHP", "HP"
  355.           type = 0
  356.         when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
  357.           type = 1
  358.         when "ATK", "ATTACK"
  359.           type = 2
  360.         when "DEF", "DEFENSE"
  361.           type = 3
  362.         when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
  363.           type = 4
  364.         when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
  365.           type = 5
  366.         when "AGI", "AGILITY"
  367.           type = 6
  368.         when "LUK", "LUCK"
  369.           type = 7
  370.         when "GOLD", "MONEY"
  371.           type = 8
  372.         when "EXP", "EXPERIENCE", "XP"
  373.           type = 9
  374.         else; next
  375.         end
  376.         @level_growth[type][2] = $2.to_i
  377.       end
  378.     } # self.note.split
  379.     #---
  380.   end
  381.  
  382. end # RPG::Enemy
  383.  
  384. #==============================================================================
  385. # ■ Game_Battler
  386. #==============================================================================
  387.  
  388. class Game_Battler < Game_BattlerBase
  389.  
  390.   #--------------------------------------------------------------------------
  391.   # alias method: item_user_effect
  392.   #--------------------------------------------------------------------------
  393.   alias game_battler_item_user_effect_elv item_user_effect
  394.   def item_user_effect(user, item)
  395.     game_battler_item_user_effect_elv(user, item)
  396.     apply_level_changes(item) if self.is_a?(Game_Enemy)
  397.   end
  398.  
  399. end # Game_Battler
  400.  
  401. #==============================================================================
  402. # ■ Game_Enemy
  403. #==============================================================================
  404.  
  405. class Game_Enemy < Game_Battler
  406.  
  407.   #--------------------------------------------------------------------------
  408.   # alias method: initialize
  409.   #--------------------------------------------------------------------------
  410.   alias game_enemy_initialize_elv initialize
  411.   def initialize(index, enemy_id)
  412.     game_enemy_initialize_elv(index, enemy_id)
  413.     create_init_level
  414.   end
  415.  
  416.   #--------------------------------------------------------------------------
  417.   # new method: level
  418.   #--------------------------------------------------------------------------
  419.   def level
  420.     create_init_level if @level.nil?
  421.     return @level
  422.   end
  423.  
  424.   #--------------------------------------------------------------------------
  425.   # new method: level=
  426.   #--------------------------------------------------------------------------
  427.   def level=(value)
  428.     create_init_level if @level.nil?
  429.     return if @level == value
  430.     hp_rate = self.hp.to_f / self.mhp.to_f
  431.     mp_rate = self.mp.to_f / [self.mmp, 1].max.to_f
  432.     @level = [[value, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  433.     self.hp = (self.mhp * hp_rate).to_i
  434.     self.mp = (self.mmp * mp_rate).to_i
  435.   end
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # new method: create_init_level
  439.   #--------------------------------------------------------------------------
  440.   def create_init_level
  441.     set_level_type
  442.     @hp = mhp
  443.     @mp = mmp
  444.   end
  445.  
  446.   #--------------------------------------------------------------------------
  447.   # new method: set_level_type
  448.   #--------------------------------------------------------------------------
  449.   def set_level_type
  450.     @level = $game_party.match_party_level(enemy.level_type)
  451.     @level += rand(enemy.level_rand+1)
  452.     @level -= rand(enemy.level_rand+1)
  453.     @level = [[@level, enemy.level_max].min, enemy.level_min].max
  454.   end
  455.  
  456.   #--------------------------------------------------------------------------
  457.   # alias method: transform
  458.   #--------------------------------------------------------------------------
  459.   alias game_enemy_transform_elv transform
  460.   def transform(enemy_id)
  461.     game_enemy_transform_elv(enemy_id)
  462.     create_init_level
  463.   end
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # new method: apply_level_changes
  467.   #--------------------------------------------------------------------------
  468.   def apply_level_changes(item)
  469.     create_init_level if item.level_reset
  470.     self.level += item.level_change
  471.   end
  472.  
  473.   #--------------------------------------------------------------------------
  474.   # alias method: param_base
  475.   #--------------------------------------------------------------------------
  476.   alias game_enemy_param_base_elv param_base
  477.   def param_base(param_id)
  478.     base = game_enemy_param_base_elv(param_id)
  479.     per = enemy.level_growth[param_id][1]
  480.     set = enemy.level_growth[param_id][2]
  481.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  482.     return total.to_i
  483.   end
  484.  
  485.   #--------------------------------------------------------------------------
  486.   # alias method: exp
  487.   #--------------------------------------------------------------------------
  488.   alias game_enemy_exp_elv exp
  489.   def exp
  490.     base = game_enemy_exp_elv
  491.     per = enemy.level_growth[8][1]
  492.     set = enemy.level_growth[8][2]
  493.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  494.     return total.to_i
  495.   end
  496.  
  497.   #--------------------------------------------------------------------------
  498.   # alias method: gold
  499.   #--------------------------------------------------------------------------
  500.   alias game_enemy_gold_elv gold
  501.   def gold
  502.     base = game_enemy_gold_elv
  503.     per = enemy.level_growth[9][1]
  504.     set = enemy.level_growth[9][2]
  505.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  506.     return total.to_i
  507.   end
  508.  
  509.   #--------------------------------------------------------------------------
  510.   # alias method: name
  511.   #--------------------------------------------------------------------------
  512.   alias game_enemy_name_elv name
  513.   def name
  514.     text = game_enemy_name_elv
  515.     if add_level_name?
  516.       fmt = YEA::ENEMY_LEVEL::LEVEL_TEXT
  517.       text = sprintf(fmt, @level.group, text)
  518.     end
  519.     return text
  520.   end
  521.  
  522.   #--------------------------------------------------------------------------
  523.   # new method: add_level_name?
  524.   #--------------------------------------------------------------------------
  525.   def add_level_name?
  526.     if $imported["YEA-EnemyTargetInfo"] && show_info_param?
  527.       return true
  528.     end
  529.     return false if enemy.hide_level
  530.     return true
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # overwrite method: conditions_met_party_level?
  535.   #--------------------------------------------------------------------------
  536.   if YEA::ENEMY_LEVEL::PARTY_LEVEL_TO_ENEMY_LEVEL
  537.   def conditions_met_party_level?(param1, param2)
  538.     return @level >= param1
  539.   end
  540.   end
  541.  
  542. end # Game_Enemy
  543.  
  544. #==============================================================================
  545. # ■ Game_Party
  546. #==============================================================================
  547.  
  548. class Game_Party < Game_Unit
  549.  
  550.   #--------------------------------------------------------------------------
  551.   # new method: match_party_level
  552.   #--------------------------------------------------------------------------
  553.   def match_party_level(level_type)
  554.     case level_type
  555.     when 0; return all_lowest_level
  556.     when 1; return lowest_level
  557.     when 2; return average_level
  558.     when 3; return highest_level
  559.     else;   return all_highest_level
  560.     end
  561.   end
  562.  
  563.   #--------------------------------------------------------------------------
  564.   # new method: all_lowest_level
  565.   #--------------------------------------------------------------------------
  566.   def all_lowest_level
  567.     lv = all_members.collect {|actor| actor.level }.min
  568.     return lv
  569.   end
  570.  
  571.   #--------------------------------------------------------------------------
  572.   # new method: lowest_level
  573.   #--------------------------------------------------------------------------
  574.   def lowest_level
  575.     lv = members.collect {|actor| actor.level }.min
  576.     return lv
  577.   end
  578.  
  579.   #--------------------------------------------------------------------------
  580.   # new method: average_level
  581.   #--------------------------------------------------------------------------
  582.   def average_level
  583.     lv = 0
  584.     for member in all_members; lv += member.level; end
  585.     lv /= all_members.size
  586.     return lv
  587.   end
  588.  
  589.   #--------------------------------------------------------------------------
  590.   # overwrite method: highest_level
  591.   #--------------------------------------------------------------------------
  592.   def highest_level
  593.     lv = members.collect {|actor| actor.level }.max
  594.     return lv
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # all method: all_highest_level
  599.   #--------------------------------------------------------------------------
  600.   def all_highest_level
  601.     lv = all_members.collect {|actor| actor.level }.max
  602.     return lv
  603.   end
  604.  
  605. end # Game_Party
  606.  
  607. #==============================================================================
  608. #
  609. # ▼ End of File
  610. #
  611. #==============================================================================

作者: 正太君    时间: 2015-6-30 17:13
在数据库中如1号敌人史莱姆的备注栏中写:
<set level: 500>
史莱姆就变成500级了...

若写成这样
<min level: 20>
<max level: 50>
就会在20级到50级取随机一个等级...

作者: 企鹅达达    时间: 2015-6-30 19:58

补充一种方法,战斗事件0回合时执行脚本
  1. $game_troop.members.each do |enemy|
  2. enemy.level=(rand(3)+5)
  3. end
复制代码

作者: ♂雨    时间: 2015-7-1 09:51
企鹅达达 发表于 2015-6-30 19:58
补充一种方法,战斗事件0回合时执行脚本

这个有什么作用?
作者: ♂雨    时间: 2015-7-1 10:02
正太君 发表于 2015-6-30 17:13
在数据库中如1号敌人史莱姆的备注栏中写:

史莱姆就变成500级了...

按照你的做了谢谢,问题解决了,可是为什么1号敌人无论攻击还是技能都有个爪子?教教我怎么设置。技能和敌人设置都没问题,换到2号敌人就没爪子了。
img]




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