Battle End Messages
Version:2
Author: snstar2006
Release Date:2009/08/24
Exclusive Script at RPG RPG Revolution
Introduction
Instead of boring message showing with default script
Shows animated message as the screen shot
Features
* Showing EXP gauge
* Showing the number of drop items
--- Updated 2009/02/28 ---
* Showing Level up window
* Showing parameter increasing and skill learnt
* Expanded drop item window: hold up to 16 drop items(which is the maximum # of drop item unless extra script is used)
Script
[Show/Hide] Script:
CODE
class Scene_Battle < Scene_Base
# disable "display_exp_and_gold"
def display_exp_and_gold
end
# disable "display_drop_items"
def display_drop_items
display_exp_gold_and_items
Graphics.wait(10)
end
def display_exp_gold_and_items
exp = $game_troop.exp_total
gold = $game_troop.gold_total
drop_items = $game_troop.make_drop_items
drop_item = drop_items.uniq
$game_party.gain_gold(gold)
text = sprintf(Vocab::Victory, $game_party.name)
$game_message.texts.push('\|' + text)# + '\!')
wait_for_message
@message_window.visible = false
height = ($game_party.members.size + 1)*24 + 32
@window_gainexp = Window_Base.new(Graphics.width, 0, Graphics.width*3/4, height)
@window_gainexp.openness = 0
height = Graphics.height - @window_gainexp.height
@window_gainitem = Window_Loot.new(0, -height, Graphics.width, height, drop_items, gold)
9.times do |i|
Graphics.wait(3)
@window_gainexp.x -= 68 if @window_gainexp.x > Graphics.width/8
@window_gainexp.openness += 32 if @window_gainexp.openness < 255
@window_gainitem.y += 52 if @window_gainitem.y < @window_gainexp.height
end
str = sprintf(Vocab::ObtainExp, exp)
w = @window_gainexp.width-32
@window_gainexp.contents.draw_text(0, 0, w, 24, str, 1)
$game_party.members.size.times do |i|
actor = $game_party.members[i]
y = (i+1)*Window_Base::WLH
@window_gainexp.draw_actor_name(actor, 0, y)
@window_gainexp.draw_actor_level(actor, 110, y)
end
@actor_lvup = {}
0.step(exp, 1) do |k|
$game_party.members.size.times do |i|
actor = $game_party.members[i]
@actor_lvup[actor] = 0 if @actor_lvup[actor].nil?
actor_now_level = actor.level
y = (i+1)*Window_Base::WLH
@window_gainexp.contents.clear_rect(200, y, 120, 24)
max = actor.exp_lv(1+actor_now_level+@actor_lvup[actor])
unless $game_party.existing_members.include?(actor)
@window_gainexp.draw_actor_gauge(actor, 200, y, actor.exp, max)
@window_gainexp.contents.draw_text(200, y, 120, 24, "#{actor.exp}/#{max}", 1)
next
end
min = actor.exp+k
if (min >= max)
actor.lvup = true
actor.level_up
@window_gainexp.contents.clear_rect(110, y, 56, 24)
@window_gainexp.draw_actor_level(actor, 110, y)
@actor_lvup[actor] += 1
min -= max
max = actor.exp_lv(1+actor.level+@actor_lvup[actor])
@actor_lvup[actor]
end
@window_gainexp.draw_actor_gauge(actor, 200, y, min, max)
@window_gainexp.contents.draw_text(200, y, 120, 24, "#{min}/#{max}", 1)
end
Graphics.wait(2)
end
@window_lvs = []
for actor in $game_party.existing_members
actor.exp += exp
@window_lvs.push(actor.display_level_up)
end
for win in @window_lvs
win.visible = true
$game_message.texts.push('')
wait_for_message
10.times do
win.openness -= 50 if win.openness > 0
Graphics.wait(2)
end
win.dispose
end
10.times do
@window_gainitem.openness -= 30
@window_gainexp.openness -= 30
Graphics.wait(1)
end
@window_gainitem.dispose
@window_gainexp.dispose
end
def display_level_up
end
end
class Game_Actor < Game_Battler
attr_reader :lvup
def lvup=(tf)
@lvup = tf
return unless @lvup
@old_hpmax = base_maxhp
@old_mpmax = base_maxmp
@old_atk = base_atk
@old_def = base_def
@old_agi = base_agi
@old_spi = base_spi
@old_skills = skills
end
def exp=(t)
return unless t.is_a?(Integer)
@exp = t
end
def exp_lv(lv)
return (@exp_list[lv])#-@exp_list[lv-1])
end
def display_level_up
new_skills = skills - @old_skills
wlh = Window_Base::WLH
width = Graphics.width-32
height = wlh * [7, 1+new_skills.size].max + 32
y = (Graphics.height - height)/2
window_display_lv = Window_Base.new(0, y, width+32, height)
window_display_lv.visible = false
text = sprintf(Vocab::LevelUp, @name, Vocab::level, @level)
window_display_lv.contents.draw_text(0, 0, width, wlh, text, 1)
if new_skills.empty?
text = "No new skill learnt."
twidth = window_display_lv.contents.text_size(text).width
x = (window_display_lv.width - 152 - twidth)/2
y = (window_display_lv.height - 2*wlh - 32)/2
window_display_lv.contents.draw_text(x, y, twidth, wlh, text)
else
for i in 0...new_skills.size
skill = new_skills[i]
text = sprintf(Vocab::ObtainSkill, skill.name)
y = (i+1)*wlh
window_display_lv.draw_icon(skill.icon_index, 48, y)
window_display_lv.contents.draw_text(84, y, width, wlh, text)
end
end
temp_values = [@old_hpmax, @old_mpmax, @old_atk, @old_def, @old_agi, @old_spi]
new_values = [base_maxhp, base_maxmp, base_atk, base_def, base_agi, base_spi]
for i in 0...6
val = temp_values[i]
nval = new_values[i]
y = (i+1)*wlh
x = width - 120
color1 = Color.new(128, 255, 128)
color2 = Color.new(255, 128, 128)
window_display_lv.contents.font.color = window_display_lv.normal_color
window_display_lv.contents.draw_text(x, y, 120, wlh, val)
window_display_lv.contents.font.color = (nval > val ? color1 : color2)
window_display_lv.contents.draw_text(x, y, 120, wlh, "->", 1)
window_display_lv.contents.draw_text(x, y, 120, wlh, nval, 2)
end
@lvup = false
return window_display_lv
end
end
class Window_Loot < Window_Base
def initialize(x, y, width, height, items, gold)
super(x, y, width, height)
@gold_gain = gold
@item_number = {}
for item in items
if @item_number[item].nil?
@item_number[item] = 1
else
@item_number[item] += 1
end
$game_party.gain_item(item, 1)
end
@items = items.uniq
refresh
end
def refresh
w = self.width-32
if @items.size == 0 && @gold_gain == 0
@sprite_loot.visible = false
self.contents.font.color = Color.new(128, 255, 128)
self.contents.draw_text(0, 0, w, 24, $game_party.name + " gain nothing.", 1)
else
self.contents.font.color = Color.new(255, 255, 255)
self.contents.draw_text(120, 0, w, 24, $game_party.name + " gain:")
self.contents.font.color = Color.new(255, 255, 128)
self.contents.draw_text(180, 0, w, 24, "#{@gold_gain} #{Vocab::gold} of gold", 1)
@items.size.times do |i|
item = @items[i]
x = (i%2) * 256
y = (i/2+1) * Window_Base::WLH
self.draw_item_name(item, x+12, y)
str = "x #{@item_number[item]}"
self.contents.draw_text(x-12, y, w/2, 24, str, 2)
end
self.contents.font.size = 40
self.contents.font.name = "Vivaldi"
str = "Loot"
self.contents.font.shadow = false
self.contents.font.color = Color.new(128, 128, 255)
self.contents.draw_text(-4, -18, 200, 60, str)
self.contents.font.color = Color.new(255, 255, 128)
self.contents.draw_text(-2, -16, 200, 60, str)
end
end
end
class Window_Base < Window
def draw_actor_gauge(actor, x, y, min, max, width = 120)
self.contents.clear_rect(x, y, width+32, WLH)
gw = width * min / max
gc1 = Color.new(255, 255, 0)
gc2 = Color.new(255, 255, 128)
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end
Customization
No need, this script is plug and play
Compatibility
Dunno yet
methods: "display_exp_and_gold" and "display_drop_items" are overwritten
Screenshot
Click to view attachment
DEMO
No need, this script is plug and play
Installation
Plug and play, just paste it anywhere between "main" and "Scene_Battle"
Terms and Conditions
Free to use as long as credit is stated.....you can pay me if you want
Credits
snstar2006, Snowy Star or in Chinese: 雪流星

