Quái Wật Lv Up nè

Thảo luận trong 'Game Development' bắt đầu bởi y.r.p, 2/6/06.

  1. y.r.p

    y.r.p Youtube Master Race

    Tham gia ngày:
    15/8/04
    Bài viết:
    85
    Cái này mình chôm được của người ta chịu khó dịch nhe :;)
    What this does is Finds the average level of your party members, adds one, divides that by 100 (Turns it into a percent, level 99 being 100%), and assigns enemies stats based off whatever you assigned them in the database.

    Meaning, In the database, make your monsters more powerful. Whatever you assign their stats to be in the database, is what their stats will be when your party is at level 99.

    Just Remember to Make your enemies powerful, or they will be pushovers.

    Updated:
    Now Stats are randomly modified (+ or -) (0 to 15) %. Now every enemy you encounter, will be unique!

    Just add this Somewhere above Main.
    CODE
    CODE
    #==============================================================================
    # Enemies That Level UP (Type 1)
    #--------------------------------------------------------------------------
    # Created By SephirothSpawn (11.17.05)
    # Last Updated: 11.25.05
    # Updated: Can Make Enemies Bosses (They Do Not Level Up) 11.18.05
    # Updated: Stats Now Randomized += 15 %
    #==============================================================================

    #==============================================================================
    # Module RPG
    #==============================================================================
    module RPG
    #=========================================================================
    # Class Enemy
    #=========================================================================
    class Enemy
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    # Base Statistics
    attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int
    attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold
    # Boss Check
    attr_accessor :boss
    #--------------------------------------------------------------------------
    # * Set Bases
    #--------------------------------------------------------------------------
    def set_bases
    @b_maxhp, @b_maxsp = @maxhp, @maxsp
    @b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int
    @b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva
    @b_exp, @b_gold = @exp, @gold
    # Checks to See if there's a boss
    if @name.include?("(BOSS)")
    @boss = true
    @name.slice!("(BOSS)")
    else
    @boss = false
    end
    end
    #--------------------------------------------------------------------------
    # * Update Level
    #--------------------------------------------------------------------------
    def update_level
    unless @boss
    # Calulates Average Level of Party
    average = 0
    for actor in $game_party.actors
    average += actor.level
    end
    average /= $game_party.actors.size
    # Adds 1 (So when you're at level 99, 100% of the Stats are used)
    average += 1
    # Set to a percent
    average /= 100.000
    # Update Stats
    @maxhp = (@b_maxhp * average).to_i
    percent = (@maxhp * (( rand(15) + 1 ) / 100.0)).to_i
    @maxhp += rand(2) == 0 ? percent : -percent
    @maxsp = (@b_maxsp * average).to_i
    percent = (@maxsp * (( rand(15) + 1 ) / 100.0)).to_i
    @maxsp += rand(2) == 0 ? percent : -percent
    @str = (@b_str * average).to_i
    percent = (@str * (( rand(15) + 1 ) / 100.0)).to_i
    @str += rand(2) == 0 ? percent : -percent
    @dex = (@b_dex * average).to_i
    percent = (@dex * (( rand(15) + 1 ) / 100.0)).to_i
    @dex += rand(2) == 0 ? percent : -percent
    @agi = (@b_agi * average).to_i
    percent = (@agi * (( rand(15) + 1 ) / 100.0)).to_i
    @agi += rand(2) == 0 ? percent : -percent
    @int = (@b_int * average).to_i
    percent = (@int * (( rand(15) + 1 ) / 100.0)).to_i
    @int += rand(2) == 0 ? percent : -percent
    @atk = (@b_atk * average).to_i
    percent = (@atk * (( rand(15) + 1 ) / 100.0)).to_i
    @atk += rand(2) == 0 ? percent : -percent
    @pdef = (@b_pdef * average).to_i
    percent = (@pdef * (( rand(15) + 1 ) / 100.0)).to_i
    @pdef += rand(2) == 0 ? percent : -percent
    @mdef = (@b_mdef * average).to_i
    percent = (@mdef * (( rand(15) + 1 ) / 100.0)).to_i
    @mdef += rand(2) == 0 ? percent : -percent
    @eva = (@b_eva * average).to_i
    percent = (@eva * (( rand(15) + 1 ) / 100.0)).to_i
    @eva += rand(2) == 0 ? percent : -percent
    @exp = (@b_exp * average).to_i + @b_exp
    percent = (@exp * (( rand(15) + 1 ) / 100.0)).to_i
    @exp += rand(2) == 0 ? percent : -percent
    @gold = (@b_gold * average).to_i + @b_gold
    percent = (@gold * (( rand(15) + 1 ) / 100.0)).to_i
    @gold += rand(2) == 0 ? percent : -percent
    end
    end
    end
    end

    #==============================================================================
    # Class Scene Title
    #==============================================================================
    class Scene_Title
    #--------------------------------------------------------------------------
    # * Alias' New Game Method
    #--------------------------------------------------------------------------
    alias new_game command_new_game
    #--------------------------------------------------------------------------
    # * Adds Base Stats For Enemies
    #--------------------------------------------------------------------------
    def command_new_game
    for i in 1...$data_enemies.size
    $data_enemies.set_bases
    end
    new_game
    end
    end

    #==============================================================================
    # Class Scene Battle
    #==============================================================================
    class Scene_Battle
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
    for i in 1...$data_enemies.size
    $data_enemies.update_level
    end
    end
    end


    Type 2
    This takes the stats from the database and multiples it by the average level of the members in your party. Then, randomly adds or subtract 0 to 15% of each stat the enemy carries.

    Just put somewhere above Main
    CODE
    CODE
    #==============================================================================
    # Enemies That Level UP (Type 2)
    #--------------------------------------------------------------------------
    # Created By SephirothSpawn (11.25.05)
    # Last Updated: 11.25.05
    #==============================================================================

    #==============================================================================
    # Module RPG
    #==============================================================================
    module RPG
    #=========================================================================
    # Class Enemy
    #=========================================================================
    class Enemy
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    # Base Statistics
    attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int
    attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold
    # Boss Check
    attr_accessor :boss
    #--------------------------------------------------------------------------
    # * Set Bases
    #--------------------------------------------------------------------------
    def set_bases
    @b_maxhp, @b_maxsp = @maxhp, @maxsp
    @b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int
    @b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva
    @b_exp, @b_gold = @exp, @gold
    # Checks to See if there's a boss
    if @name.include?("(BOSS)")
    @boss = true
    @name.slice!("(BOSS)")
    else
    @boss = false
    end
    end
    #--------------------------------------------------------------------------
    # * Update Level
    #--------------------------------------------------------------------------
    def update_level
    unless @boss
    # Calulates Average Level of Party
    average = 0
    for actor in $game_party.actors
    average += actor.level
    end
    average /= $game_party.actors.size
    # Update Stats
    @maxhp = (@b_maxhp * average).to_i
    percent = (@maxhp * (( rand(15) + 1 ) / 100.0)).to_i
    @maxhp += rand(2) == 0 ? percent : -percent
    @maxsp = (@b_maxsp * average).to_i
    percent = (@maxsp * (( rand(15) + 1 ) / 100.0)).to_i
    @maxsp += rand(2) == 0 ? percent : -percent
    @str = (@b_str * average).to_i
    percent = (@str * (( rand(15) + 1 ) / 100.0)).to_i
    @str += rand(2) == 0 ? percent : -percent
    @dex = (@b_dex * average).to_i
    percent = (@dex * (( rand(15) + 1 ) / 100.0)).to_i
    @dex += rand(2) == 0 ? percent : -percent
    @agi = (@b_agi * average).to_i
    percent = (@agi * (( rand(15) + 1 ) / 100.0)).to_i
    @agi += rand(2) == 0 ? percent : -percent
    @int = (@b_int * average).to_i
    percent = (@int * (( rand(15) + 1 ) / 100.0)).to_i
    @int += rand(2) == 0 ? percent : -percent
    @atk = (@b_atk * average).to_i
    percent = (@atk * (( rand(15) + 1 ) / 100.0)).to_i
    @atk += rand(2) == 0 ? percent : -percent
    @pdef = (@b_pdef * average).to_i
    percent = (@pdef * (( rand(15) + 1 ) / 100.0)).to_i
    @pdef += rand(2) == 0 ? percent : -percent
    @mdef = (@b_mdef * average).to_i
    percent = (@mdef * (( rand(15) + 1 ) / 100.0)).to_i
    @mdef += rand(2) == 0 ? percent : -percent
    @exp = (@b_exp * average).to_i
    percent = (@exp * (( rand(15) + 1 ) / 100.0)).to_i
    @exp += rand(2) == 0 ? percent : -percent
    @gold = (@b_gold * average).to_i
    percent = (@gold * (( rand(15) + 1 ) / 100.0)).to_i
    @gold += rand(2) == 0 ? percent : -percent
    end
    end
    end
    end

    #==============================================================================
    # Class Scene Title
    #==============================================================================
    class Scene_Title
    #--------------------------------------------------------------------------
    # * Alias' New Game Method
    #--------------------------------------------------------------------------
    alias new_game command_new_game
    #--------------------------------------------------------------------------
    # * Adds Base Stats For Enemies
    #--------------------------------------------------------------------------
    def command_new_game
    for i in 1...$data_enemies.size
    $data_enemies.set_bases
    end
    new_game
    end
    end

    #==============================================================================
    # Class Scene Battle
    #==============================================================================
    class Scene_Battle
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
    for i in 1...$data_enemies.size
    $data_enemies.update_level
    end
    end
    end
    Chúc thành công :D
     

Chia sẻ trang này