Introduction
This system takes the statistics of your current party and the immediate enemy troop when you engage them in battle, and returns a numeric rating for each of them. This way, you can gauge whether the enemy is stronger then the current party or if the party can easily overpower the enemy.
This is a useful script if you wish to create or include a feather that is dependent on how difficult the enemy is when compared to the party.
Example Patch
This is a sample patch you can learn from to show how easy it is to use this system. The code within the spoiler uses values obtained from 'Compare Battle Ratings!' and only gives experience points after battle if the enemy was at least 1/2 the strength of the party. No two-ghost battle is likely to give experience points with this. They are just too weak.
The Example
Code:
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# My change ------------------------------------------------------------
#
# I only allow experience if the enemy's score is halfway or more of the
# party's difficulty. If the enemy's score is below 1/2 of the party,
# the party earns no points
#
# Add EXP and amount of gold obtained
exp += enemy.exp if $game_temp.troop_rating > ($game_temp.party_rating/2)
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Set wait count
@phase5_wait_count = 100
end
end
Compatibility
Pretty compatible to most default-like battlesystems.
Terms and Conditions
Free for use, guys. Even commercial games.