08-24-2007, 01:00 PM (This post was last modified: 06-13-2017, 03:30 AM by DerVVulfman.)
Rotimikid's Enemy level Script
by ShockWave
V1.7
Aug 24 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
updates-
*replaced enemy hp and sp calculation because last version did not change hp and sp. also, i added exp and gold to the list of what the level changes.
*added the ability to change the level you will find monsters in to a new level, and then change it back to the original map's level.
*added the ability to turn on and off the random level feature.
The Enemy level script.
i've been told that seph already made an enemy level script, but i heard it made random levels and that it was for the sdk. this script was made without the sdk. i haven't tested it to see if it works with the sdk or not.
*************************************** ****************************************
** This script edits Game_Enemy **
*************************************** ****************************************
************************************** *****************************************
********* Instructions *********
************************************** *****************************************
*** Put the script above main. define the levels for each map. the levels ***
*** of the enemy will actually be randomized anywhere between 2 below or 2***
*** above the level for the map. edit the stat finding formula as you deem***
*** fit, just make sure you know what you're doing. you can now change the***
*** level of the map by putting in a call script ***
*** $game_system.map_level = x ***
*** replace the x with the level, if you want a level. if you don't want ***
*** to change the level of all maps like that, place in a call script ***
*** $game_system.map_level = nil ***
********************************************************************************
=end
class Game_System
alias rtmkd_initialize initialize
attr_accessor :map_level
attr_accessor :rand_level
def initialize
rtmkd_initialize
@map_level = nil
@rand_level = true
end
end
class Game_Enemy
#this is an hash for level. on the left of each hash is the current map's id,
#and on the right is the base level. level can fluctuate between 2 above and 2
#below the base level.
def initialize(troop_id, member_index)
super()
@troop_id = troop_id
@member_index = member_index
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
level_map = {1 => 1, 2 => 3, 3 => 5}
if level_map.include?($game_map.map_id)
randi = rand(5) - 2
randi = 0 if $game_system.rand_level == false
if $game_system.map_level == nil
@level = level_map[$game_map.map_id] + randi
else
@level = $game_system.map_level + randi
end
@level = 99 if @level > 99
@level = 1 if @level < 1
else
@level = 1
end
#switch for bosses. if switch is on, enemies will use levels. if it is off,
#they will use their base stat. this is usefull for bosses.
#replace the 1 with whatever switch you want to turn off levels.
if $game_switches[1] == false
@level = nil
end
@hp = maxhp
@sp = maxsp
end
def base_maxhp
if @level != nil
base_hp = $data_enemies[@enemy_id].maxhp
add_on = ((base_hp / 5) ^ 1.35) * (@level - 1)
return base_hp + add_on
end
return $data_enemies[@enemy_id].maxhp
end
def base_maxsp
if @level != nil
base_sp = $data_enemies[@enemy_id].maxsp
add_on = ((base_sp / 5) ^ 1.35) * (@level - 1)
return base_sp + add_on
end
return $data_enemies[@enemy_id].maxsp
end
def base_str
if @level != nil
base_str = $data_enemies[@enemy_id].str
add_on = ((base_str / 35) ^ 0.98) * (@level - 1)
return base_str + add_on
end
return $data_enemies[@enemy_id].str
end
def base_dex
if @level != nil
base_dex = $data_enemies[@enemy_id].dex
add_on = ((base_dex / 35) ^ 0.98) * (@level - 1)
return base_dex + add_on
end
return $data_enemies[@enemy_id].dex
end
def base_agi
if @level != nil
base_agi = $data_enemies[@enemy_id].agi
add_on = ((base_agi / 15) ^ 0.98) * (@level - 1)
return base_agi + add_on
end
return $data_enemies[@enemy_id].agi
end
def base_int
if @level != nil
base_int = $data_enemies[@enemy_id].int
add_on = ((base_int / 25) ^ 0.98) * (@level - 1)
return base_int + add_on
end
return $data_enemies[@enemy_id].int
end
def base_atk
if @level != nil
base_atk = $data_enemies[@enemy_id].atk
add_on = ((base_atk / 25) ^ 0.98) * (@level - 1)
return base_atk + add_on
end
return $data_enemies[@enemy_id].atk
end
def base_pdef
if @level != nil
base_pdef = $data_enemies[@enemy_id].pdef
add_on = ((base_pdef / 35) ^ 0.98) * (@level - 1)
return base_pdef + add_on
end
return $data_enemies[@enemy_id].pdef
end
def base_mdef
if @level != nil
base_mdef = $data_enemies[@enemy_id].mdef
add_on = ((base_mdef / 35) ^ 0.98) * (@level - 1)
return base_mdef + add_on
end
return $data_enemies[@enemy_id].mdef
end
def base_eva
if @level != nil
base_eva = $data_enemies[@enemy_id].eva
add_on = ((base_eva / 15) ^ 0.98) * (@level - 1)
return base_eva + add_on
end
return $data_enemies[@enemy_id].eva
end
def exp
if @level != nil
base_exp = $data_enemies[@enemy_id].exp
add_on = (base_exp / 8) ^ 1.12
return base_exp + add_on
end
return $data_enemies[@enemy_id].exp
end
def gold
if @level != nil
base_gold = $data_enemies[@enemy_id].gold
add_on = (base_gold / 8) ^ 1.12
return base_gold + add_on
end
return $data_enemies[@enemy_id].gold
end
def level
return @level
end
end
class Window_Help
def set_enemy(enemy)
text = enemy.name
level_text = enemy.level
if level_text != nil
levela = level_text.to_s
text += " Level: " + levela
end
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
text += " " + state_text
end
set_text(text, 1)
end
end
demos ... i hate putting demos cause i'm not good at uploading games online.
instructions ...
paste above main. edit the hash named level_map to define the base level for each map. the actual level for each enemy fluctuates between 2 above the base level and 2 below the base level. you can go ahead and edit the formula for calculating the stats. i didn't really spend a long time on the formula, so i'm sure it is not perfect. also, if you want to change the level of the game (all maps), put in a call script
Code:
$game_system.map_level = x
replace the x with the level you want to change it to. note, this does not change the defined level of each map, it only changes the level at which you will currently find enemies, no matter what map you are on. to have the game use the map's normal level, put in a call script
Code:
$game_system.map_level = nil
if you want to turn off random level, put in a call script