EXP Reserves
#1
EXP Reserves

by Kyonides Arkanthes

Introduction

These scriptlets are focused on reserving exp your heroes gained after defeating those pesky monsters. You can enable or disable it at any time, but only if you follow my instructions. Laughing + Tongue sticking out 

At this moment it doesn't offer any GUI or menu. Laughing

The basic script you may find below might also work on VX or VX Ace... Confused

Basic Script
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

Default Battle System Add-on
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

Terms & Conditions

Free to use in any way possible if you tell Wulfo he should kick Patches, Good and Evil out of his house. Laughing 
OK, the last part is just a joke. Laughing + Tongue sticking out
Even so I can't guarantee a Mouse like Cheesie James won't show up to steal his birch beer late at night. Laughing
Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 1 Guest(s)