WR Heart rpg
Vuoi reagire a questo messaggio? Crea un account in pochi clic o accedi per continuare.

Bestiario per VX

Andare in basso

iconvx Bestiario per VX

Messaggio Da LusianL il Gio Mag 10, 2012 1:30 pm

BESTIARIO


Descrizione
Permette di avere un bestiario come nel xp..

Autore
Dargor

Screen
Non disponibile

Script
Spoiler:

Codice:
#==============================================================================
# ** Bestiary
#------------------------------------------------------------------------------
# © Dargor, 2008
# 24/05/08
# Version 1.2
#------------------------------------------------------------------------------
# VERSION HISTORY:
# - 1.0 (21/05/08), Initial release
# - 1.1 (21/05/08), Minor bugs fixed
# - 1.2 (24/05/08), Reseted Bestiary bug fixed
#------------------------------------------------------------------------------
# INSTRUCTIONS:
# 1) Paste the script above main
# 2) Edit the Vocab variables
# 2) Edit the constants in the Bestiary module
#==============================================================================

#==============================================================================
# ** Bestiary Configuration
#==============================================================================

module Bestiary
# Enemies that won't appear in the bestiary
Excluded_Enemies = [31]
# 'Real' Elements, displayed in the bestiary
Elements = [9,10,11,12,13,14,15,16]
# 'Real' Elements Icon Index
Element_Icons = { 9 => 104,
10 => 105,
11 => 106,
12 => 107,
13 => 108,
14 => 109,
15 => 110,
16 => 111,
}
# Play a BG' in the bestiary
Play_BGM = true
# BGM List based on enemy ID
BGM = { 19 => 'Battle7',
20 => 'Battle7',
21 => 'Battle7',
22 => 'Battle7',
23 => 'Battle7',
24 => 'Battle7',
25 => 'Battle8',
26 => 'Battle8',
27 => 'Battle8',
28 => 'Battle8',
29 => 'Battle8',
30 => 'Battle9'
}
# Default BGM name
BGM.default = 'Battle1'
end

# Vocabulary
Vocab::Hit = 'Hit Rate'
Vocab::Eva = 'Evasion'
Vocab::Exp = 'EXP'
Vocab::UnknownEnemy = '??????'
Vocab::UnknownDrop = '??????'

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :new_enemy
attr_accessor :enemy_encountered
attr_accessor :enemy_defeated
attr_accessor :enemy_drops
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_bestiary_system_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@new_enemy = []
@enemy_encountered = []
@enemy_defeated = []
@enemy_drops = []
for i in 1...$data_enemies.size
@new_enemy[i] = true
@enemy_encountered[i] = 0
@enemy_defeated[i] = 0
@enemy_drops[i] = [false, false]
end
dargor_vx_bestiary_system_initialize
end
end

#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
# This class handles enemy groups and battle-related data. Also performs
# battle events. The instance of this class is referenced by $game_troop.
#==============================================================================

class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_bestiary_troop_setup setup
alias dargor_vx_bestiary_troop_make_drop_items make_drop_items
#--------------------------------------------------------------------------
# * Setup
# troop_id : troop ID
#--------------------------------------------------------------------------
def setup(troop_id)
dargor_vx_bestiary_troop_setup(troop_id)
for member in troop.members
next if $data_enemies[member.enemy_id] == nil
enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
$game_system.enemy_encountered[member.enemy_id] += 1
end
end
#--------------------------------------------------------------------------
# * Create Array of Dropped Items
#--------------------------------------------------------------------------
def make_drop_items
drop_items = []
for enemy in dead_members
for di in [enemy.drop_item1, enemy.drop_item2]
next if di.kind == 0
next if rand(di.denominator) != 0
index = [enemy.drop_item1, enemy.drop_item2].index(di)
$game_system.enemy_drops[enemy.enemy_id][index] = true
if di.kind == 1
drop_items.push($data_items[di.item_id])
elsif di.kind == 2
drop_items.push($data_weapons[di.weapon_id])
elsif di.kind == 3
drop_items.push($data_armors[di.armor_id])
end
end
end
return drop_items
end
end

#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_bestiary_enemy_perform_collapse perform_collapse
#--------------------------------------------------------------------------
# * Perform Collapse
#--------------------------------------------------------------------------
def perform_collapse
dargor_vx_bestiary_enemy_perform_collapse
if $game_temp.in_battle and dead?
$game_system.enemy_defeated[@enemy_id] += 1
end
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Get HP Text Color
# enemy : enemy
#--------------------------------------------------------------------------
def hp_color(actor)
return normal_color if actor.is_a?(RPG::Enemy)
return knockout_color if actor.hp == 0
return crisis_color if actor.hp < actor.maxhp / 4
return normal_color
end
#--------------------------------------------------------------------------
# * Draw Enemy MAXHP
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_enemy_maxhp(enemy, x, y, width = 120)
draw_enemy_hp_gauge(enemy, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp)
self.contents.font.color = hp_color(enemy)
last_font_size = self.contents.font.size
xr = x + width
self.contents.font.color = normal_color
self.contents.draw_text(xr - 80, y, 80, WLH, enemy.maxhp, 2)
end
#--------------------------------------------------------------------------
# * Draw Enemy HP gauge
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_enemy_hp_gauge(enemy, x, y, width = 120)
gw = width
gc1 = hp_gauge_color1
gc2 = hp_gauge_color2
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
#--------------------------------------------------------------------------
# * Draw Enemy MAXMP
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_enemy_maxmp(enemy, x, y, width = 120)
draw_enemy_mp_gauge(enemy, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp)
self.contents.font.color = hp_color(enemy)
last_font_size = self.contents.font.size
xr = x + width
self.contents.font.color = normal_color
self.contents.draw_text(xr - 80, y, 80, WLH, enemy.maxmp, 2)
end
#--------------------------------------------------------------------------
# * Draw Enemy MP gauge
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_enemy_mp_gauge(enemy, x, y, width = 120)
gw = width
gc1 = mp_gauge_color1
gc2 = mp_gauge_color2
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
#--------------------------------------------------------------------------
# * Draw Enemy Parameters
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : Type of parameters (0-7)
#--------------------------------------------------------------------------
def draw_enemy_parameter(enemy, x, y, type)
case type
when 0
parameter_name = Vocab::atk
parameter_value = enemy.atk
when 1
parameter_name = Vocab::def
parameter_value = enemy.def
when 2
parameter_name = Vocab::spi
parameter_value = enemy.spi
when 3
parameter_name = Vocab::agi
parameter_value = enemy.agi
when 4
parameter_name = Vocab::Hit
parameter_value = enemy.hit
when 5
parameter_name = Vocab::Eva
parameter_value = enemy.eva
when 6
parameter_name = Vocab::Exp
parameter_value = enemy.exp
when 7
parameter_name = Vocab::gold
parameter_value = enemy.gold
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, parameter_name)
self.contents.font.color = normal_color
parameter_value = "#{parameter_value}%" if [4,5].include?(type)
self.contents.draw_text(x + 100, y, 56, WLH, parameter_value, 2)
end
#--------------------------------------------------------------------------
# * Draw Enemy Drop
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_enemy_drop(enemy,x,y)
self.contents.font.color = system_color
self.contents.draw_text(x,y,220,WLH,'Items Dropped')
drops = []
drops_index = []
drops << enemy.drop_item1 unless enemy.drop_item1.kind == 0
drops << enemy.drop_item2 unless enemy.drop_item2.kind == 0
drops_index << 0 unless enemy.drop_item1.kind == 0
drops_index << 1 unless enemy.drop_item2.kind == 0
for i in 0...drops.size
drop = drops[i]
index = drops_index[i]
case drop.kind
when 1
item = $data_items[drop.item_id]
when 2
item = $data_weapons[drop.weapon_id]
when 3
item = $data_armors[drop.armor_id]
end
if $game_system.enemy_drops[enemy.id][index]
draw_item_name(item,x,y + (i+1) * WLH)
probability = 100 / drop.denominator
self.contents.draw_text(x,y + (i+1) * WLH,220,WLH, "#{probability}%",2)
else
self.contents.font.color = normal_color
self.contents.draw_text(x+26,y + (i+1) * WLH,220,WLH,Vocab::UnknownDrop)
end
end
end
#--------------------------------------------------------------------------
# * Draw Enemy Encountered
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_enemy_encountered(enemy,x,y)
self.contents.font.color = system_color
self.contents.draw_text(x,y,120,WLH,'Encountered')
times = $game_system.enemy_encountered[enemy.id]
self.contents.font.color = normal_color
self.contents.draw_text(x + 120,y,36,WLH,times,2)
end
#--------------------------------------------------------------------------
# * Draw Enemy Defeated
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_enemy_defeated(enemy,x,y)
self.contents.font.color = system_color
self.contents.draw_text(x,y,120,WLH,'Defeated')
times = $game_system.enemy_defeated[enemy.id]
self.contents.font.color = normal_color
self.contents.draw_text(x + 120,y,36,WLH,times,2)
end
#--------------------------------------------------------------------------
# * Draw Enemy Weakness
# enemy : enemy
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_enemy_weakness(enemy,x,y)
enemy = Game_Enemy.new(0, enemy.id)
self.contents.font.color = system_color
self.contents.draw_text(x,y,120,WLH,'Weakness')
weakness = []
for element_id in Bestiary::Elements
weakness << element_id if enemy.element_rate(element_id) > 100
end
for i in 0...weakness.size
element_id = weakness[i]
x = 144 * (i % 2)
y2 = WLH * (i / 2)
icon_index = Bestiary::Element_Icons[element_id]
draw_icon(icon_index,x,y2 + (y + WLH))
element = $data_system.elements[element_id]
self.contents.font.color = normal_color
self.contents.draw_text(x+26,y2 + (y + WLH),120,WLH,element)
end
end
end

#==============================================================================
# ** Window_EnemyStatus
#------------------------------------------------------------------------------
# This window displays full status specs on the bestiary screen.
#==============================================================================

class Window_EnemyStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0,0,544,416)
end
#--------------------------------------------------------------------------
# * Setup
# enemy : enemy
# id : bestiary id
#--------------------------------------------------------------------------
def setup(enemy, id)
@enemy = enemy
@id = id
$game_system.new_enemy[enemy.id] = false
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = Cache.battler(@enemy.battler_name, @enemy.battler_hue)
self.contents.blt(0,32,bitmap,bitmap.rect)
self.contents.font.color = normal_color
self.contents.draw_text(0,0,272,WLH,"#{@id}: #{@enemy.name}")
draw_enemy_maxhp(@enemy,272,WLH * 1,156)
draw_enemy_maxmp(@enemy,272,WLH * 2,156)
for i in 0..7
draw_enemy_parameter(@enemy, 304, WLH * 3 + (WLH * i), i)
end
draw_enemy_drop(@enemy,272,WLH * 11)
draw_enemy_encountered(@enemy,272,WLH * 14)
draw_enemy_defeated(@enemy,272,WLH * 15)
draw_enemy_weakness(@enemy,0,WLH * 11)
end
end

#==============================================================================
# ** Window_EnemyList
#------------------------------------------------------------------------------
# This window displays full status specs on the bestiary screen.
#==============================================================================

class Window_EnemyList < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def initialize(x,y)
super(x,y,544,360)
self.index = 0
@column_max = 2
refresh
end
#--------------------------------------------------------------------------
# * Enemy
#--------------------------------------------------------------------------
def enemy
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Enemies
#--------------------------------------------------------------------------
def enemies
return @data
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
for item in $data_enemies
next if Bestiary::Excluded_Enemies.include?(item.id)
@data << item
end
@data.compact!
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : index
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
rect.width -= 4
if $game_system.enemy_encountered[item.id] > 0
if $game_system.new_enemy[item.id]
self.contents.font.color = power_up_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(rect, "#{index+1}:#{item.name}")
else
self.contents.font.color = normal_color
self.contents.draw_text(rect, "#{index+1}:#{Vocab::UnknownEnemy}")
end
end
end
end
#==============================================================================
# ** Scene_Bestiary
#------------------------------------------------------------------------------
# This class performs the bestiary screen processing.
#==============================================================================

class Scene_Bestiary < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@last_bgm = RPG::BGM.last
@help_window = Window_Help.new
@list_window = Window_EnemyList.new(0,56)
@status_window = Window_EnemyStatus.new
@status_window.visible = false
@status_window.back_opacity = 255
encountered = 0
for enemy in @list_window.enemies
if $game_system.enemy_encountered[enemy.id] > 0
encountered += 1
end
end
completion1 = "#{encountered}/#{@list_window.enemies.size}"
completion2 = (encountered * 100) / @list_window.enemies.size
@help_window.set_text("Completion: #{completion1}(#{completion2}%)")
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@list_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update Processing
#--------------------------------------------------------------------------
def update
super
if @status_window.visible
update_status_selection
return
end
if @list_window.active
@list_window.update
update_list_selection
return
end
end
#--------------------------------------------------------------------------
# * Update Status Selection
#--------------------------------------------------------------------------
def update_status_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@status_window.visible = false
@last_bgm.play
return
end
if Input.trigger?(Input::L) or Input.repeat?(Input::L)
Sound.play_cursor
loop do
@list_window.index = (@list_window.index + 1)
@list_window.index %= @list_window.enemies.size
break if $game_system.enemy_encountered[@list_window.index+1] > 0
end
process_status_window(@list_window.enemy, @list_window.index+1)
end
if Input.trigger?(Input::R) or Input.repeat?(Input::R)
Sound.play_cursor
loop do
@list_window.index = (@list_window.index - 1) % @list_window.enemies.size
break if $game_system.enemy_encountered[@list_window.index+1] > 0
end
process_status_window(@list_window.enemy, @list_window.index+1)
end
end
#--------------------------------------------------------------------------
# * Update List Selection
#--------------------------------------------------------------------------
def update_list_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
unless $game_system.enemy_encountered[@list_window.enemy.id] > 0
Sound.play_buzzer
return
end
process_status_window(@list_window.enemy, @list_window.index+1)
end
end
#--------------------------------------------------------------------------
# * Process Status Window
#--------------------------------------------------------------------------
def process_status_window(enemy, index)
if Bestiary::Play_BGM
bgm_name = Bestiary::BGM[enemy.id]
if bgm_name.nil?
bgm = RPG::BGM.new(Bestiary::BGM.default)
bgm.play
else
bgm = RPG::BGM.new(bgm_name)
bgm.play
end
end
@status_window.setup(enemy, index)
@status_window.visible = true
@list_window.draw_item(index-1)
end
end


Ultima modifica di LusianL il Gio Mag 10, 2012 1:39 pm, modificato 1 volta (Motivo : Non avevo messo l'icona.=))

_________________________________________________
Premi RpgMaker
Spoiler:


Bestiario per VX SCContest1OctBestiario per VX SCContest3OctBestiario per VX SCContest3OctBestiario per VX SCContest3OctBestiario per VX SCContest2OctBestiario per VX SCContest2OctBestiario per VX Bestpixel2Bestiario per VX BestresourCSist2Bestiario per VX Mostproductive1Bestiario per VX Iconap13Bestiario per VX Iconap14Bestiario per VX Iconap15Bestiario per VX Iconap16
Bestiario per VX Screen10
LusianL
LusianL

Data d'iscrizione : 07.07.11
Età : 119
Località : Charsetlandia

Torna in alto Andare in basso

Torna in alto


 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.