Help - Search - Members - Calendar
Full Version: Battle End Messages
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
snstar2006
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 biggrin.gif

Credits
snstar2006, Snowy Star or in Chinese: 雪流星
Darkstorm091
I seem to be having a problem with your script. When I paste the script, it shows up as one long continuous line. Is there a way to fix this?
Kovu
Niice find. it works perfectly smile.gif

Darkstorm, try copy and paste the script again.
Copy from the bottom to the top.
EvilEagles
Actors gain too much EXP, and you will wait for a long & long time!. :|
The Wizard 007
I like the script but for some reason the experience is off by 1. Check the screenshot to know what I'm talking about. Also there's no gold recieved display at all. Nice script in theory and it is nice to look at, it just needs a little adjustment.
snstar2006
QUOTE (The Wizard 007 @ Feb 25 2009, 03:03 AM) *
I like the script but for some reason the experience is off by 1. Check the screenshot to know what I'm talking about. Also there's no gold recieved display at all. Nice script in theory and it is nice to look at, it just needs a little adjustment.

Oh, yeah, you reind me of that..
I am fixing that and some other bugs I found myself, I'll update as soon as I finish
SuperMega
This is very nice! Great work! I hope to try this one out soon.

EDIT: Just tested it and it works great! Way to go on another amazing script snstar2006!

EDIT 2: Found a little issue with this one. Whenever I finish a battle and everything finishes showing the EXP movement, there is an empty window at the bottom of the screen. Is there a way to make it go away or make it filled with text instead? Like something that says "Press "Z" to return to the field" or something?
snstar2006
QUOTE (SuperMega @ Feb 25 2009, 02:32 PM) *
This is very nice! Great work! I hope to try this one out soon.

EDIT: Just tested it and it works great! Way to go on another amazing script snstar2006!

EDIT 2: Found a little issue with this one. Whenever I finish a battle and everything finishes showing the EXP movement, there is an empty window at the bottom of the screen. Is there a way to make it go away or make it filled with text instead? Like something that says "Press "Z" to return to the field" or something?

That's the battle message box....
I left it there for the level up messages

Well....I think I'll need to remove it eventually since I am planning to make level up message look better
SuperMega
QUOTE
That's the battle message box....
I left it there for the level up messages

Well....I think I'll need to remove it eventually since I am planning to make level up message look better

For me, it displays that box right before the level up message occurs, so I have no idea why it comes up. Its an empty text box, then when you hit "Z," it tells you who levels up.
EvilEagles
sorry bout my bad english ...(>.<)
How can I skip the messages instantly?. For example, Ralph's party defeat Bahamut and gain 1000EXP, and I must wait for a long time to skip the messages & return to map.
Everdred
I'm having the same problem as Darkstorm. The text pastes itself as one line of code. I've never had this
problem before.
Hopefully I can figure out what the problem is here because this scripts looks pretty cool and I definately want to use it in my game. I had a suggestion, too.
I haven't got to actually try out the scripts yet, but from what I heard, if you earn a lot of experience then it takes a long time.
It would be really cool if you made it so the experience at the end of battle fills the bar like normal, but if you press the action button(space by default, I think) it would skip the bar filling and it would go straight to the full amount.
Azuaya
@Everdred: Just copy and paste the script and paste it into Notepad, that's how it will align itself and etc. Usually it is just the browser fault.

@Snstar: Nice script, like how you just move away the original battle end message away.
snstar2006
Script update

--- 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)

SuperMega
Cool, thanks for the update! My old problem has been fixed.

EDIT: Okay, now I have a new problem:

Any idea how to fix this one?
Lockheart
Interesting script, but upon testing I found that the characters seem to 'level up' even when they didn't even receive enough XP to actually level up. To put it in simpler terms, a character at level 5 could need 500 more EXP to reach level 6, at the end of each battle he earns about 10 XP, at the end of each same battle it will announce that he has reached the level up 5, showing the stats from lvl 6.
SuperMega
The error I'm getting occurs everytime the battle ends. I can't stop it from happening. Any solutions?
SuperMega
Bump for assistance.
Darkstorm091
I'm having the same problem as SuperMega,
Please help?
SuperMega
QUOTE (Darkstorm091 @ Mar 4 2009, 07:18 PM) *
I'm having the same problem as SuperMega,
Please help?

My suggestion is going back to the original version until snstar2006 an fix it. That is what I did for now. I'm sure snstar2006 will be back to support sometime. Here's the original version of the script that worked:

[Show/Hide] Click to view
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
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)
item_number = {}
for item in drop_items
if item_number[item].nil?
item_number[item] = 1
else
item_number[item] += 1
end
$game_party.gain_item(item, 1)
end
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
x = Graphics.width/4
@window_gainitem = Window_Base.new(x, -height, Graphics.width/2, height)
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
w = @window_gainitem.width-32
if drop_item.size > 0
@window_gainitem.contents.draw_text(0, 0, w, 24, $game_party.name + " gain:", 1)
drop_item.size.times do |i|
item = drop_item[i]
y = (i+1) * Window_Base::WLH
@window_gainitem.draw_item_name(item, 0, y)
str = "x #{item_number[item]}"
@window_gainitem.contents.draw_text(0, y, w, 24, str, 2)
end
else
@window_gainitem.contents.draw_text(0, 0, w, 24, $game_party.name + " gain nothing.", 1)
end
exp.times do |k|
$game_party.members.size.times do |i|
actor = $game_party.members[i]
y = (i+1)*Window_Base::WLH
@window_gainexp.contents.clear_rect(200, y, 120, 24)
max = actor.next_exp_s.is_a?(Integer) ? actor.next_exp_s : actor.exp
@window_gainexp.draw_actor_gauge(actor, 200, y, actor.exp+k, max)
@window_gainexp.contents.draw_text(200, y, 120, 24, "#{actor.exp+k}/#{max}", 1)
end
Graphics.wait(4)
end
$game_message.texts.push('')
wait_for_message
10.times do
@window_gainitem.openness -= 30
@window_gainexp.openness -= 30
Graphics.wait(1)
end
@window_gainitem.dispose
@window_gainexp.dispose
end
end
class Window_Base < Window
def draw_actor_gauge(actor, x, y, min, max, width = 120)
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
Everdred
I really hope he does come back and fix this. If he added just a few things, I think this would be the best after battle information script out there. The moving experience bars are great. He could make an adjustable speed option, though (for large amounts of experience, since the current rate can take a while). Or he could just make it so pressing the action/continue button skips the filling bars to the finished amount, immediately.
The only other thing I think would help would be to show the name of the stat on the level up numbers. Of course, right now, the level up window is bugged, anyways. Well... the whole thing is bugged. I definately want to use this script! I look forward to seeing this fixed.
Dragon-boy
HEY IAM GETING A ERROR " SCRIPT ' ' LINE 212: TypeError occurred nil can't be coerced into fixnum" help plz
mortigneous
first off, make sure its under materials, but above main (some don't know that)

line 212 is part of drawing the actor gauge. I haven't done anything with this script yet, but it looks like a compatibility issue. Might not be though since I'm still picking up on scripting

Anyway, simply due to the fact that the creator of this script doesn't seem to be responding, check this one out. [YERD] Display Victory Aftermath

It does the basics of what this script does and more, and Yanfly will more than likely help you if you have a problem that hasn't been answered yet.
Draakjepet2
AAAWWWW NOOOOOO!!!!!!!
this is just exacly what i'm looking for exacly what i need...
but this code were you can copy and paste the script... it's whit scrolling down...
now i don't know if anyone else has this prob. but when i copy the script and paste it i'll get it in 1 line... just 1 freaking damn long line -.-''
i just need script's you can copy whitout letting it scroll... -.-'' darn this :'(
The Law G14
What you have to do is copy the script into Word first, and then copy it into the scirpt editor. That's why I prefer not to put my scripts in codeboxs but at the same time, they don't take up that much space.
jacobsimmons
line 120 type error can't convert nil into array
Draakjepet2
QUOTE (Darkstorm091 @ Feb 25 2009, 06:14 AM) *
I seem to be having a problem with your script. When I paste the script, it shows up as one long continuous line. Is there a way to fix this?

i have the same problem and select it from the bottem to the top doesn't work for me either this is very enoying couse this is the script i want so bad!!! i realllly want it couse it's just awsome happy.gif

but i need the .txt thing or just a long code thing and not this scroll... thing laugh.gif
The Law G14
Like I said, just copy the script into Word or any other word processor that allows for formating and then copy it into the Script Editor from that word processor.
iryou999
Hey, I tried your script, it's great and all, but the only problem is not being able to skip the wait, any way to fix this?
TroyZ
yeah, that's right! why he didn't put a command that allow us to skip the exp bar filling?
we wait your next fixed script, snstar2006!
sorry if my english is bad.
Ninja1902
QUOTE (SuperMega @ Mar 5 2009, 05:41 PM) *
QUOTE (Darkstorm091 @ Mar 4 2009, 07:18 PM) *
I'm having the same problem as SuperMega,
Please help?

My suggestion is going back to the original version until snstar2006 an fix it. That is what I did for now. I'm sure snstar2006 will be back to support sometime. Here's the original version of the script that worked:

[Show/Hide] Click to view
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
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)
item_number = {}
for item in drop_items
if item_number[item].nil?
item_number[item] = 1
else
item_number[item] += 1
end
$game_party.gain_item(item, 1)
end
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
x = Graphics.width/4
@window_gainitem = Window_Base.new(x, -height, Graphics.width/2, height)
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
w = @window_gainitem.width-32
if drop_item.size > 0
@window_gainitem.contents.draw_text(0, 0, w, 24, $game_party.name + " gain:", 1)
drop_item.size.times do |i|
item = drop_item[i]
y = (i+1) * Window_Base::WLH
@window_gainitem.draw_item_name(item, 0, y)
str = "x #{item_number[item]}"
@window_gainitem.contents.draw_text(0, y, w, 24, str, 2)
end
else
@window_gainitem.contents.draw_text(0, 0, w, 24, $game_party.name + " gain nothing.", 1)
end
exp.times do |k|
$game_party.members.size.times do |i|
actor = $game_party.members[i]
y = (i+1)*Window_Base::WLH
@window_gainexp.contents.clear_rect(200, y, 120, 24)
max = actor.next_exp_s.is_a?(Integer) ? actor.next_exp_s : actor.exp
@window_gainexp.draw_actor_gauge(actor, 200, y, actor.exp+k, max)
@window_gainexp.contents.draw_text(200, y, 120, 24, "#{actor.exp+k}/#{max}", 1)
end
Graphics.wait(4)
end
$game_message.texts.push('')
wait_for_message
10.times do
@window_gainitem.openness -= 30
@window_gainexp.openness -= 30
Graphics.wait(1)
end
@window_gainitem.dispose
@window_gainexp.dispose
end
end
class Window_Base < Window
def draw_actor_gauge(actor, x, y, min, max, width = 120)
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



I edited this script so that it displayed the correct amount of exp gained. Change lines 70 & 71 to
@window_gainexp.draw_actor_gauge(actor, 200, y, actor.exp+k + 1, max)
@window_gainexp.contents.draw_text(200, y, 120, 24, "#{actor.exp+k + 1}/#{max}", 1)

it displayed fine for me after the change.
archeart
QUOTE (jacobsimmons @ Nov 14 2009, 02:06 PM) *
line 120 type error can't convert nil into array


same error here can someone help me out please tongue.gif
maxcloud
can make it full screen and show the actors face?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.