KAftermathSpoils VX
KAftermathSpoils VXby 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 = 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
Spoiler: Healing + Gold Ruby:
# * 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 = 100
HP_TOTAL_TURNS = 75
HP_TOTAL_TURNS = 50
HP_TOTAL_TURNS = 25
MP_TOTAL_TURNS = 100
MP_TOTAL_TURNS = 75
MP_TOTAL_TURNS = 50
MP_TOTAL_TURNS = 25
GOLD_TOTAL_TURNS = 150
GOLD_TOTAL_TURNS = 120
GOLD_TOTAL_TURNS= 100
GOLD_TOTAL_TURNS = 80
GOLD_TOTAL_TURNS = 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
Spoiler: Just Healing Ruby:
# * KAftermathHealing VX * #
# 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 = {}
MP_TOTAL_TURNS = {}
# If it took too long to defeat the enemy troopers...
HP_TOTAL_TURNS.default = 0
MP_TOTAL_TURNS.default = 0
# Add as many Ranges, i.e. 1..50 as necessary:
HP_TOTAL_TURNS = 100
HP_TOTAL_TURNS= 75
HP_TOTAL_TURNS = 50
HP_TOTAL_TURNS = 25
MP_TOTAL_TURNS = 100
MP_TOTAL_TURNS= 75
MP_TOTAL_TURNS = 50
MP_TOTAL_TURNS = 25
end
class Range
def <=>(other)
to_a <=> other.to_a
end
end
class Scene_Battle
alias :kyon_btl_score_scn_btl_proc_victory :process_victory
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 process_victory
process_aftermath_healing
kyon_btl_score_scn_btl_proc_victory
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!
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kaftermathspoils-vx.172303/
页:
[1]