Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Enemies that level up

I can't remember who it was that made this script, but if anyone has it, could they repost the script which makes emenies stronger when you gain levels.

E.g. if you are at level 1 then a ghost has 570 hp
if you are at level 100 then a ghost has 5700 hp

Thanks in advance

Micklo
 
I did that a long while ago, but I made something a little better that acting randomizes the stats, and lets you control them a little better.

It something like : base_value + level * bonus_value where you can define all the enemies base_value for each stat and that is added to the bonus value times the level.

I will try to finish up this and post it soon.
 
SephirothSpawn":3iw4jrew said:
There are now 2 different versions of this. Below each type, is a description of each of the formulas to determine their stats.


Type 1
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:
#==============================================================================
# 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[i].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[i].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:
#==============================================================================
# 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[i].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[i].update_level
end
end
end

Both Version include the Boss Feature:
By Adding (BOSS) into any enemies name in the database, there stats are not effected by these scripts.


All credit SephirothSpawn (obviously).
Enjoy :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top