09-07-2006, 01:00 PM
Battle Trophies v2.1 &
Seperate File Add-On
by GoldenShadow
Sep 7 2005
Please read the comments in the script (the text in green).
There is no demo available and also no screenshots. Just make a new test project
and test it out yourself. Don't be lazy. Don't be afraid either, if you mess up,
it's not the end of the world. Just test.
The scripts
Calling up the Battle Trophies Window:
This next thing, it's the Save to Seperate file add-on for the Battle Trophies. (Optional)
EDIT: Due reasons beyond me, the script isn't showing correctly, therefore you can click on the
attachment to view it in the original textfile. Sorry for this inconvenience.
Battle_Trophies_Save_Addon.txt (Size: 9.21 KB / Downloads: 2)
Seperate File Add-On
by GoldenShadow
Sep 7 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Please read the comments in the script (the text in green).
There is no demo available and also no screenshots. Just make a new test project
and test it out yourself. Don't be lazy. Don't be afraid either, if you mess up,
it's not the end of the world. Just test.
The scripts
Battle Trophies v2.1
Code:
#=============================================================
# <> Battle Trophies similar to Star Ocean 3: Till the End of Time
# ==> You can delete all the comments except the copyright and creator info. Thanks.
# ==> Do not rip, repost or any other way of reproducing without proper credit. Thanks.
# ShadowClan Technologies © 2003-2005 - All rights reserved. X-RPG/Asylum rules :-)
#--------------------------------------------------------------------------------------------------------------------------
# * So... what the hell is a 'Battle Trophy' anyways??
# The term 'Battle Trophies' is really what is says it is.
# That in battle, by doing various tasks, you can obtain
# a 'proof' of succession of the task made. These tasks
# can vary from doing a damage over 1000 to doing
# a damage of 0. Or even winning alone or defeating
# at least 1000 enemies, etc.. The 'proof' is called a
# 'trophy' and because it's mainly done in battle, it
# is therefore called a 'Battle Trophy'.
#
# * So... how the hell does this work anyway??
# Having multiple trophy check defs, like damage checking and result,
# you can get lots of trophies. The way trophies are set to 'achievement'
# is simply by checking every trophy condition in that particular def and
# if one or more conditions are met, it sets that ID in @trophy_id to true.
# Thus making it 'achieved'. If not, it does nothing, leaving that ID to nil (nothing).
#
# * And how about using them? How do I do that?
# The trophies that are set as default or the ones you set up, are initiated
# when a new game starts. To get a trophy, just battle battle battle!
# If you're a debugger, you can use $bt.get_data(print=true) for popping the stuff up.
# If you want to make your own windows that should list all trophies, then you must
# put the $bt.get_data under 'def initialize' or 'def main', because only then
# you can use the arrays for the IDs or names and stuff, like this:
# $bt.trophy_id[ID] is the trophy ID, returns true if met, and nil if not met
# $bt.trophy_names[ID] is trophy name ID, returns the name if met, and nothing if not.
# Some Ruby codes documented in the japanese helpfile you can use:
# Array.reverse > Reverses contents, example: [1,2,3] becomes [3,2,1]
# Array.first > Returns first item, example: Array.first returns 1 if 1 is first.
# Array.last > Returns last item, example: Array.last returns 3 if 3 is last.
# Array.clear > Clears the array of its contents.
# Array.compact > Removes 'nil' items from an array, and returns the remaining.
# Array.nitems > Returns amount of items that are non-nil.
# Array.uniq > Returns the array with duplicate items removed.
# Array.fill(n) > Fills the array with n, where 'n' is a string or a number.
#
# * "Can I make sum trophies too? Well can I huh, big GS?" -Cloud_1989
# You can also add your own trophies. To do that, just study the
# trophies how they are created & placed then add your own.
# They catagorized by their purpose like 'def check_trophy_DAMAGE' (which is also for heals).
# If it still doesn't fit anywhere, try adding a new catagory... !!CAUTION!!
# --> If you're a rookie DO NOT DO THAT, adding categories may screw up your battles!!
# --> If you're not a rookie, don't add it directly to your game, make test project first!
# But when you've learned it, then add as many as you want -- Just knock yourself out! :-P
#
# * What if you plan on removing all data? Can I reset the whole thing?
# If you want to reset the data for any reason, like customized game overs or so,
# you can do that by either Call Script or scenes by adding this: $bt.reset_data
# It will reset most things... what exactly? Look at: Battle_Trophies#reset_data
#
# * To view the whole history, http://www.sct.net/scripts/sid04/history.txt [Site is currently down]
#
# * What is fixed in ver 2.0 ?
# - Shows window on achievement and/or hears sound on achievement!
# - Works more efficienter and effective now.
# - Added new thing 'add_trophy(id)' for adding trophies.
# Can now be used as: $bt.add_trophy(Trophy ID). [Assuming $bt = Battle_Trophies.new]
# - Some other minor bug fixes.
#
# * What is fixed in ver 2.1 ?
# - Instead of global variables, it uses attribute accessors to store data internally.
# - Showing the trophies in the window works different (Not through name&ID but just ID).
# - Each array can be accessed anytime using $bt.data, replace data with the array.
# Example 1: $bt.trophy_id[id] => Returns true if met, nil of not.
# Example 2: $bt.amount_battles => Returns the amount of battles made so far
# - Remove of some stuff I forgot to change, I needed them to debug, they're now fixed.
# - Also changed this intro, regarding the explain of some things. It's more rookie-friendly now.
#
# That would end the little explaining for now. I -really- hope you like this script.
#--------------------------------------------------------------------------------------------------------------------------
# * Suggestions? ==> Post/PM (X-RPG forums) or emailling me: invincible_p0wer_@hotmail.com
# * Created by: GoldenShadow
# * Credits: Big thanks to Sodisna for helping me out! Wouldn't continue this script without 'em! :-P
# And Kio for bringing me on the idea ...
#=============================================================
module SC # don't remove this module
RXSC_BTS_ = "Battle Trophies Script: v2.1 (SID:02)"
RXSC_BTSE = "Battle Trophies Scene: v1.0 (SID:02)"
BT_POPUP_SOUND = "Audio/SE/015-Jump01" # Soundfile
BT_POPUP_MODE = 2 # Popup mode
# Popup mode, style of showing when you've achieved a trophy:
# 0 : Only window, 1 : Only sound, 2 : Both, 3 : None
end
class Battle_Trophies # Be careful when adding definitions unless you know what you're doing~
attr_accessor :trophy_id # Trophy array full of IDs with either true/false as key
attr_accessor :trophy_names # Trophy array full of IDs with their names
attr_accessor :new_trophy # Array with the new trophies
attr_accessor :trophy_perc # % of trophies got
attr_accessor :trophy_amount # Amount of trophies
attr_accessor :defeated_enemies # Amount of defeated enemies (Optional)
attr_accessor :amount_miss # Amount of misses (Optional)
attr_accessor :amount_battles # Amount of battles (Optional)
attr_accessor :ally_kills # Amount of allies kills (Optional)
def initialize
@trophy_id = []
@trophy_names = []
@new_trophy = []
@trophy_perc = 0
@trophy_amount = 0
@defeated_enemies = 0
@amount_miss = 0
@amount_battles = 0
@ally_kills = 0
end
def reset_data
@trophy_id = []
@trophy_names = []
@new_trophy = []
@trophy_perc = 0
@trophy_amount = 0
#@defeated_enemies = 0 # If you want them to reset too, delete '#'
@amount_miss = 0
#@amount_battles = 0 # If you want them to reset too, delete '#'
@ally_kills = 0
end
# Ver. 2: This is the new way of adding trophies;
# fast and efficient! + Easy to track the errors if any
def add_trophy(id)
if !id.is_a?(Numeric)
return
end
if @trophy_id.include?(id) or @trophy_id[id] == true or @new_trophy[id] == false
return
else
if id == 3 # Making damage 100, 1000 also be true when 10.000 is achieved
@trophy_id[1] = true
@trophy_id[2] = true
@trophy_id[3] = true
elsif id == 32 # Same as damage, only heal version
@trophy_id[31] = true
@trophy_id[32] = true
@trophy_id[33] = true
else
@trophy_id[id] = true
end
trophy_name
@new_trophy[id] = @trophy_names[id]
end
end
# Checks the damage for trophy
# Note: Healing damage is always negative. (Example: -2039 would heal 2039)
# Note: If you specify enemy, you can check enemy stats to compare with the damage/healing/etc
def check_trophy_damage(damage, actor, exact = false, enemy = nil)
if actor.is_a?(Game_Actor)
if damage.is_a?(Numeric)
## "Damage 10000 or more, 1000~10000, 100~1000, 100~ and 0 respectivly
if damage >= 10000
add_trophy(3)
elsif damage >= 1000 and damage <= 9999
add_trophy(2)
elsif damage >= 100 and damage <= 999
add_trophy(1)
elsif damage == 0
add_trophy(0)
## Stuff for damage according to enemy stats.
elsif enemy != nil
## "Deal a damage of enemy HP*2 or greater
if damage >= (enemy.maxhp * 2) and damage < (enemy.maxhp * 4)
add_trophy(35)
## "Deal a damage of enemy HP*4 or greater
elsif damage >= (enemy.maxhp * 4)
add_trophy(36)
end
## "Heal 100~1000 HP, 1000~10.000 HP, 10.000> HP and exact respectivly
elsif damage <= -100 and damage > -1000
add_trophy(30)
elsif damage <= -1000 and damage > -10000
add_trophy(31)
elsif damage <= -10000
add_trophy(32)
elsif damage == actor.maxhp
add_trophy(33)
## "Heal half Hp
elsif damage == (actor.maxhp / 2)
add_trophy(34)
## "Damage 777, 7777, 77.777 respectivly
elsif damage == 777
add_trophy(37)
elsif damage == 7777
add_trophy(38)
elsif damage == 77777
add_trophy(39)
end
elsif damage.is_a?(String)
## Miss 10, 100, 1000, 10.000 times respectivly
if damage == "Miss"
if @miss_count == nil
@miss_count = 1
elsif @miss_count != nil
@miss_count += 1
elsif @miss_count > 9
add_trophy(18)
elsif @miss_count > 99
add_trophy(19)
elsif @miss_count > 999
add_trophy(20)
end
end
end
if exact == true
add_trophy(25)
end
end
end
# Checks result conditions
def check_trophy_results
## "Win alone! ##
if $game_party.actors.size == 1
add_trophy(4)
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
## "Win with at least one member full HP & SP respectivly
if actor.hp == actor.maxhp
add_trophy(13)
end
if actor.sp == actor.maxsp
add_trophy(14)
end
## "Reach level 10, 50 and 99(100) respectivly
if actor.level >= 10 and actor.level < 50
add_trophy(15)
end
if actor.level >= 50 and actor.level < 99#100
add_trophy(16)
end
if actor.level == 99#100
add_trophy(17)
end
## "Reach HP of 1000~9999 & 9999 respectivly
if actor.maxhp > 999 and actor.maxhp < 9999
add_trophy(26)
end
if actor.maxhp == 9999
add_trophy(27)
end
## "Reach SP of 1000~9999 & 9999 respectivly
if actor.maxsp > 999 and actor.maxsp < 9999
add_trophy(28)
end
if actor.maxsp == 9999
add_trophy(29)
end
end
## "Last battle for 50 turns and 100 turns respectivly
if $game_temp.battle_turn >= 50
add_trophy(5)
end
if $game_temp.battle_turn >= 100
add_trophy(6)
end
end
# Checks the amount of KO's (Deaths, Kills, Downs or whatever)
def check_trophy_kills
## "Defeat 0~10, 10~100, 100~1000 and 1000+ enemies respectivly
if @defeated_enemies > 0 and @defeated_enemies < 10
add_trophy(21)
end
if @defeated_enemies > 9 and @defeated_enemies < 100
add_trophy(22)
end
if @defeated_enemies > 99 and @defeated_enemies < 1000
add_trophy(23)
end
if @defeated_enemies > 999
add_trophy(24)
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.hp == 0
if @ally_kills == nil
@ally_kills = 0
else
@ally_kills += 1
end
## "Partymembers got killed 10 or more timesa dn 100 or more times respectivly
if @ally_kills > 9
add_trophy(7)
end
if @ally_kills > 99
add_trophy(8)
end
end
end
end
# Check amount of battles
def check_trophy_battles
## "Fought over 10, 100, 1000, 10.000 times respectivly
if @amount_battles >= 10 and @amount_battles < 100
add_trophy(9)
end
if @amount_battles >= 100 and @amount_battles < 1000
add_trophy(10)
end
if @amount_battles >= 1000 and @amount_battles < 10000
add_trophy(11)
end
if @amount_battles >= 10000
add_trophy(12)
end
end
# This is where you set up your trophy name
# You can also merge 'em in the core itself (like def check_trophy_battles)
def trophy_name
if @trophy_id[0] == true
@trophy_names[0] = "Do a damage of 0!"
end
if @trophy_id[1] == true
@trophy_names[1] = "Do over 100 damage!"
end
if @trophy_id[2] == true
@trophy_names[2] = "Do over 1000 damage!"
end
if @trophy_id[3] == true
@trophy_names[3] = "Do over 10.000 damage!"
end
if @trophy_id[4] == true
@trophy_names[4] = "Win alone!"
end
if @trophy_id[5] == true
@trophy_names[5] = "Battle lasted for 50 turns!"
end
if @trophy_id[6] == true
@trophy_names[6] = "Battle lasted for 100 turns!"
end
if @trophy_id[7] == true
@trophy_names[7] = "Members got killed 10+ times!"
end
if @trophy_id[8] == true
@trophy_names[8] = "Members got killed 100+ times!"
end
if @trophy_id[9] == true
@trophy_names[9] = "Fought over 10 times!"
end
if @trophy_id[10] == true
@trophy_names[10] = "Fought over 100 times!"
end
if @trophy_id[11] == true
@trophy_names[11] = "Fought over 1000 times"
end
if @trophy_id[12] == true
@trophy_names[12] = "Fought over 10000 times!"
end
if @trophy_id[13] == true
@trophy_names[13] = "Win w/one member full HP!"
end
if @trophy_id[14] == true
@trophy_names[14] = "Win w/one member full SP!"
end
if @trophy_id[15] == true
@trophy_names[15] = "Reach level 10!"
end
if @trophy_id[16] == true
@trophy_names[16] = "Reach level 50!"
end
if @trophy_id[17] == true
@trophy_names[17] = "Reach level 99!"
end
if @trophy_id[18] == true
@trophy_names[18] = "Miss 10 times!"
end
if @trophy_id[19] == true
@trophy_names[19] = "Miss 100 times!"
end
if @trophy_id[20] == true
@trophy_names[20] = "Miss 1000 times!"
end
if @trophy_id[21] == true
@trophy_names[21] = "Defeat at least 1 enemy!"
end
if @trophy_id[22] == true
@trophy_names[22] = "Defeat at least 10 enemies!"
end
if @trophy_id[23] == true
@trophy_names[23] = "Defeat at least 100 enemies!"
end
if @trophy_id[24] == true
@trophy_names[24] = "Defeat at least 1000 enemies!"
end
if @trophy_id[25] == true
@trophy_names[25] = "Do exact damage!"
end
if @trophy_id[26] == true
@trophy_names[26] = "Reach an HP of 1000!"
end
if @trophy_id[27] == true
@trophy_names[27] = "Reach an HP of 9999!"
end
if @trophy_id[28] == true
@trophy_names[28] = "Reach an SP of 1000!"
end
if @trophy_id[29] == true
@trophy_names[29] = "Reach an SP of 9999!"
end
if @trophy_id[30] == true
@trophy_names[30] = "Heal at least 100 HP"
end
if @trophy_id[31] == true
@trophy_names[31] = "Heal at least 1000 HP"
end
if @trophy_id[32] == true
@trophy_names[32] = "Heal at least 10000 HP"
end
if @trophy_id[33] == true
@trophy_names[33] = "Heal exact HP"
end
if @trophy_id[34] == true
@trophy_names[34] = "Heal half Max.HP"
end
if @trophy_id[35] == true
@trophy_names[35] = "Overkill enemy HPx2"
end
if @trophy_id[36] == true
@trophy_names[36] = "Overkill enemy HPx4"
end
if @trophy_id[37] == true
@trophy_names[37] = "777 Damage!"
end
if @trophy_id[38] == true
@trophy_names[38] = "7777 Damage!"
end
if @trophy_id[39] == true
@trophy_names[39] = "77777 Damage!"
end
end
# To show names, default is just put in global array
def get_data(print = false) # Printing was for the debugging
trophy_name
@perc = 0
for id in 0...@trophy_id.size
if @trophy_id[id] == true
@perc += 1
end
if print == true
if @trophy_names[id] == nil
p "Not Met: ID #{id}: ???"
else
p "Met: ID #{id}: #{@trophy_names[id]}"
end
end
end
if @perc != 0
@trophy_amount = @perc
@trophy_perc = (100.0 / @trophy_id.size) * @perc
else
@trophy_amount = 0
@trophy_perc = 0
end
end
end
#===========================================================
# * Now the Game_Battler needs some modifications.
# * This is needed for being able to check the conditions after an action.
#===========================================================
class Game_Battler
alias bt_skill_effect skill_effect
alias bt_attack_effect attack_effect
def attack_effect(attacker)
bool = bt_attack_effect(attacker)
hit_result = (rand(100) < attacker.hit)
if hit_result == true
if self.is_a?(Game_Enemy)
$bt.check_trophy_damage(self.damage, attacker, false, self)
if self.hp == 0
if $defeated_enemies == nil
$defeated_enemies = 0
else
$defeated_enemies += 1
end
elsif self.damage == self.hp
$bt.check_trophy_damage(self.damage, attacker, true, nil)
end
elsif self.is_a?(Game_Actor)
$bt.check_trophy_damage(self.damage, attacker, true, nil)
end
end
return bool
end
def skill_effect(user, skill)
effective = bt_skill_effect(user, skill)
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
if hit_result == true
if self.is_a?(Game_Enemy)
$bt.check_trophy_damage(self.damage, user, false, self)
if self.hp == 0
if $defeated_enemies == nil
$defeated_enemies = 0
else
$defeated_enemies += 1
end
elsif self.damage == self.hp
$bt.check_trophy_damage(self.damage, user, true, nil)
end
else
$bt.check_trophy_damage(self.damage, user, false, nil)
end
end
return effective
end
end
#===========================================================
# * Now the Scene_Title also needs some modifications.
# * This is when a new game is started, the $bt.* must be defined.
#===========================================================
class Scene_Title
alias bt_title_command_new_game command_new_game
alias bt_battle_test battle_test
def command_new_game
bt_title_command_new_game
$bt = Battle_Trophies.new
end
def battle_test
$bt = Battle_Trophies.new
bt_battle_test
end
end
#===========================================================
# * Now the Scene_Load also needs some modifications.
# * Because when loading, the trophies must be loaded too.
# * See Battle Trophies Add-On (SID04) to load it from a seperate file
#===========================================================
class Scene_Load
alias bt_load_data read_save_data
def read_save_data(file)
bt_load_data
$bt = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end
#===========================================================
# * Now the Scene_Save also needs some modifications.
#===========================================================
class Scene_Save
alias bt_save_data write_save_data
def write_save_data(file)
bt_save_data
Marshal.dump($bt, file)
end
end
#===========================================================
# * Final step: Battle scene for checking battle result for available trophies.
#===========================================================
class Scene_Battle
alias bt_scene_battle_main main
alias bt_scene_battle_update update
alias bt_scene_battle_start_phase5 start_phase5
alias bt_scene_battle_battle_end battle_end
alias bt_scene_battle_update_phase4_step5 update_phase4_step5
def main
if $bt.amount_battles == nil or $bt.amount_battles == 0
$bt.amount_battles = 1
else
$bt.amount_battles += 1
end
bt_scene_battle_main
if @pop_up != nil
@pop_up.dispose
@pop_up = nil
end
end
def update
if @pop_up != nil
@pop_up.update
end
bt_scene_battle_update
end
def start_phase5
$bt.check_trophy_results
$bt.check_trophy_kills
$bt.check_trophy_battles
$bt.get_data
bt_scene_battle_start_phase5
end
def update_phase4_step5 # This one is new (Ver. 2)
bt_scene_battle_update_phase4_step5
$bt.get_data
if @pop_up != nil
@pop_up.dispose
@pop_up = nil
end
if SC::BT_POPUP_MODE == 0 or SC::BT_POPUP_MODE == 2
@pop_up = Window_Popup.new
elsif SC::BT_POPUP_MODE == 1
for id in 0...$new_trophy.size
if $bt.new_trophy[id] != nil
@ok = true
end
end
if @ok == true
Audio.se_play(SC::BT_POPUP_SOUND, 100, 100)
end
else
# ... nothing happens, making the script move on --->
end
@phase4_step = 1
end
def battle_end(result)
$bt.trophy_name
result = bt_scene_battle_battle_end(result)
end
end
#===========================================================
# <> Optional: Custom window showing achieved trophies
#===========================================================
#===========================================================
# * Window_BattleTrophies
#===========================================================
class Window_BattleTrophies < Window_Selectable
def initialize
super(0, 64, 640, 416)
@column_max = 2
$bt.get_data
refresh
self.index = 0
end
def item
return @trophy_id[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $bt.trophy_id.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
if $bt.trophy_names[index] != nil
self.contents.font.color = normal_color
self.contents.draw_text(x, y, self.width - 40, 32, "#{index + 1}:")
self.contents.draw_text(x + 30, y, self.width - 40, 32, "#{$bt.trophy_names[index]}", 0)
else
self.contents.font.color = Color.new(255,255,255,80)
self.contents.draw_text(x, y, self.width - 40, 32, "#{index + 1}:", 0)
self.contents.draw_text(x + 30, y, self.width - 40, 32, "????", 0)
end
end
end
#===========================================================
# * Window_Popup: Pop up window that tells if one is achieved!
#===========================================================
class Window_Popup < Window_Base
def initialize
super(4,4, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.visible = false
self.opacity = 160
self.visible = true
for id in 0...$bt.new_trophy.size
if $bt.new_trophy[id] != nil and $bt.new_trophy[id] != false
@ok = true
refresh
end
end
if @ok == true
@wait = 40 # amount of frams that window will be visible
else
@wait = -1
self.visible = false
end
end
# Update to auto hide the window
def update
super
if @wait == 0
self.visible = false
@wait = -1
else
@wait -= 1
end
end
# Refreshing to show the contents
def refresh
self.contents.clear
self.contents.font.color = normal_color
for id in 0...$bt.new_trophy.size
if $bt.new_trophy[id] != nil and $bt.new_trophy[id] != false
if SC::BT_POPUP_MODE == 2 or SC::BT_POPUP_MODE == 1
Audio.se_play(SC::BT_POPUP_SOUND, 100, 100)
end
self.contents.draw_text(4, 0, self.width - 40, 32, $bt.new_trophy[id])
$bt.new_trophy[id] = false
end
end
end
end
#===========================================================
# <> Optional: Scene with the custom window in use.
#===========================================================
class Scene_BT
def main
@trophy_window = Window_BattleTrophies.new
@trophy_window.active = true
@help_window = Window_Help.new
p = $bt.trophy_perc.to_s
@perc = "%1.2f" % p.to_f
@help_window.set_text("You have #{$bt.trophy_amount} trophies of #{$bt.trophy_id.size}. Percentage achieved: #{@perc}%")
@discard_window = Window_Command.new(190, ["Remove trophy","Remove all","Cancel"])
@discard_window.x = 320 - @discard_window.width / 2
@discard_window.y = 240 - @discard_window.height / 2
@discard_window.active = false
@discard_window.visible = false
@discard_window.z = 9999
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@trophy_window.dispose
@help_window.dispose
@discard_window.dispose
end
def update
@trophy_window.update
@help_window.update
if @discard_window.active == true
update_discard
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new # Change to your previous screen
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@discard_window.visible = true
@discard_window.active = true
@trophy_window.active = false
end
if $bt.trophy_names[@trophy_window.index] != nil
@discard_window.refresh
elsif $bt.trophy_names.nitems == 0 or $bt.trophy_id.nitems == 0
@discard_window.disable_item(0)
@discard_window.disable_item(1)
else
@discard_window.disable_item(0)
end
end
def update_discard
@discard_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@discard_window.visible = false
@discard_window.active = false
@trophy_window.active = true
end
if Input.trigger?(Input::C)
case @discard_window.index
when 0
if $bt.trophy_names[@trophy_window.index] == nil
$game_system.se_play($data_system.buzzer_se)
return
else
$game_system.se_play($data_system.decision_se)
$bt.trophy_names[@trophy_window.index] = nil
$bt.trophy_id[@trophy_window.index] = nil
$bt.get_data
@discard_window.visible = false
@discard_window.active = false
@trophy_window.active = true
@trophy_window.refresh
p = $bt.trophy_perc.to_s
@perc = "%1.2f" % p.to_f
@help_window.set_text("You have #{$bt.trophy_amount} trophies of #{$bt.trophy_id.size}. Percentage achieved: #{@perc}%")
end
when 1
if $bt.trophy_names.nitems == 0 or $bt.trophy_id.nitems == 0
$game_system.se_play($data_system.buzzer_se)
return
else
$game_system.se_play($data_system.decision_se)
$bt.trophy_id.fill(nil)
$bt.trophy_names.fill(nil)
$bt.get_data
@trophy_window.refresh
@trophy_window.active = true
@discard_window.visible = false
@discard_window.active = false
p = $bt.trophy_perc.to_s
@perc = "%1.2f" % p.to_f
@help_window.set_text("You have #{$bt.trophy_amount} trophies of #{$bt.trophy_id.size}. Percentage achieved: #{@perc}%")
@discard_window.disable_item(0)
@discard_window.disable_item(1)
end
when 2
$game_system.se_play($data_system.cancel_se)
@trophy_window.active = true
@discard_window.visible = false
@discard_window.active = false
end
end
end
end
# FINAL UPDATE: 19:14, 1st of July 2005
Calling up the Battle Trophies Window:
Code:
$scene = Scene_BT.new
This next thing, it's the Save to Seperate file add-on for the Battle Trophies. (Optional)
EDIT: Due reasons beyond me, the script isn't showing correctly, therefore you can click on the
attachment to view it in the original textfile. Sorry for this inconvenience.
Battle_Trophies_Save_Addon.txt (Size: 9.21 KB / Downloads: 2)