[XP] Enemies That Level Up

Started by Magus, September 24, 2011, 03:56:45 pm

Previous topic - Next topic

Magus

September 24, 2011, 03:56:45 pm Last Edit: September 15, 2014, 06:47:56 pm by KK20
Enemies That Level Up

Authors: SephirothSpawn

Version: 1.1

Type: Enemy manager

Key Term: Battle Add-on



Introduction

Enemies level up....
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!

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.


Features


  • Enemies will get gradually stronger as your party levels up

  • Variance allows unique enemy stats, making every encounter different




Screenshots

None.


Demo

None. Author didn't provide one.


Script

Type one:
Spoiler: ShowHide

#==============================================================================
# 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 two:
Spoiler: ShowHide

#==============================================================================
# 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




Instructions

Place anywhere above Main
Both version include the Boss Feature:
By adding (BOSS) into any enemy's name in the database, their stats are not affected by these scripts.


Compatibility

Unknown...


Credits and Thanks


  • SephirothSpawn




Author's Notes

This is NOT my script.
LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ForeverZer0

You didn't apply the template properly.
You're missing the key-term, a horizontal rule, and the entire post is centered instead of just the header.

* Sees that Blizz posted while he was typing, but posts anyways *
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Magus

LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

AngryPacman

G_G's a silly boy.

Magus

LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

ForeverZer0

Quote from: Magus on September 26, 2011, 03:58:07 pm
lmao, it is centered!


And as long as it stays like this, it will never be in the script database. You can fix it with a simple [/center].
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Magus

Somewhere... I didn't edit this right :/...  I'll have to recheck the template when I have time.
LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

candi.horror

November 12, 2012, 05:33:04 pm #8 Last Edit: November 12, 2012, 05:44:18 pm by candi.horror
I have a question regarding the use of this script with Satoh's Fluctuating Experience. In a nutshell, the Fluctuating EXP script bases how much XP an enemy gives by its level compared to yours. The enemy level is set in it's XP field in the database, so any enemy with 7 XP would be considered a level 7 enemy. With this in place, leveling up works like so:

Spoiler: ShowHide
Quote from: Taiine on October 06, 2010, 12:31:29 am
   when 10+ levels above player = 1.9  kills to level
   when 9 levels above player = 2.3 kills to level
   when 8 levels above player = 2.8  kills to level
   when 7 levels above player = 3.5 kills to level
   when 6 levels above player = 4.5 kills to level
   when 5 levels above player = 5 kills to level
   when 4 levels above player = 7 kills to level
   when 3 levels above player = 10 kills to level
   when 2  levels above player = 12.5 kills to level
   when 1  level above player = 14 kills to level
when at same level   =  16 kills to level
   when -1  level below player = 20 kills to level
   when -2  levels below player = 25 kills to level
   when -3  levels below player = 35.7 kills to level
   when -4  levels below player = 76 kills to level
   when -5  levels below player = 125 kills to level
   when -6  levels below player = 166 kills to level
   when -7  levels below player = 250 kills to level
   when -8  levels below player = 333 kills to level
   when -9  levels below player = 500 kills to level
   when -10+  levels below player = 1000 kills to level


I see that with Type 2 of this script handles Xp with this equation:
@exp = (@b_exp * average).to_i
percent = (@exp * (( rand(15) + 1 ) / 100.0)).to_i
@exp += rand(2) == 0 ? percent : -percent


My question is how to modify this equation so that the XP "level' would scale with your level.

Hope this post isn't confusing. Cheers!

KK20

Deleted the double post.

Um...what do you mean by scale? You are really going to need to give an example of what should be expected.

Here, I'll start it off: Say that my party's level average is 30 and the monster is given a base level of 10. What is suppose to happen?





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

candi.horror

Quote from: KK20 on November 12, 2012, 07:33:10 pm

Um...what do you mean by scale? You are really going to need to give an example of what should be expected.

Here, I'll start it off: Say that my party's level average is 30 and the monster is given a base level of 10. What is suppose to happen?


My apologies for not giving an example to make myself clearer. Your example illustrates what I wish to do, in this case the monster would be level 30 as well.

Sorry for the double post!

KK20

@exp = average
?

And if that is the case, there is no point in assigning levels to your monsters. You can leave all the monsters' EXP values to be 0 and they will adjust accordingly.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

*bump* Can somebody fix the first post to fit the template?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20

Fix'd and databased, but only because it's not Magus's script.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

WhiteRose

It would be interesting to adapt this script to be used for ease of use of the programmer rather than for level scaling. A lot of people (well, me personally sometimes, and, by extension, probably others. Unless I'm just terribly incompetent. >.<) sometimes have trouble knowing exactly how difficult to make the enemies in a given area of the game that will help them to be challenging but not frustrating. The ideal solution is to make creative enemies that use unique tactics, abilities, and so on.
However, if, for example, you're creating an area with only a minor role in the story, but want to be able to populate it with some quickly-made monsters, you could have the script generate enemies at the appropriate level relative to the area. Of course, you'd still probably want to have at least unique names and color schemes for the enemies so as not to ever cross the line of being downright lazy, but this would at least take some of the arithmetic and testing out of the picture.

Sorry for the rambling - just a thought I had as I was looking through the script.

Wecoc

WhiteRose:
Some people use a defined formula across the game to define all the enemies using the same logic.

Example: ShowHide
PE = PA[n] * (pn / tn) * (1 + ef) / (3 - d)

PE - Enemy parameter
PA - Actor parameter (in level [n])
pn - Party number
tn - Troop number
ef - Enemy effectiveness - 0 - Low, 1 - Default, 2 - High
d - Enemy difficulty - 0 - Easy, 1 - Default, 2 - Boss


The script could calculate that automatically, with some adds to the current one it shouldn't be difficult.
But testing the game several times is the best way, and for me, the only way.

I never had problems with this; once you defined and tested the first type of enemy, others can be calculated as an improvement of the first, plus specific enemy parameter changes (for example adding agility on a flying enemy type).




I know something interesting about enemies with level in a more complex way on RPG maker XP. Some time ago I contributed on the hispanic community with a script called ERON engine. I don't like some things on it but it's idea is great for some type of RPGs.

It's base is the next one: Enemies and Actors have the same properties and capacities; level, equip...
The way the script does that using the default Database is the next one:
Every Actor is associated to a Enemy ID it uses as a base, so every Enemy is also associated to an Actor ID (and its class), and the battler is the result of both. The Database 'Actor' parameters now control both actors and enemies parameters because of the level variation. The 'Actor' element / state represent the specific elements and states of that battler, and the 'Enemy' ones the weakness to that element / state. Finally the gold is recalculated using the 'Enemy' value with a level multiplicator, and enemy's equip is added to the treasures array.




About the SephirothSpawn's script, it's a good way to make the game difficult from start to end, and in a game based by time where everyone (good and evil) train in the same time to get the victory (for example Age of Empires), the more you wait the stronger your enemies are.  But for a classical RPG I would not use that because some reasons; First, the best way the player realize how strong his party has been made because of the training (and also how strong the antagonist is) is battle them with an enemy type which were hard to kill before and now it's so easy; Second, because with the script, grinding (go back to train) makes no sense since it will not cause an advantage of the party over the enemies; And Third, it's logical that the party gets stronger after every battle, but the enemies who didn't fight with the party shouldn't have that growth.

Uh and... I like the variance add-on, lol.

Tiamat5774

This script doesn't work well.
Here's what I found....
corrupts saved games (a "nomethod" error on line 59 comes up if you edit anything in the game and you have to start over from the beginning)
Enemies go from super easy (just spam the attack button) to super hard in no time (game over easily by level 6). Really difficult to balance.  This goes for type 1 and 2.
This script needs some work before it is practical for use.