Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: TrueCynder on February 20, 2014, 05:28:25 pm

Title: [solved] Costum Bestiary PLZ
Post by: TrueCynder on February 20, 2014, 05:28:25 pm
Hey everyone

Please help me out with this
I´ve been looking for a simple Bestiary  for so long now
but i can´t find any for XP

Could one of you mkae me a costum one please ?
Maybe similiar to this one http://rmrk.net/index.php/topic,34404.0.html
or is it possible to convert the VX one into a XP version  ?

Pleeeaaaaase it´s important
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: KK20 on February 20, 2014, 05:55:09 pm
Quote from: TrueCynder on February 20, 2014, 05:28:25 pm
I´ve been looking for a simple Bestiary  for so long now
but i can´t find any for XP

Seriously?: ShowHide
(http://i.imgur.com/Mel8Sov.png)

What terms were you using to search for one? O_o
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: TrueCynder on February 20, 2014, 06:17:04 pm
Quote from: TrueCynder on February 20, 2014, 05:28:25 pm
Hey everyone

Please help me out with this
I´ve been looking for a simple Bestiary for so long now
but i can´t find any for XP


I´m looking for a simple one the ACE one is to compley and the other one is well ...
gross ... (sorry)
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: WhiteRose on February 21, 2014, 08:06:54 pm
I've used Blizz's Bestiary script before, and I thought it worked great! What is it that you don't like about it? Maybe someone could make an edit of it that would be more to your liking.
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: Zexion on February 22, 2014, 06:04:04 pm
^
What she said :P

I'm actually thinking of modding Blizz's script for use in my journal menu haha, so I miiiight be willing to help if I can.
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: Jackolas on February 24, 2014, 08:45:16 am
something like this:



edit:
new script posted in new a reply
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: G_G on February 24, 2014, 08:50:11 am
HOLY SHIT HE RISES FROM THE DEAD
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: Jackolas on February 24, 2014, 08:52:37 am
also hello to you :P
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: TrueCynder on March 03, 2014, 02:16:50 am
sorry for the late reply

but a big thank you for the script
i do get a error tho
in Game_Enemy

(http://i60.tinypic.com/ndakol.png)

it appears as soon as an enemy should have been registered
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: KK20 on March 03, 2014, 02:25:33 am
No idea why the super is calling these int values.

class Game_Enemy_Book < Game_Enemy
#--------------------------------------------------------------------------
    def initialize(enemy_id)
        super(2, 1)

The two should be the troop index number while the one should be the enemy's position in the troop. Then again, I don't know why extending Game_Enemy is a good idea. I'd just make Game_Enemy_Book its own class. Actually, why not just use the RPG::Enemy instance instead?
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: Jackolas on March 03, 2014, 06:39:32 am
the reason for using the Game_Enemy is that i build this script originally for own use.
I have an other script that adds gradient bars to stats etc. so when using the Game_Enemy i get those bars also on the stat page.
it should work fine on a normal game but i guess that your Game_Enemy  is heavily edited for a custom battle system.

(http://i102.photobucket.com/albums/m99/aqua_nl/PK%20Game/SimpleBestiary_zpsabb14533.jpg)


Here is the script without using the Game_Enemy call
Also added the option for monster types and elemental resistance like the example that you linked.
You don't need to use these options. Just set it to false if you won't bother.
but if you do want to add these, make sure you have the icons.

#==============================================================================
# ¦ Simple Bestiary
#==============================================================================
# script by:            Jackolas
# Version number:       V 1.0
# Last edit date:       04-03-14
#
# Thanks:               SephirothSpawn (for Scaling script)
#==============================================================================
# Introduction:
#   This script will add a "Simple" Bestiary book to your game.
# ====================
# Compatibility:
#   Not compatible with ABS.
# ====================
# Current Features:
#   - Auto track when enemies are killed.
#   - Shows total amount of enemies discovered.
#   - Shows basic stats of enemies that you have killed.
#   - Ability to show enemy type on stat page.
#   - Ability to show the elemental resistance of the monsters.
#   - Plug and play.
# ====================
# Instructions:
#   Place the script above Main and below the default scripts.
#   Edit the Configuration to your liking.
#   Call from an event or script with: $scene = Scene_MonsterBook.new
#   Play the game
# ====================
# Notes:
#   - Do not edit anything else than the configuration.
#   - If custom combat system loaded. Place this script below the combat script.
#   - If you find any bugs, please report them here:
#     http://forum.chaos-project.com
#==============================================================================

module Enemy_Book_Config
#=============Main Config=====================
   DeBug_Mode = false            # Show all enemies on start.
   EVA_NAME = "Evasion"         # The name you want to use for evasion.
   Return_to_menu = false       # Return to menu if exit.
   Menu_Number = 0              # Set marker to what menu position.
   Use_monster_type = false      # If you want to use monster types or not. (config below)
   Use_monster_Elements = false  # If you want to display the elements or not. (config below)
   
#=========Monster Type Config=================
   # If you are going to use monster types you will need an icon for every type.
   # The type icons need to be 24x24 and placed in the folder selected below.
   # The monster type icon will replace the Monster ID number in the list.
   
   # Below is the array of all the monster types. You can add or remove as
   # many as you like.
   All_Monster_types = ["Human", "Beast", "Undead", "Animate", "Elemental", "Demon"]
   # Here you need to setup all the monsters and what type they are
   Monster_Type = {
   # use X => Y, Where X is the monster ID and the Y is the type defined
   # in the array above.
       1 => 3, # Monster ID 1 has the type Undead.
       2 => 2, # Monster ID 2 has the type Beast.
       3 => 5, # Monster ID 3 has the type Elemental.
       4 => 6, # Monster ID 4 has the type Demon.
       #etc
   }
   # This is the default monster type if a monster has no type added to it.
   # Remember to also make an icon for this type.
   Default_Monster_type = "Unknown"
   # This is the sub-folder in the icon folder where the script can find all
   # the monster icons. The icons must have the same name as the type.
   # (An "undead" type needs to have an icon called "undead" in this folder.)
   Monster_IconType_Loc = "Bestiary"

#============== Element Config================
   # If you are going to use elements you will need an icon for every type.
   # The type icons need to be 24x24 and placed in the folder selected below.

Element_Ranks = ["A", "B", "C", "D", "E", "F"] # The 6 elemental ranks. 3th one is the neutral.
Elements = [1, 2, 3, 4, 5, 6, 7, 8] # What elements to display.
   # This is the sub-folder in the icon folder where the script can find all
   # the element icons. The icons must have the same name as the element.
   # (A "Fire" element needs to have an icon called "Fire" in this folder.)
Element_IconType_Loc = "Bestiary"

#=============================================
end

class Game_Temp
   attr_accessor :enemy_book_data
   alias temp_enemy_book_data_initialize initialize
   def initialize
       temp_enemy_book_data_initialize
       @enemy_book_data = Data_MonsterBook.new
   end
end

class Bitmap
   def scale_blt(dest_rect, src_bitmap, src_rect, opacity = 255)
       w, h = src_rect.width, src_rect.height
       scale = [w / dest_rect.width.to_f, h / dest_rect.height.to_f].max
       ow, oh = (w / scale).to_i, (h / scale).to_i
       ox, oy = (dest_rect.width - ow) / 2, (dest_rect.height - oh) / 2
       stretch_blt(Rect.new(ox + dest_rect.x, oy + dest_rect.y, ow, oh),
       src_bitmap, src_rect )
   end
end

class Game_Party
   attr_accessor :enemy_info          
#--------------------------------------------------------------------------
   alias book_info_initialize initialize
   def initialize
       book_info_initialize
       @enemy_info = {}
   end
#--------------------------------------------------------------------------
   def add_enemy_info(enemy_id, type = 0)
       case type
           when 0
           if @enemy_info[enemy_id] == 2
               return false
           end
           @enemy_info[enemy_id] = 1
           when 1
               @enemy_info[enemy_id] = 2
           when -1
           @enemy_info[enemy_id] = 0
       end
   end
#--------------------------------------------------------------------------
   def enemy_book_max
       return $game_temp.enemy_book_data.id_data.size - 1
   end
#--------------------------------------------------------------------------
   def enemy_book_now
       now_enemy_info = @enemy_info.keys
       no_add = $game_temp.enemy_book_data.no_add_element
       new_enemy_info = []
       for i in now_enemy_info
           enemy = $data_enemies[i]
           next if enemy.name == ""
           if enemy.element_ranks[no_add] == 1
               next
           end
           new_enemy_info.push(enemy.id)
       end
       return new_enemy_info.size
   end
#--------------------------------------------------------------------------
   def enemy_book_complete_percentage
       e_max = enemy_book_max.to_f
       e_now = enemy_book_now.to_f
       comp = e_now / e_max * 100
       return comp.truncate
   end
end

class Interpreter
   def enemy_book_max
       return $game_party.enemy_book_max
   end
   def enemy_book_now
       return $game_party.enemy_book_now
   end
   def enemy_book_comp
       return $game_party.enemy_book_complete_percentage
   end
end

class Scene_Battle
   alias add_enemy_info_start_phase5 start_phase5
   def start_phase5
       for enemy in $game_troop.enemies
           unless enemy.hidden
               $game_party.add_enemy_info(enemy.id, 0)
           end
       end
       add_enemy_info_start_phase5
   end
end

class Window_Base < Window
#--------------------------------------------------------------------------
   def draw_enemy_book_id(enemy, x, y)
       self.contents.font.color = normal_color
       id = $game_temp.enemy_book_data.id_data.index(enemy.id)
       self.contents.draw_text(x, y, 32, 32, id.to_s, 2)
   end
#--------------------------------------------------------------------------
   def draw_enemy_name(enemy, x, y)
       self.contents.font.color = normal_color
       self.contents.draw_text(x, y, 152, 32, enemy.name)
   end
#--------------------------------------------------------------------------
   def draw_enemy_graphic(enemy, x, y, opacity = 255)
       #bitmap = RPG::Cache.character(enemy.battler_name, enemy.battler_hue)
       bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
       cw = bitmap.width
       ch = bitmap.height
       if ch >= 190
           x = x - 230
           y = y - 90
           self.contents.scale_blt(Rect.new(x, y, 420, 220), bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
       else
           x = x - (cw / 2) - 20
           y = y - (ch / 2)
           src_rect = Rect.new(0, 0, cw, ch)
           self.contents.blt(x, y, bitmap, src_rect, opacity)
       end
   end
#--------------------------------------------------------------------------
   def draw_monster_book_type_icon(id, x, y)
       if Enemy_Book_Config::Monster_Type[id] == nil
           monstype = Enemy_Book_Config::Default_Monster_type
       else
           cid = Enemy_Book_Config::Monster_Type[id] - 1
           monstype = Enemy_Book_Config::All_Monster_types[cid]
       end
       iconloc = Enemy_Book_Config::Monster_IconType_Loc
       self.contents.blt(x, y + 4, RPG::Cache.icon("#{iconloc}/#{monstype}"), Rect.new(0, 0, 24, 24))
   end
#--------------------------------------------------------------------------
   def draw_monster_book_type_name(id, x, y)
       if Enemy_Book_Config::Monster_Type[id] == nil
           monstype = Enemy_Book_Config::Default_Monster_type
       else
           cid = Enemy_Book_Config::Monster_Type[id] - 1
           monstype = Enemy_Book_Config::All_Monster_types[cid]
       end
       self.contents.draw_text(x, y, 120, 32, monstype)
   end
#--------------------------------------------------------------------------
   def draw_monster_book_Elements(id, x, y)
       self.contents.font.bold = true
       self.contents.font.size = 22
       iconloc = Enemy_Book_Config::Element_IconType_Loc
       elsize = Enemy_Book_Config::Elements.size + 1
       locat = 1
       for i in 1...elsize
           elemid = Enemy_Book_Config::Elements[i-1]
           next if $data_enemies[id].element_ranks[elemid] == 3
           difelem = $data_enemies[id].element_ranks[elemid]
           rank = Enemy_Book_Config::Element_Ranks[difelem - 1]
           elemicon = $data_system.elements[elemid]
           self.contents.blt(x - (24 * locat), y, RPG::Cache.icon("#{iconloc}/#{elemicon}"), Rect.new(0, 0, 24, 24))
           contents.draw_text(x - (24 * locat), y, 24, 24, rank, 1)
           locat = locat + 1
       end
       self.contents.font.bold = false
   end
end

class Data_MonsterBook
   attr_reader :id_data
#--------------------------------------------------------------------------
   def initialize
       @id_data = enemy_book_id_set
   end
#--------------------------------------------------------------------------
   def no_add_element
       no_add = 0
       for i in 1...$data_system.elements.size
           if $data_system.elements[i] =~ /unknown/
               no_add = i
               break
           end
       end
       return no_add
   end
#--------------------------------------------------------------------------
   def enemy_book_id_set
       data = [0]
       no_add = no_add_element
       for i in 1...$data_enemies.size
           enemy = $data_enemies[i]
           next if enemy.name == ""
           if enemy.element_ranks[no_add] == 1
               next
           end
           data.push(enemy.id)
       end
       return data
   end
end


class Window_MonsterBook < Window_Selectable
   attr_reader   :data
#--------------------------------------------------------------------------
   def initialize(index=0)
       super(0, 64, 220, 416)
       @column_max = 1
       @book_data = $game_temp.enemy_book_data
       @data = @book_data.id_data.dup
       @data.shift
       @item_max = @data.size
       self.index = 0
       refresh if @item_max > 0
   end
#--------------------------------------------------------------------------
   def data_set
       data = $game_party.enemy_info.keys
       data.sort!
       newdata = []
       for i in data
           next if $game_party.enemy_info[i] == 0
           if book_id(i) != nil
               newdata.push(i)
           end
       end
       return newdata
   end
#--------------------------------------------------------------------------
   def show?(id)
       if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
           return false
       else
           return true
       end
   end
#--------------------------------------------------------------------------
   def book_id(id)
       return @book_data.index(id)
   end
#--------------------------------------------------------------------------
   def item
       return @data[self.index]
   end
#--------------------------------------------------------------------------
   def refresh
       if self.contents != nil
           self.contents.dispose
           self.contents = nil
       end
       self.contents = Bitmap.new(width - 32, row_max * 32)
       if @item_max > 0
           for i in 0...@item_max
               draw_item(i)
           end
       end
   end
   
#--------------------------------------------------------------------------
   def draw_item(index)
       enemy = $data_enemies[@data[index]]
       return if enemy == nil
       x = 4
       y = index * 32
       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
       self.contents.font.color = normal_color
       if Enemy_Book_Config::DeBug_Mode == true
           if Enemy_Book_Config::Use_monster_type == true
               draw_monster_book_type_icon(enemy.id, x, y)
               self.contents.draw_text(x + 28+4, y, 212, 32, enemy.name, 0)
           else
               draw_enemy_book_id(enemy, x, y)
               self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
           end
       else
           if show?(enemy.id)
               if Enemy_Book_Config::Use_monster_type == true
                   draw_monster_book_type_icon(enemy.id, x, y)
                   self.contents.draw_text(x + 28+4, y, 212, 32, enemy.name, 0)
               else
                   draw_enemy_book_id(enemy, x, y)
                   self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
               end
           else
               if Enemy_Book_Config::Use_monster_type == true
                   self.contents.draw_text(x, y, 32, 32, "??", 0)
                   self.contents.draw_text(x + 28+4, y, 212, 32, "?????", 0)
               else
                   draw_enemy_book_id(enemy, x, y)
                   self.contents.draw_text(x + 28+16, y, 212, 32, "?????", 0)
               end
           end
       end
       if analyze?(@data[index])
           self.contents.font.color = text_color(3)
           self.contents.draw_text(x + 256, y, 24, 32, " ", 2)
       end
   end
#--------------------------------------------------------------------------
   def analyze?(enemy_id)
       if $game_party.enemy_info[enemy_id] == 2
           return true
       else
           return false
       end
   end
end


class Window_MonsterBook_Info < Window_Base
   include Enemy_Book_Config
#--------------------------------------------------------------------------
   def initialize
       super(220, 0+64, 420, 480-64)
       self.contents = Bitmap.new(width - 32, height - 32)
   end
#--------------------------------------------------------------------------
   def refresh(enemy_id)
       self.contents.clear
       self.contents.font.size = 28
       enemy = $data_enemies[enemy_id]
       #Draw name and battler
       draw_enemy_graphic(enemy, 210, 100)
       draw_enemy_name(enemy, 0, 0)
       if Enemy_Book_Config::Use_monster_type == true
           self.contents.font.size = 22
           draw_monster_book_type_icon(enemy_id, 0, 28)
           draw_monster_book_type_name(enemy_id, 26, 28)
       end
       if Enemy_Book_Config::Use_monster_Elements == true
           draw_monster_book_Elements(enemy_id, 420-32, 0)
       end
       self.contents.font.size = 22
       #Draw HP and SP
       self.contents.font.color = system_color
       self.contents.draw_text(10, 220, 128, 32, $data_system.words.hp)
       self.contents.draw_text(210, 220, 128, 32, $data_system.words.sp)
       self.contents.font.color = normal_color
       self.contents.draw_text(10 + 90, 220, 64, 32, enemy.maxhp.to_s, 2)
       self.contents.draw_text(210 + 90, 220, 64, 32, enemy.maxsp.to_s, 2)
       #Draw Attak and Evasion
       self.contents.font.color = system_color
       self.contents.draw_text(10, 252, 128, 32, $data_system.words.atk)
       self.contents.draw_text(210, 252, 128, 32, EVA_NAME)
       self.contents.font.color = normal_color
       self.contents.draw_text(10 + 90, 252, 64, 32, enemy.atk.to_s, 2)
       self.contents.draw_text(210 + 90, 252, 64, 32, enemy.eva.to_s, 2)
       #Draw Base Stats
       self.contents.font.color = system_color
       self.contents.draw_text(10, 284, 128, 32, $data_system.words.str)
       self.contents.draw_text(210, 284, 128, 32, $data_system.words.dex)
       self.contents.draw_text(10, 316, 128, 32, $data_system.words.agi)
       self.contents.draw_text(210, 316, 128, 32, $data_system.words.int)
       self.contents.font.color = normal_color
       self.contents.draw_text(10 + 90, 284, 64, 32, enemy.str.to_s, 2)
       self.contents.draw_text(210 + 90, 284, 64, 32, enemy.dex.to_s, 2)
       self.contents.draw_text(10 + 90, 316, 64, 32, enemy.agi.to_s, 2)
       self.contents.draw_text(210 + 90, 316, 64, 32, enemy.int.to_s, 2)
       #Draw Defences
       self.contents.font.color = system_color
       self.contents.draw_text(10, 348, 128, 32, $data_system.words.pdef)
       self.contents.draw_text(210, 348, 128, 32, $data_system.words.mdef)
       self.contents.font.color = normal_color
       self.contents.draw_text(10 + 90, 348, 64, 32, enemy.pdef.to_s, 2)
       self.contents.draw_text(210 + 90, 348, 64, 32, enemy.mdef.to_s, 2)
   end
#--------------------------------------------------------------------------
   def analyze?(enemy_id)
       if $game_party.enemy_info[enemy_id] == 2
           return true
       else
           return false
       end
   end
end


class Scene_MonsterBook
   include Enemy_Book_Config
#--------------------------------------------------------------------------
   def main
       $game_temp.enemy_book_data = Data_MonsterBook.new
       @title_window = Window_Base.new(0, 0, 640, 64)
       @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
       @title_window.contents.draw_text(4, 0, 320, 32, "Monster Book", 0)
       e_now = $game_party.enemy_book_now
       e_max = $game_party.enemy_book_max
       comp = $game_party.enemy_book_complete_percentage
       text = "Monsters Found: " + e_now.to_s + "/" + e_max.to_s
       text2 = comp.to_s + "%" + " Of Total"
       if text != nil
           @title_window.contents.draw_text(100, 0, 288, 32,  text, 2)
           @title_window.contents.draw_text(320, 0, 288, 32,  text2, 2)
       end
       @main_window = Window_MonsterBook.new
       @main_window.active = true
       @info_window = Window_MonsterBook_Info.new
       @info_window.z = 110
       @info_window.visible = true
       @visible_index = 0
       Graphics.transition
       loop do
           Graphics.update
           Input.update
           update
           if $scene != self
               break
           end
       end
       Graphics.freeze
       @main_window.dispose
       @info_window.dispose
       @title_window.dispose
   end
#--------------------------------------------------------------------------
   def update
       @main_window.update
       @info_window.update
       update_main
       if Enemy_Book_Config::DeBug_Mode == true
           @visible_index = @main_window.index
           @info_window.refresh(@main_window.item)
       else
           if @main_window.item == nil or @main_window.show?(@main_window.item) == false
               @info_window.contents.clear
           else
               @visible_index = @main_window.index
               @info_window.refresh(@main_window.item)
           end
       end
   end
#--------------------------------------------------------------------------
   def update_main
       if Input.trigger?(Input::B)
           if Enemy_Book_Config::Return_to_menu == false
               $game_system.se_play($data_system.cancel_se)
               $scene = Scene_Map.new
           else
               $game_system.se_play($data_system.cancel_se)
               $scene = Scene_Menu.new(Enemy_Book_Config::Menu_Number)
           end
           return
       end
   end
end
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: TrueCynder on May 04, 2014, 12:18:28 pm
Sorry for the late reply :shy: Thank you so much for the script Jackolas i just got
one question is it somehow possible to display how much money
the enemies would drop too ? That is realy inportant.

Also it seems kinda laggy to me.

Thanks ~
Title: Re: [unsolved] Costum Bestiary PLZ
Post by: KK20 on May 04, 2014, 09:53:40 pm
The lag is most likely from the Scene calling refresh on the info window every frame. Drawing graphics every single frame is a huge no-no. There should be a check for when the player presses up or down in order to call refresh.

enemy.gold.to_s

returns the string format of the enemy's gold (assuming 'enemy' is an RPG::Enemy object). If you look at class Window_MonsterBook_Info and under the refresh method, you should be able to understand how to use it.