Jump to content
Sign in to follow this  
liliford

MONSTER BOOK (v1.4) problem

Recommended Posts

I am using Monster Book from atelier rgss and i have a problem it cuts from half the EXP and Gold that you receive when you check the stats of the enemies.

 

Script:

 

#==============================================================================
# +++ MOG - MONSTER BOOK (v1.4) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema que permite verificar os parâmetros dos inimigos derrotados,
# o que inclui o battleback e a música de batalha.
#
#==============================================================================
# Para chamar o script use o comando abaixo.
#
# SceneManager.call(Monster_Book)
#
#==============================================================================

#==============================================================================
# ◠Histórico (Version History)
#==============================================================================
# v 1.4 - Correção do Crash quando não há definição de música de batalha.
# v 1.3 - Correção do Crash aleatório.
# v 1.2 - Melhoria no sistema de dispose.
# v 1.1 - Correção na atualização do battleback em imagens repetidas.
# - Correção na execução da música quando o pitch ou volume é diferente.
# - Correção no espaço entre os números de parametros.
#==============================================================================

module MOG_MONSTER_BOOK
#Ocultar inimigos especificos da lista de inimigos.
HIDE_ENEMIES_ID = [9,10]
#Ativar a música de batalha.
PLAY_MUSIC = true
#Definição da palavra Completado.
COMPLETED_WORD = "Completed"
#Ativar o Monster Book no Menu.
MENU_COMMAND = true
#Nome do comando apresentado no menu.
MENU_COMMAND_NAME = "Bestiary"
end

#==============================================================================
# â–  Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :bestiary_battleback1_name
attr_accessor :bestiary_battleback2_name

#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
alias mog_bestiary_initialize initialize
def initialize
@bestiary_battleback1_name = ""
@bestiary_battleback1_name = ""
mog_bestiary_initialize
end
end

#==============================================================================
# â–  Game_System
#==============================================================================
class Game_System

attr_accessor :bestiary_defeated
attr_accessor :bestiary_battleback
attr_accessor :bestiary_music

#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
alias mog_monster_book_initialize initialize
def initialize
@bestiary_defeated = []
@bestiary_battleback = []
@bestiary_music = []
mog_monster_book_initialize
end

end

#==============================================================================
# â–  Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
alias mog_bestiary_initialize initialize
def initialize
mog_bestiary_initialize
$game_temp.bestiary_battleback1_name = battleback1_name
$game_temp.bestiary_battleback2_name = battleback2_name
end

end

#==============================================================================
# â–  Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
attr_accessor :enemy_id

#--------------------------------------------------------------------------
# â— Die
#--------------------------------------------------------------------------
alias mog_monster_book_die die
def die
mog_monster_book_die
check_monster_book
end

#--------------------------------------------------------------------------
# â— Check Monster Book
#--------------------------------------------------------------------------
def check_monster_book
if $game_system.bestiary_defeated[@enemy_id] == nil
$game_system.bestiary_defeated[@enemy_id] = 0
$game_system.bestiary_battleback[@enemy_id] = [$game_temp.bestiary_battleback1_name,$game_temp.bestiary_battleback2_name]
$game_system.bestiary_music[@enemy_id] = $game_system.battle_bgm
end
$game_system.bestiary_defeated[@enemy_id] += 1
end
end

#==============================================================================
# â–  Window_Monster_Status
#==============================================================================

class Window_Monster_Status < Window_Selectable
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize(enemy)
super(0, 288, 544, 128)
self.opacity = 255
self.z = 300
refresh(enemy)
activate
end

#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(enemy)
self.contents.clear
if $game_system.bestiary_defeated[enemy.id] == nil
self.contents.draw_text(0,0 , 180, 24, "No Data",0)
else
change_color(system_color)
w_max = 50
ex = 16
self.contents.draw_text(0,0 , w_max, 24, Vocab::param(0),0)
self.contents.draw_text(0,24 * 1 , w_max, 24, Vocab::param(1),0)
self.contents.draw_text(0,24 * 2 , w_max, 24, Vocab::param(2),0)
self.contents.draw_text(0,24 * 3 , w_max, 24, Vocab::param(3),0)
self.contents.draw_text(128,24 * 0 , w_max, 24, Vocab::param(4),0)
self.contents.draw_text(128,24 * 1 , w_max, 24, Vocab::param(5),0)
self.contents.draw_text(128,24 * 2 , w_max, 24, Vocab::param(6),0)
self.contents.draw_text(128,24 * 3 , w_max, 24, Vocab::param(7),0)
self.contents.draw_text(256,24 * 0 , w_max, 24, "Exp",0)
self.contents.draw_text(384,24 * 0 , w_max, 24, Vocab::currency_unit,0)
self.contents.draw_text(256,24 * 1 , w_max, 24, "Treasure",0)
change_color(normal_color,true)
w_max2 = 64
#HP
self.contents.draw_text(32 + ex,0 , w_max2, 24, enemy.params[0],2)
#MP
self.contents.draw_text(32 + ex,24 * 1 , w_max2, 24, enemy.params[1],2)
#ATK
self.contents.draw_text(32 + ex,24 * 2 ,w_max2 , 24, enemy.params[2],2)
#Def
self.contents.draw_text(32 + ex,24 * 3 , w_max2, 24, enemy.params[3],2)
#Mag Power
self.contents.draw_text(160 + ex,24 * 0 , w_max2, 24, enemy.params[4],2)
#Mag Def
self.contents.draw_text(160 + ex,24 * 1 , w_max2, 24, enemy.params[5],2)
#Agility
self.contents.draw_text(160 + ex,24 * 2 , w_max2, 24, enemy.params[6],2)
#Luck
self.contents.draw_text(160 + ex,24 * 3 , w_max2, 24, enemy.params[7],2)
#EXP
self.contents.draw_text(280,24 * 0 , 96, 24, enemy.exp,2)
#Gold
self.contents.draw_text(400,24 * 0 , 96, 24, enemy.gold,2)
#Drop Items
tr = 0
for i in enemy.drop_items
next if i.kind == 0
tr += 1
tr_name = $data_items[i.data_id] if i.kind == 1
tr_name = $data_weapons[i.data_id] if i.kind == 2
tr_name = $data_armors [i.data_id] if i.kind == 3
draw_icon(tr_name.icon_index, 336, 24 * tr)
self.contents.draw_text(368,24 * tr , 160, 24, tr_name.name.to_s,0)
end
end
end
end

#==============================================================================
# â–  Window_Monster_List
#==============================================================================
class Window_Monster_List < Window_Selectable

#------------------------------------------------------------------------------
# â— Initialize
#------------------------------------------------------------------------------
def initialize(data)
super(312, 64, 232, 224)
self.opacity = 255
self.z = 301
@index = -1
@data = data
@item_max = @data.size
refresh(data)
select(0)
activate
end

#------------------------------------------------------------------------------
# â— Refresh
#------------------------------------------------------------------------------
def refresh(data)
self.contents.clear
if @item_max > 0
self.contents = Bitmap.new(width - 32, @item_max * 24)
for i in 0...@item_max
draw_item(i)
end
end
end

#------------------------------------------------------------------------------
# â— draw_item MAX
#------------------------------------------------------------------------------
def check_item_max
@data_max = 0
for i in $data_enemies
next if i == nil or MOG_MONSTER_BOOK::HIDE_ENEMIES_ID.include?(i.id)
@data_max += 1
end
end

#------------------------------------------------------------------------------
# â— draw_item
#------------------------------------------------------------------------------
def draw_item(index)
x = 0
y = index / col_max * 24
n_index = index + 1
if $game_system.bestiary_defeated[@data[index].id] == nil
monster_name = "No Data"
defeated = " ---- "
change_color(normal_color,false)
else
monster_name = @data[index].name
change_color(normal_color,true)
end
check_item_max
d = @data_max > 99 ? "%03d" : @data_max > 9 ? "%02d" : "%01d"
text = sprintf(d, n_index).to_s + " - "
self.contents.draw_text(x,y , 56, 24, text,0)
self.contents.draw_text(x + 56,y , 140, 24, monster_name,0)
end

#------------------------------------------------------------------------------
# â— Item Max
#------------------------------------------------------------------------------
def item_max
return @item_max == nil ? 0 : @item_max
end

end

#==============================================================================
# â–  Window_Monster_Comp
#==============================================================================
class Window_Monster_Comp < Window_Selectable
include MOG_MONSTER_BOOK

#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
super(312,0, 232, 64)
self.opacity = 255
self.z = 300
refresh
activate
end

#--------------------------------------------------------------------------
# â— Check Completition
#--------------------------------------------------------------------------
def check_completion
data_max = 0
for i in $data_enemies
next if i == nil or MOG_MONSTER_BOOK::HIDE_ENEMIES_ID.include?(i.id)
data_max += 1
end
comp = 0
for i in 0...$game_system.bestiary_defeated.size
comp += 1 if $game_system.bestiary_defeated != nil
end
@completed = COMPLETED_WORD + " " + comp.to_s + "/" + data_max.to_s
end

#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
check_completion
self.contents.draw_text(0,0, 160, 24, @completed.to_s,0)
end
end

#==============================================================================
# â–  Monster_Book
#==============================================================================
class Monster_Book

#--------------------------------------------------------------------------
# â— Main
#--------------------------------------------------------------------------
def main
Graphics.transition
execute_loop
execute_dispose
end

#--------------------------------------------------------------------------
# â— Execute Loop
#--------------------------------------------------------------------------
def execute_loop
loop do
Graphics.update
Input.update
update
break if SceneManager.scene != self
end
end

#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
load_data
execute_dispose
create_window_guide
create_enemy_sprite
create_battleback
@music = [nil,nil,nil]
refresh_bgm
end

#------------------------------------------------------------------------------
# â— Initialize
#------------------------------------------------------------------------------
def load_data
BattleManager.save_bgm_and_bgs
@data = []
for i in $data_enemies
next if i == nil or MOG_MONSTER_BOOK::HIDE_ENEMIES_ID.include?(i.id)
@data.push(i)
end
end

#--------------------------------------------------------------------------
# â— Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
return if @windows_guide == nil
Graphics.freeze
@windows_guide.dispose
@windows_guide = nil
@windows_status.dispose
if @enemy_sprite.bitmap != nil
@enemy_sprite.bitmap.dispose
end
@enemy_sprite.dispose
dispose_battleback
@battleback1.dispose
@battleback2.dispose
@window_comp.dispose
BattleManager.replay_bgm_and_bgs
end

#--------------------------------------------------------------------------
# â— Dispose_battleback
#--------------------------------------------------------------------------
def dispose_battleback
if @battleback1.bitmap != nil
@battleback1.bitmap.dispose
@battleback1.bitmap = nil
end
if @battleback2.bitmap != nil
@battleback2.bitmap.dispose
@battleback2.bitmap = nil
end
end

#--------------------------------------------------------------------------
# â— Create Window Guide
#--------------------------------------------------------------------------
def create_window_guide
@windows_guide = Window_Monster_List.new(@data)
@enemy = @data[@windows_guide.index]
@windows_status = Window_Monster_Status.new(@enemy)
@window_comp = Window_Monster_Comp.new
@old_index = @windows_guide.index
@org_pos = [@windows_guide.x,@windows_guide.y]
@fade_time = 60
end

#--------------------------------------------------------------------------
# â— Create Enemy Sprite
#--------------------------------------------------------------------------
def create_enemy_sprite
@enemy_sprite = Sprite.new
@enemy_sprite.z = 100
@enemy_sprite_org = @enemy_sprite.x
refresh_enemy_sprite
end

#--------------------------------------------------------------------------
# â— Create_Battleback
#--------------------------------------------------------------------------
def create_battleback
@battleback1 = Sprite.new
@battleback1.z = 1
@battleback1.opacity = 0
@battleback2 = Sprite.new
@battleback2.z = 2
@battleback2.opacity = 0
@old_battleback = [nil,nil]
refresh_batteback
end

#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
@windows_guide.update
update_command
update_animation
refresh if @old_index != @windows_guide.index
end

#--------------------------------------------------------------------------
# â— Update Animation
#--------------------------------------------------------------------------
def update_animation
update_window_fade_animation
update_battleback_animation
update_enemy_sprite_animation
end

#--------------------------------------------------------------------------
# â— Update Enemy Sprite Animation
#--------------------------------------------------------------------------
def update_enemy_sprite_animation
@enemy_sprite.opacity += 15
if @enemy_sprite.x < @enemy_sprite_org
@enemy_sprite.x += 15
if @enemy_sprite.x >= @enemy_sprite_org
@enemy_sprite.x = @enemy_sprite_org
end
end
end

#--------------------------------------------------------------------------
# â— Update Window Fade Animation
#--------------------------------------------------------------------------
def update_window_fade_animation
if @windows_guide.visible
@windows_guide.opacity += 15
@windows_guide.contents_opacity += 15
if @windows_guide.y > @org_pos[1]
@windows_guide.y -= 25
if @windows_guide.y < @org_pos[1]
@windows_guide.y = @org_pos[1]
@windows_guide.opacity += 255
@windows_guide.contents_opacity = 255
end
end
else
@windows_guide.opacity -= 15
@windows_guide.contents_opacity -= 15
if @windows_guide.y < (@windows_guide.height + 416)
@windows_guide.y += 25
@windows_guide.y = (@windows_guide.height + 416) if @windows_guide.y > (@windows_guide.height + 416)
end
end
end

#--------------------------------------------------------------------------
# â— Update Battleback Animation
#--------------------------------------------------------------------------
def update_battleback_animation
if @old_battleback == nil
@battleback1.opacity -= 10
@battleback2.opacity -= 10
else
@battleback1.opacity += 10
@battleback2.opacity += 10
end
end

#--------------------------------------------------------------------------
# â— Update Command
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input:: B) or Input.press?(Input:: B)
Sound.play_cancel
SceneManager.return
elsif Input.trigger?(Input::C)
Sound.play_ok
return
if @windows_guide.visible
@windows_guide.visible = false
else
@windows_guide.visible = true
end
end
end

#--------------------------------------------------------------------------
# â— Refresh Animation
#--------------------------------------------------------------------------
def refresh
@old_index = @windows_guide.index
@enemy = @data[@windows_guide.index]
@windows_status.refresh(@enemy)
refresh_bgm
refresh_enemy_sprite
refresh_batteback
end

#--------------------------------------------------------------------------
# â— Refresh Animation
#--------------------------------------------------------------------------
def refresh_enemy_sprite
if @enemy_sprite.bitmap != nil
@enemy_sprite.bitmap.dispose
@enemy_sprite.bitmap = nil
end
if $game_system.bestiary_defeated[@enemy.id] != nil
@enemy_sprite.bitmap = Cache.battler(@enemy.battler_name, @enemy.battler_hue)
@enemy_sprite_org = (312/ 2) - (@enemy_sprite.bitmap.width / 2)
@enemy_sprite.x = -@enemy_sprite.bitmap.width
@enemy_sprite.y = 272 - @enemy_sprite.bitmap.height
@enemy_sprite.opacity = 0
end
end

#--------------------------------------------------------------------------
# â— BGM Refresh
#--------------------------------------------------------------------------
def refresh_bgm
return unless MOG_MONSTER_BOOK::PLAY_MUSIC
if $game_system.bestiary_music[@enemy.id] != nil and
(@music[0] != $game_system.bestiary_music[@enemy.id].name or
@music[1] != $game_system.bestiary_music[@enemy.id].volume or
@music[2] != $game_system.bestiary_music[@enemy.id].pitch)
m = $game_system.bestiary_music[@enemy.id]
@music = [m.name, m.volume, m.pitch]
RPG::BGM.stop
Audio.bgm_play("Audio/BGM/" + m.name, m.volume, m.pitch) rescue nil
end
end

#--------------------------------------------------------------------------
# â— Refresh Battleback
#--------------------------------------------------------------------------
def refresh_batteback
if $game_system.bestiary_battleback[@enemy.id] != nil and
(@old_battleback[0] != $game_system.bestiary_battleback[@enemy.id][0] or
@old_battleback[1] != $game_system.bestiary_battleback[@enemy.id][1])
@old_battleback = [$game_system.bestiary_battleback[@enemy.id][0], $game_system.bestiary_battleback[@enemy.id][1]]
dispose_battleback
@battleback1.opacity = 0
@battleback2.opacity = 0
if $game_system.bestiary_battleback[@enemy.id][0] != nil
@battleback1.bitmap = Cache.battleback1($game_system.bestiary_battleback[@enemy.id][0])
else
@battleback1.bitmap = Cache.battleback1("")
end
if $game_system.bestiary_battleback[@enemy.id][1] != nil
@battleback2.bitmap = Cache.battleback2($game_system.bestiary_battleback[@enemy.id][1])
else
@battleback2.bitmap = Cache.battleback2("")
end
end
end

end

if MOG_MONSTER_BOOK::MENU_COMMAND
#==============================================================================
# â–  Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command

#------------------------------------------------------------------------------
# â— Add Main Commands
#------------------------------------------------------------------------------
alias mog_bestiary_add_main_commands add_main_commands
def add_main_commands
mog_bestiary_add_main_commands
add_command(MOG_MONSTER_BOOK::MENU_COMMAND_NAME, :bestiary, main_commands_enabled)
end
end

#==============================================================================
# â–  Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase

#------------------------------------------------------------------------------
# â— Create Command Windows
#------------------------------------------------------------------------------
alias mog_bestiary_create_command_window create_command_window
def create_command_window
mog_bestiary_create_command_window
@command_window.set_handler(:bestiary, method(:Monster_Book))
end

#------------------------------------------------------------------------------
# â— Monster Book
#------------------------------------------------------------------------------
def Monster_Book
SceneManager.call(Monster_Book)
end

end

end

$mog_rgss3_monster_book = true

 

 

Here is a pic of what i am talking about:

 

Heritage.png

 

Exp is set up in database to be 20 and Gold 40 received.

Btw i have try it on a brand new project no script install but only this one and same problem so it is not a conflict  between scripts.

 

Thanks in advance for any help. 

 

 

Share this post


Link to post
Share on other sites
#EXP
self.contents.draw_text(280,24 * 0 , 96, 24, enemy.exp,2)
#Gold
self.contents.draw_text(400,24 * 0 , 96, 24, enemy.gold,2)

Those lines draws the enemy exp and gold.  Nothing there indicates that they should be halved, and they're not referenced anywhere else.  You could always try multiplying them by 2 and solve your problem the kludgy way.

 

Does the script require any other scripts to run, like core scripts or anything?

Share this post


Link to post
Share on other sites

There is not much instructions but i did not see anything talking about another script for running this one with.

I have also saw the lines that you refer to and did not see anything weird about it.

Share this post


Link to post
Share on other sites

I'd double check you are looking at the correct enemy in the database. And if you are sure it's not working, maybe post a demo

Share this post


Link to post
Share on other sites

Problem solved it is working fine i was not looking at right place in my main project.

It is not given troops but only 1 enemy info.

I feel stupid.

Edited by liliford

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted