设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 85|回复: 0

[转载发布] Leveled Enemy Lists

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4469

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22945
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28308

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Leveled Enemy Lists
    Version: 1.0




    Introduction
    Have you even thought...  my random enemies don't seem to match my heroes when they engage them?  Have you ever thought that maybe you could swap out the enemies in your Troops with other enemies if the average party member's level is high enough?  Now you can.



    Script
    Spoiler: Leveled Lists
                    Code:        
    #============================================================================== # ** Leveled Enemy Lists #------------------------------------------------------------------------------ #    by DerVVulfman #    version 1.0 #    09-12-2019 (MM-DD-YYYY) #    RGSS / RMXP #============================================================================== # #  INTRODUCTION: # #  Have you even thought...  my random enemies don't seem to match my heroes #  when they engage them?  Have you ever thought that maybe you could swap out #  the enemies in your Troops with other enemies if the average party member's #  level is high enough?  Now you can. #   # #============================================================================== # #  LEVELED ENEMIES: #   #  The feature examines each enemy from the troops database, and checks to  #  see if it is the 'key' to one of the lists in the LeveledEnemies module. #  If it is to be replaced, it uses the enemy within the array (or arrays) #  that the entry supplies. # #  IF... (hehehe)... the replacement enemy is actually a 'key' to another #  list in the LeveledEnemies module, it TOO can get replaced.  Yes, dear #  reader... recusion abouds so you can make very detailed level lists! # #                              *     *     * # #  Each Entry within the LIST hash array is as follows: # #  LIST[ key ]  = [ leveled enemies ] # #  As stated above, the 'key' is the ID of an enemy that will be replaced #  within your  troops database.   In our default script,  the first list #  replaces the  GHOST (enemy #1)  while the  second list  in the default #  script replaces the SAGAHIN (#3) # #                              *     *     * # #  The leveled lists are a collection of arrays.  There must be at least #  one array like this: # #  LIST[key] = [ [list of enemies], [list of enemies],... [list of enemies] ] # #  Types of 'list of enemies': #  1)  Array of enemy IDs:                          [ id, id, id, id, ... id ]   #  2)  Array with a min level & list of enemy IDs:  [ lvl, [ id, id, id....] ] # # #  Style #1)  This is just a list of enemy IDs.  It will randomly select from #             this list. # #  Style #2)  This is a level-based list.  It has a level to test against the #             average level* of the party.  And only IF the party's average is #             higher than this test value will it use the enemies in the list #             of enemies next to it. #               #             IF an enemy list has a required level and the party has not #             reached that minimum level, no substitution will occur. #  #============================================================================== # #  TERMS OF USE # #  Free for use, even in commercial works.  Only due credit is required. # #==============================================================================    module LeveledEnemies      LIST = {}    #         ID    # LIST OF MONSTERS   #============   ==================   LIST[1] = [[2,3,4], [5,[5,6,7,8]] ]   LIST[2] = [ [15, [22,23,24]]]   LIST[3] = [[10,11,18,19]]    # NOTES FROM A WEREWOLF:   #-------------------------------------------------------------------------   # LIST[1] ...  Any ghost can be replaced by enemies 2,3 or 4 under normal   #              circumstances   But if the level of the party is level 5,   #              then the ghost is replaced by enemies 5, 6, 7 or 8.   #   #              IF the ghost is replaced by a Basilisk or Sagahin, look at   #              the next two lists!  THEY DO COUNT!   #   # LIST[2] ...  If a Basilisk is encountered, it can only be replaced by   #              enemies if the level of the party as a while is at least 15.   #              Otherwise, the basilisk remains in the troop.   #                 # LIST[3] ...  If a Sagahin is encountered, it can be replaced with no   #              problems with enemies 10, 11, 18 and 19.   #   #-------------------------------------------------------------------------    end  #============================================================================== # ** Game_Enemy #------------------------------------------------------------------------------ #  This class handles enemies. It's used within the Game_Troop class #  ($game_troop). #==============================================================================  class Game_Enemy < Game_Battler   #--------------------------------------------------------------------------   # * Public Instance Variables   #--------------------------------------------------------------------------   attr_accessor :member_index             # Member index (position in troop)   #--------------------------------------------------------------------------   # * Alias Listings   #--------------------------------------------------------------------------   alias meebers initialize   #--------------------------------------------------------------------------   # * Object Initialization   #     troop_id     : troop ID   #     member_index : troop member index   #--------------------------------------------------------------------------   def initialize(troop_id, member_index, enemy_id=nil)     # Perform a normal initialize     meebers(troop_id, member_index)     # Exit if no custom enemy ID sent     return if enemy_id.nil?     # Re-perform the initialize with the new enemy ID     @troop_id     = troop_id     @member_index = member_index     troop         = $data_troops[@troop_id]     @enemy_id     = enemy_id     enemy         = $data_enemies[@enemy_id]     @battler_name = enemy.battler_name     @battler_hue  = enemy.battler_hue     @hp           = maxhp     @sp           = maxsp     @hidden       = troop.members[@member_index].hidden     @immortal     = troop.members[@member_index].immortal   end   end    #============================================================================== # ** Game_Troop #------------------------------------------------------------------------------ #  This class deals with troops. Refer to "$game_troop" for the instance of #  this class. #==============================================================================  class Game_Troop   #--------------------------------------------------------------------------   # * Alias Listings   #--------------------------------------------------------------------------   alias moobers setup   #--------------------------------------------------------------------------   # * Setup   #     troop_id : troop ID   #--------------------------------------------------------------------------   def setup(troop_id)     # Perform the original call     moobers(troop_id)     # Obtain party level     @level = setup_level     # Replace     setup_replace(troop_id)   end   #--------------------------------------------------------------------------   # * Setup : Acquiring average level of all party members   #--------------------------------------------------------------------------   def setup_level     level = 0     for actor in $game_party.actors       level += actor.level     end     level /= $game_party.actors.size     return level.to_i   end   #--------------------------------------------------------------------------   # * Setup : Loop through and replace enemy as needed   #     troop_id : troop ID   #--------------------------------------------------------------------------   def setup_replace(troop_id)     # Create a temp array     temp = []     # Cycle through each enemy     for enemy in @enemies       # Get new enemy ID based on old enemy       enemy_id = setup_individual(enemy)       # Push into temp array       temp.push(Game_Enemy.new(troop_id, enemy.member_index, enemy_id))     end     # Replace the enemy array with the temp array     @enemies = temp   end   #--------------------------------------------------------------------------   # * Setup : Loop through and replace enemy as needed   #     troop_id : troop ID   #--------------------------------------------------------------------------   def setup_individual(enemy)     # Perform a loop     loop do       # Get the enemy's ID       e_id = enemy.id       # Perform only if enemy list has the enemy ID as a key       if LeveledEnemies::LIST.has_key?(e_id)         result = setup_listchoice(e_id)         enemy = result unless result.nil?       end       # Break if list doesn't supply proper content       break if result.nil?       # Oooh... only exit loop if no matching enemy ID as a key       break unless LeveledEnemies::LIST.has_key?(enemy.id)     end     # Return the new enemy ID     return enemy.id   end   #--------------------------------------------------------------------------   # * Setup : Loop individual sets to choose   #     troop_id : troop ID   #--------------------------------------------------------------------------   def setup_listchoice(e_id)     array_list = LeveledEnemies::LIST[e_id]     enemy = nil     # Cycle through each set     for set in array_list       # Reset temp list       temp_list = []       # Determine if has set level or not       if set.size == 2         min_level  = set[0]         temp_list = set[1]       else         min_level  = nil         temp_list = set       end       # If there's no minimum       if min_level.nil?         rand_size   = temp_list.size         choice      = temp_list[rand(rand_size)]         enemy       = $data_enemies[choice]       # or if player level is exceeding min required level for set       elsif @level >= min_level         rand_size   = temp_list.size         choice      = temp_list[rand(rand_size)]         enemy       = $data_enemies[choice]       end     end       return enemy   end end




    Instructions
    They're inside the script.



    FAQ
    They may generally look like the Leveled Lists from the Elder Scrolls games from Morrowind on up.



    Compatibility
    Designed for RPGMaker XP.  



    Terms of Use
    Free for use, even in Commercial products.  Due credit is required.


    本贴来自国际rpgmaker官方论坛作者:DerVVulfman处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/leveled-enemy-lists.113239/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 17:53 , Processed in 0.148537 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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