Code:
# * EXP Reserves
# Scripter : Kyonides Arkanthes
# 2020-05-22
# * Script Calls * #
# Let's say you pick the team leader and name him "actor" in a script call
# actor = $game_party.actors[0]
# actor.reserve_exp = true # or false
# actor.exp_reserves = 100 # Optional
# actor.exp_reserves # Returns 100 EXP
# Sets every single Actor's EXP Reserves flag
# $game_party.reserve_actors_exp = true # or false
# Creates an Array with all of the Actors' current EXP Reserves
# $game_party.actor_exp_reserves
# Collects Actors' EXP Reserves as if it were a currency or anything similar
# Warning: This action cannot be reverted!
# $game_party.collect_exp_reserves
# Returns EXP Reserves collected from Actors after using the previous call
# $game_party.exp_reserves
class Game_Actor
alias :kyon_expr_gm_actor_init :initialize
def initialize(actor_id)
kyon_expr_gm_actor_init(actor_id)
clear_exp_reserves
@reserve_exp = false
end
def clear_exp_reserves() @exp_reserves = 0 end
def earn_exp(exp) @reserve_exp ? @exp_reserves += exp : self.exp += exp end
attr_accessor :exp_reserves, :reserve_exp
end
class Game_Party
alias :kyon_expr_gm_party_init :initialize
def initialize
kyon_expr_gm_party_init
@exp_reserves = 0
end
def collect_exp_reserves
@exp_reserves += actor_exp_reserves.inject(:+)
@actors.each{|a| a.clear_exp_reserves }
end
def reserve_actors_exp=(bool) @actors.map{|a| a.reserve_exp = bool } end
def actor_exp_reserves() @actors.map{|a| a.exp_reserves } end
attr_accessor :exp_reserves
end
Code:
# * EXP Reserves Default Battle System Add-on
# Scripter : Kyonides Arkanthes
# 2020-05-22
module KLimits
@result_timer = 100 # frames
@treasures = true
def self.result_timer() @result_timer end
def self.treasures() @treasures end
def self.treasures=(bool) @treasures = bool end
end
class Scene_Battle
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
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
treasures = treasures[0..5] if KLimits.treasures
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
unless actor.cant_get_exp?
last_level = actor.level
actor.earn_exp(exp)
if actor.level > last_level
@status_window.level_up(i)
end
else
actor.exp_reserves += exp
end
end
$game_party.gain_gold(gold)
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
@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = KLimits.result_timer
end
end