General Methods XP VX & ACE
#11
Swap Actors aka Party Members at Will! Grinning

XP Script

Code:
# * Swap Party Members XP * #

class Game_Party
  def swap_order(index1, index2)
    @actors[index1], @actors[index2] = @actors[index2], @actors[index1]
    $game_player.refresh
  end

  def swap_member_with_actor(index, actor_id)
    @actors[index] = $game_actors[actor_id]
    $game_player.refresh
  end

  def actor_ids
    @actors.map{|actor| actor.id }
  end

  def swap_actor_with_actor(actor_id1, actor_id2)
    pos = actor_ids.index(actor_id1)
    @actors[pos] = $game_actors[actor_id2]
    $game_player.refresh
  end
  alias :swap_by_actor_ids :swap_actor_with_actor
  alias :swap :swap_order
end

VX & VX ACE Script

Code:
# * Swap Party Members VX & ACE * #

class Game_Party
  def swap_member_with_actor(index, actor_id)
    @actors[index] = actor_id
    $game_player.refresh
  end

  def swap_actor_with_actor(actor_id1, actor_id2)
    pos = @actors.index(actor_id1)
    @actors[pos] = actor_id2
    $game_player.refresh
  end

  def actor_ids
    @actors
  end
  alias :swap_by_actor_ids :swap_actor_with_actor
  alias :swap :swap_order
end

List of Newly Available Script Calls

Code:
$game_party.swap_order(Position1, Position2)
$game_party.swap(Position1, Position2)
$game_party.swap_member_with_actor(Position, ActorID)
$game_party.swap_actor_with_actor(ActorID1, ActorID2)
$game_party.swap_by_actor_ids(ActorID1, ActorID2)
$game_party.actor_ids

Side Note

$game_party.swap_order already existed in RMVX ACE.
"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 }
#12
Find Out Whether or Not an Actor Has Several States

Call for XP
$game_party.actor(ActorIndex).has_states?(state1, etc.)

Code:
# * Has States? XP * #
#   2023-06-01

# * Script Call For XP * #
#  $game_party.actor(ActorIndex).has_states?(state1, etc.)

class Game_Actor
  def has_states?(*new_states)
    states_found = @states & new_states
    states_found.any?
  end
end

class Game_Party
  def actor(pos)
    @actors[pos]
  end
end

Call for VX & VX ACE
$game_party.member(ActorIndex).has_states?(state1, etc.)

Code:
# * Has States? VX & ACE * #
#   2023-06-01

# * Script Call For VX and VX ACE * #
#  $game_party.member(ActorIndex).has_states?(state1, etc.)

class Game_Actor
  def has_states?(*new_states)
    states_found = @states & new_states
    states_found.any?
  end
end

class Game_Party
  def member(pos)
    $game_actors[@actors[pos]]
  end
end
"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 }
#13
BattleEnd XP

I thought that offering you another option for improving the Party's Victory processing stage was something very convenient for everybody.

What this scriptlet does is simple:

It rewrites the Scene_Battle#start_phase5 by subdividing it into several other methods that handle very specific stuff.

Then I added a Game Variable and a Game Switch to alter its normal behavior.

The Game Variable handles how much EXP your heroes will get.
  • 0 stands for EXP divided by Total Heroes
  • 1 stands for EXP divided by Total Heroes * 2
  • 2 stands for Full EXP
The Game Switch defines if the Party will get the whole list of Treasures.

The Party will only get up to 5 Treasures if the Game Switch is OFF.

Code:
# * BattleEnd XP * #
#  Scripter : Kyonides Arkanthes
#  2023-06-16

# - Values for VAR_FULL_EXP Game Variable:
# 0 - EXP divided by Total Heroes
# 1 - EXP divided by Total Heroes * 2 (Punishment)
# 2 - Full EXP (Reward)

# - SWITCH_ALL_TREASURES Game Switch allows you to let the party get all of
#  the treasures they have earned instead of just 5 of them.

module BattleEnd
  VAR_FULL_EXP = 1
  SWITCH_ALL_TREASURES = 1
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)
    process_exp_gold_treasures
    limit_treasures
    distribute_treasures
    distribute_exp_gold
  end

  def process_exp_gold_treasures
    @exp = 0
    @gold = 0
    @treasures = []
    for enemy in $game_troop.enemies
      next if enemy.hidden
      @exp += enemy.exp
      @gold += enemy.gold
      if rand(100) < enemy.treasure_prob
        if enemy.item_id > 0
          @treasures << $data_items[enemy.item_id]
        elsif enemy.weapon_id > 0
          @treasures << $data_weapons[enemy.weapon_id]
        elsif enemy.armor_id > 0
          @treasures << $data_armors[enemy.armor_id]
        end
      end
    end
  end

  def limit_treasures
    return if $game_variables[BattleEnd::SWITCH_ALL_TREASURES]
    @treasures = @treasures[0..5]
  end

  def gain_treasure(item_id)
    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

  def distribute_treasures
    @treasures.each {|treasure| gain_treasure(treasure.id) }
  end

  def distribute_exp(actor)
    case $game_variables[BattleEnd::VAR_FULL_EXP]
    when 0
      @final_exp = @exp / $game_party.actors.size
      actor.exp += @final_exp
    when 1
      @final_exp = @exp / $game_party.actors.size / 2
      actor.exp += @final_exp
    when 2
      @final_exp = @exp
      actor.exp += @exp
    end
  end

  def distribute_exp_gold
    $game_party.actors.each_with_index do |actor, i|
      next if actor.cant_get_exp?
      last_level = actor.level
      distribute_exp(actor)
      @status_window.level_up(i) if actor.level > last_level
    end
    $game_party.gain_gold(@gold)
    @result_window = Window_BattleResult.new(@final_exp, @gold, @treasures)
    @phase5_wait_count = 100
  end
end
"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: 5 Guest(s)