Okay, I'm using Prexus's Bestiary script. I don't know if this belongs in RGSS support or what, but there is one problem with it. That is, when you encounter an enemy, then save and end the game, when you continue it the bestiary will reset back to 0. Is there anyway to fix this?
Code:
# ------------------------------------------------------------------- #
# PXMod::Beastiary #
# By Prexus #
# Description: Allows you to view enemies in the game and their stats #
# ------------------------------------------------------------------- #
module RPG
class Enemy
alias pxmod_r_enemy_initialize initialize
def initialize
pxmod_r_enemy_initialize
@seen = false
end
attr_accessor :seen
def set_seen(yes = false)
@seen = yes
end
end
end
class Game_Enemy < Game_Battler
alias pxmod_g_enemy_initialize initialize
def initialize(troop_id, member_index)
pxmod_g_enemy_initialize(troop_id, member_index)
enemy = $data_enemies[@enemy_id]
enemy.set_seen(true)
end
end
module PXMod
class Window_BeastList < Window_Selectable
def initialize
super(350, 64, 290, 416);
self.index = 0;
refresh;
end
def enemy
return @data[self.index];
end
def refresh
if self.contents != nil
self.contents.dispose;
self.contents = nil;
end
@data = [];
for i in 1...30
if $data_enemies[i].seen
@data.push($data_enemies[i]);
else
@data.push('????');
end
end
@item_max = @data.size;
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32);
for i in 0...@item_max
draw_item(i);
end
end
end
def draw_item(index)
item = @data[index];
x = 4;
y = index * 32;
case item
when RPG::Enemy
self.contents.draw_text_shadow(x, y, self.contents.width - 8, 32,
"#{item.id} #{item.name}", 0);
else
self.contents.draw_text_shadow(x, y, self.contents.width - 8, 32, item, 1);
end
end
end
class Window_BeastInfo < Window_Base
def initialize
super(0, 64, 350, 416);
self.contents = Bitmap.new(width - 32, height - 32);
end
def refresh(enemy)
return if enemy == @enemy;
@enemy = enemy;
self.contents.clear;
third_width = (self.contents.width - 8) / 3;
y_offset = 192;
if @enemy.is_a?(String);
rect = Rect.new(0, 0, third_width+8, 32);
rect2 = Rect.new(1, 1, third_width+6, 30);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 0));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 0));
rect = Rect.new(0, y_offset, self.contents.width, self.contents.height - 192);
rect2 = Rect.new(1, y_offset + 1, self.contents.width - 2, self.contents.height - 194);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
return
else
bitmap = RPG::Cache.battler(@enemy.battler_name, enemy.battler_hue);
src_rect = Rect.new(0, 0, bitmap.width/4, bitmap.height/4);
x = 230;
self.contents.blt(x, 0, bitmap, src_rect);
rect = Rect.new(0, 0, third_width+8, 32);
rect2 = Rect.new(1, 1, third_width+6, 30);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 0));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 0));
rect = Rect.new(0, y_offset, self.contents.width, self.contents.height - 192);
rect2 = Rect.new(1, y_offset + 1, self.contents.width - 2, self.contents.height - 194);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
end
self.contents.draw_text_shadow(4, 0, 200, 32, @enemy.name, 1);
self.contents.draw_text_shadow(4, y_offset, third_width, 32,
"#{$data_system.words.hp}: #{@enemy.maxhp}", 0);
self.contents.draw_text_shadow(third_width, y_offset, third_width, 32,
"#{$data_system.words.sp}: #{@enemy.maxsp}", 0);
self.contents.draw_text_shadow(4, y_offset + 32, third_width, 32,
"#{$data_system.words.str}: #{@enemy.str}", 0);
self.contents.draw_text_shadow(4, y_offset + 64, third_width, 32,
"#{$data_system.words.dex}: #{@enemy.dex}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 32, third_width, 32,
"#{$data_system.words.agi}: #{@enemy.agi}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 64, third_width, 32,
"#{$data_system.words.int}: #{@enemy.int}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 32, third_width, 32,
"EXP: #{@enemy.exp}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 64, third_width, 32,
"#{$data_system.words.gold}: #{@enemy.gold}", 0);
self.contents.draw_text_shadow(4, y_offset + 128, third_width, 32,
"#{$data_system.words.atk}: #{@enemy.atk}", 0);
self.contents.draw_text_shadow(4, y_offset + 160, third_width, 32,
"Evasion: #{@enemy.eva}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 128, third_width, 32,
"#{$data_system.words.pdef}: #{@enemy.pdef}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 160, third_width, 32,
"#{$data_system.words.mdef}: #{@enemy.mdef}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 128, third_width, 32,
"Item Dropped:", 0);
if @enemy.item_id > 0
item_name = $data_items[@enemy.item_id].name;
elsif @enemy.weapon_id > 0
item_name = $data_weapons[@enemy.weapon_id].name;
elsif @enemy.armor_id > 0
item_name = $data_armors[@enemy.armor_id].name;
else
item_name = 'No Treasure';
end
self.contents.draw_text_shadow(third_width*2, y_offset + 160, third_width, 32,
"#{item_name}", 0);
end
end
class Scene_Beastiary
def main
@help_window = PXMod::Window_Help.new;
@help_window.set_text("Press Cancel to return to the Menu.", 1)
@beast_list = PXMod::Window_BeastList.new;
@beast_info = PXMod::Window_BeastInfo.new;
@beast_info.refresh(@beast_list.enemy);
Graphics.transition;
loop do
Graphics.update;
Input.update;
update;
if $scene != self
break;
end
end
Graphics.freeze;
@help_window.dispose;
@beast_list.dispose;
@beast_info.dispose;
end
def update
@help_window.update;
@beast_list.update;
@beast_info.refresh(@beast_list.enemy);
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(9)
return
end
end
end
end