KAftermathSpoils VX + ACE
#2
New Update + New Name

KAftermathHealing has been rebranded as KAftermathSpoils because it now offers you a way to increase (or decrease) a party's gold prize Cash based on how long it took the heroes to defeat their foes in battle. Grinning

VX Script - Healing + Gold

Code:
# * KAftermathSpoils VX * #
#  Scripter : Kyonides Arkanthes
#  v0.4.0 - 2024-10-19

# This script lets you automatically heal your heroes after winning a battle
# based on the number of battle turns.

module KBattle
  # Leave these hashes alone!
  HP_TOTAL_TURNS  = {}
  MP_TOTAL_TURNS  = {}
  GOLD_TOTAL_TURNS = {}
  # If it took too long to defeat the enemy troopers...
  HP_TOTAL_TURNS.default  = 0
  MP_TOTAL_TURNS.default  = 0
  GOLD_TOTAL_TURNS.default = 0
  # Add as many Ranges, i.e. 1..50 as necessary:
  HP_TOTAL_TURNS[1..6]    = 100
  HP_TOTAL_TURNS[7..17]    = 75
  HP_TOTAL_TURNS[18..35]  = 50
  HP_TOTAL_TURNS[36..60]  = 25
  MP_TOTAL_TURNS[1..5]    = 100
  MP_TOTAL_TURNS[6..15]    = 75
  MP_TOTAL_TURNS[16..30]  = 50
  MP_TOTAL_TURNS[31..50]  = 25
  GOLD_TOTAL_TURNS[1..2]  = 150
  GOLD_TOTAL_TURNS[3..6]  = 120
  GOLD_TOTAL_TURNS[7..10]  = 100
  GOLD_TOTAL_TURNS[11..13] = 80
  GOLD_TOTAL_TURNS[14..17] = 60
end

class Range
  def <=>(other)
    to_a <=> other.to_a
  end
end

class Game_Troop
  alias :kyon_btl_score_gm_trp_gold_ttl :gold_total
  def gold_total
    gold = kyon_btl_score_gm_trp_gold_ttl
    gp_perc = 0
    KBattle::GOLD_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      gp_perc = percent
      break
    end
    gold + gold * gp_perc / 100
  end
end

class Scene_Battle
  alias :kyon_btl_score_scn_btl_disp_exp_gold :display_exp_and_gold
  def process_aftermath_healing
    hp_perc = mp_perc = 0
    turns = $game_troop.turn_count
    KBattle::HP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      hp_perc = percent
      break
    end
    KBattle::MP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      mp_perc = percent
      break
    end
    $game_party.members.each do |actor|
      next if actor.dead?
      actor.hp += actor.maxhp * hp_perc / 100
      actor.mp += actor.maxmp * mp_perc / 100
    end
  end

  def display_exp_and_gold
    process_aftermath_healing
    kyon_btl_score_scn_btl_disp_exp_gold
  end
end

VX ACE Script - Healing + Gold

Code:
# * KAftermathSpoils ACE * #
#   Scripter : Kyonides Arkanthes
#   v0.4.0 - 2024-10-19

# This script lets you automatically heal your heroes after winning a battle
# based on the number of battle turns.

module KBattle
  # Leave these hashes alone!
  HP_TOTAL_TURNS   = {}
  MP_TOTAL_TURNS   = {}
  GOLD_TOTAL_TURNS = {}
  # If it took too long to defeat the enemy troopers...
  HP_TOTAL_TURNS.default   = 0
  MP_TOTAL_TURNS.default   = 0
  GOLD_TOTAL_TURNS.default = 0
  # Add as many Ranges, i.e. 1..50 as necessary:
  HP_TOTAL_TURNS[1..6]     = 100
  HP_TOTAL_TURNS[7..17]    = 75
  HP_TOTAL_TURNS[18..35]   = 50
  HP_TOTAL_TURNS[36..60]   = 25
  MP_TOTAL_TURNS[1..5]     = 100
  MP_TOTAL_TURNS[6..15]    = 75
  MP_TOTAL_TURNS[16..30]   = 50
  MP_TOTAL_TURNS[31..50]   = 25
  GOLD_TOTAL_TURNS[1..2]   = 150
  GOLD_TOTAL_TURNS[3..6]   = 120
  GOLD_TOTAL_TURNS[7..10]  = 100
  GOLD_TOTAL_TURNS[11..13] = 80
  GOLD_TOTAL_TURNS[14..17] = 60
end

class Range
  def <=>(other)
    to_a <=> other.to_a
  end
end

class Game_Troop
  alias :kyon_btl_score_gm_trp_gold_ttl :gold_total
  def gold_total
    gold = kyon_btl_score_gm_trp_gold_ttl
    gp_perc = 0
    KBattle::GOLD_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      gp_perc = percent
      break
    end
    gold + gold * gp_perc / 100
  end
end

class << BattleManager
  alias :kyon_btl_score_scn_btl_disp_exp :display_exp
  def process_aftermath_healing
    hp_perc = mp_perc = 0
    turns = $game_troop.turn_count
    KBattle::HP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      hp_perc = percent
      break
    end
    KBattle::MP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
      next unless min_turns.include?(turns)
      mp_perc = percent
      break
    end
    $game_party.members.each do |actor|
      next if actor.dead?
      actor.hp += actor.mhp * hp_perc / 100
      actor.mp += actor.mmp * mp_perc / 100
    end
  end

  def display_exp
    process_aftermath_healing
    kyon_btl_score_scn_btl_disp_exp
  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 }


Messages In This Thread
KAftermathSpoils VX + ACE - by kyonides - 10-02-2024, 06:43 AM
RE: KAftermathSpoils VX + ACE - by kyonides - 10-20-2024, 04:33 AM



Users browsing this thread: 1 Guest(s)