Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: KAftermathSpoils XP
- Original author: kyonides
- Original date: October 2, 2024
- Source thread: https://forums.rpgmakerweb.com/threads/kaftermathspoils-xp.172302/
- Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS Scripts (RMXP)
Summary
KAftermathSpoils XP by Kyonides Introduction The title tells you what this scriptlet is all about: healing based on the battle aftermath.
Archived First Post
KAftermathSpoils XP
by Kyonides
by Kyonides
Introduction
The title tells you what this scriptlet is all about: healing based on the battle aftermath.
How does it work?
It's very simple! Just set the values of a series of ranges, i.e.
Ruby:
HP_TOTAL_TURNS[min_value..max_value] = 100
...and the system will check how many turns it actually took you to defeat your opponents.
Did you need 11 turns to defeat some ghosts?
Was there a range like 10..20 included in your hash?
Does that range store 75 as its current value?
Then you already know the answer here: it will pick that very same range and assign your heroes a 75% HP recovery rate!
The Script
Ruby:
# * KAftermathSpoils XP * #
# 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 = {}
SP_TOTAL_TURNS = {}
GOLD_TOTAL_TURNS = {}
# If it took too long to defeat the enemy troopers...
HP_TOTAL_TURNS.default = 0
SP_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
SP_TOTAL_TURNS[1..5] = 100
SP_TOTAL_TURNS[6..15] = 75
SP_TOTAL_TURNS[16..30] = 50
SP_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 Scene_Battle
alias :kyon_btl_score_scn_btl_start_ph5 :start_phase5
def process_aftermath_healing
@gold_before = $game_party.gold
hp_perc = sp_perc = 0
turns = $game_temp.battle_turn
KBattle::HP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
next unless min_turns.include?(turns)
hp_perc = percent
break
end
KBattle::SP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
next unless min_turns.include?(turns)
sp_perc = percent
break
end
$game_party.actors.each do |actor|
next if actor.hp0?
actor.hp += actor.maxhp * hp_perc / 100
actor.sp += actor.maxsp * sp_perc / 100
end
end
def start_phase5
process_aftermath_healing
kyon_btl_score_scn_btl_start_ph5
process_aftermath_gold
end
def process_aftermath_gold
prize = $game_party.gold - @gold_before
return if prize == 0
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
extra_gold = prize * gp_perc / 100
$game_party.gain_gold(extra_gold)
end
end
Ruby:
# * KAftermathHealing XP * #
# Scripter : Kyonides Arkanthes
# v0.3.1 - 2024-10-01
# 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 = {}
SP_TOTAL_TURNS = {}
# If it took too long to defeat the enemy troopers...
HP_TOTAL_TURNS.default = 0
SP_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
SP_TOTAL_TURNS[1..5] = 100
SP_TOTAL_TURNS[6..15] = 75
SP_TOTAL_TURNS[16..30] = 50
SP_TOTAL_TURNS[31..50] = 25
end
class Range
def <=>(other)
to_a <=> other.to_a
end
end
class Scene_Battle
alias :kyon_btl_score_scn_btl_start_ph5 :start_phase5
def process_aftermath_healing
hp_perc = sp_perc = 0
turns = $game_temp.battle_turn
KBattle::HP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
next unless min_turns.include?(turns)
hp_perc = percent
break
end
KBattle::SP_TOTAL_TURNS.sort.reverse.each do |min_turns, percent|
next unless min_turns.include?(turns)
sp_perc = percent
break
end
$game_party.actors.each do |actor|
next if actor.hp0?
actor.hp += actor.maxhp * hp_perc / 100
actor.sp += actor.maxsp * sp_perc / 100
end
end
def start_phase5
process_aftermath_healing
kyon_btl_score_scn_btl_start_ph5
end
end
DOWNLOAD DEMO
Terms & Conditions
Free for use in ANY game.
Due credit is mandatory!
Include this forum in your game credits as well!
That's it!
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Due credit is mandatory! Include this forum in your game credits as well! That's it!
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...