Jump to content
Rpg²S Forum
  • 0

Richiesta script Bestiario funzionante


BabboNatale
 Share

Question

1 answer to this question

Recommended Posts

  • 0

tieni lo preso in questo forum

 

 

 

# Bestiario Prima versione

 

# Descrizione script :

# Ci tengo a precisare che questo script non è stato inventato da me ma io mi sono

# solo preocupato di modificarlo lo script che è stato preso dal sito giapponese momomomo

# l'autore non è stato immesso nello script o almeno io non sono riuscito a leggerlo

# (essendo uno script jappo xD)

 

# Script Bestiario Modificato da: dad e con la parteciapazione speciale di RagnarokM

 

module Enemy_Book_Config

#Analisi dell'oggetto attiva oppure no

DROP_ITEM_NEED_ANALYZE = false

#Nome del valore di evasione del mostro

EVA_NAME = "Evasione"

#Tipo di calcolo della percentuale dei nemici incontrati:

# 1- numero incontrati / numero massimo

# 2- percentuale dei nemici incontrati e percentuale dei nemici incontrati

# 3- numero incontrati / numero massimo

SHOW_COMPLETE_TYPE = 3

#Sistema dei commenti attivato oppure no

COMMENT_SYSTEM = false

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 Game_Party

attr_accessor :enemy_info # Informazioni sul nemico

#--------------------------------------------------------------------------

# Acquisisce le informazioni

#--------------------------------------------------------------------------

alias book_info_initialize initialize

def initialize

book_info_initialize

@enemy_info = {}

end

#--------------------------------------------------------------------------

# Acquisisce le informazioni in base al tipo:

# 1:

# 0:

#--------------------------------------------------------------------------

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

#--------------------------------------------------------------------------

# Numero massimo di nemici da scrivere nel bestiario

#--------------------------------------------------------------------------

def enemy_book_max

return $game_temp.enemy_book_data.id_data.size - 1

end

#--------------------------------------------------------------------------

# Numero di nemici incontrati fino a quel momento

#--------------------------------------------------------------------------

def enemy_book_now

now_enemy_info = @enemy_info.keys

# 登録無視�属性IDを�得

no_add = $game_temp.enemy_book_data.no_add_element

new_enemy_info = []

for i in now_enemy_info

enemy = $data_enemies

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

#--------------------------------------------------------------------------

# Calcola la percentuale dei nemici incontrati

#--------------------------------------------------------------------------

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

# Continua fino a quando il nemico è vivo; quando muore ne aggiunge le informazioni

unless enemy.hidden

# Aggiunge le informazioni sul nemico

$game_party.add_enemy_info(enemy.id, 0)

end

end

add_enemy_info_start_phase5

end

end

 

class Window_Base < Window

#--------------------------------------------------------------------------

# Disegna gli oggetti persi dai nemici

#--------------------------------------------------------------------------

def draw_enemy_drop_item(enemy, x, y)

self.contents.font.color = normal_color

self.contents.font.name = "Cataneo BT"

treasures = []

if enemy.item_id > 0

treasures.push($data_items[enemy.item_id])

end

if enemy.weapon_id > 0

treasures.push($data_weapons[enemy.weapon_id])

end

if enemy.armor_id > 0

treasures.push($data_armors[enemy.armor_id])

end

# Se i tesori sono più di 0 li disegna

if treasures.size > 0

item = treasures[0]

bitmap = RPG::Cache.icon(item.icon_name)

opacity = 255

self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)

self.contents.font.name = "Cataneo BT"

name = treasures[0].name

else

self.contents.font.color = disabled_color

self.contents.font.name = "Cataneo BT"

name = "Nessuno"

end

self.contents.draw_text(x+28, y, 212, 32, name)

end

#--------------------------------------------------------------------------

# Trova l'id del nemico

#--------------------------------------------------------------------------

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)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# Scrive il nome del nemico

# enemy : nemico

# x : coordinata X in cui scrivere

# y : coordinata Y in cui scrivere

#--------------------------------------------------------------------------

def draw_enemy_name(enemy, x, y)

self.contents.font.color = normal_color

self.contents.draw_text(x, y, 152, 32, enemy.name)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# Disegna l'immagine del nemico

# enemy : nemico

# x : coordinata X in cui scrivere

# y : coordinata Y in cui scrivere

#--------------------------------------------------------------------------

def draw_enemy_graphic(enemy, x, y, opacity = 255)

bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)

cw = bitmap.width

ch = bitmap.height

src_rect = Rect.new(0, 0, cw, ch)

x = x + (cw / 2 - x) if cw / 2 > x

self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# Scrive l'esperienza che si ottiene dal nemico

# enemy : nemico

# x : coordinata X in cui scrivere

# y : coordinata Y in cui scrivere

#--------------------------------------------------------------------------

def draw_enemy_exp(enemy, x, y)

self.contents.font.color = system_color

self.contents.draw_text(x, y, 120, 32, "EXP")

self.contents.font.color = normal_color

self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# Scrive il totale dei soldi che si ottengono dal nemico

# enemy : nemico

# x : coordinata X in cui scrivere

# y : coordinata Y in cui scrivere

#--------------------------------------------------------------------------

def draw_enemy_gold(enemy, x, y)

self.contents.font.color = system_color

self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)

self.contents.font.color = normal_color

self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# Scrive a quali elementi il nemico è debole

# enemy : nemico

# x : coordinata X in cui scrivere

# y : coordinata Y in cui scrivere

#--------------------------------------------------------------------------

#def draw_element_guard(enemy, x, y)

#self.contents.font.color = system_color

#self.contents.draw_text(x, y, 120, 32, "Elemnti:")

#@data = $Game_Enemy.element_ranks.size

#for i in 1..@data

#if $Game_Enemy.element_ranks == 0

#self.contents.font.color = Color.new(255, 0, 0, 255)

#else

#if $Game_Enemy.element_ranks == 1

#self.contents.font.color = Color.new(255, 100, 0, 255)

#else

#if $Game_Enemy.element_ranks == 2

#self.contents.font.color = Color.new(214, 214, 214, 255)

#else

#if $Game_Enemy.element_ranks == 3

#self.contents.font.color = Color.new(0, 255, 0, 255)

#else

#if $Game_Enemy.element_ranks == 4

#self.contents.font.color = Color.new(0, 0, 255, 255)

#else

#if $Game_Enemy.element_ranks == 5

#self.contents.font.color = Color.new(180, 0, 255, 255)

#end

#end

#end

#end

#end

#end

#self.contents.font.name = "Arial"

#self.contents.draw_text(x + 120, y, 36, 32, $Game_Enemy.element_ranks, 2)

#end

#end

end

 

class Game_Enemy_Book < Game_Enemy

#--------------------------------------------------------------------------

# INIZIALIZZAZIONE

#--------------------------------------------------------------------------

def initialize(enemy_id)

super(2, 1)#Super del nemico

@enemy_id = enemy_id

enemy = $data_enemies[@enemy_id]

@battler_name = enemy.battler_name

@battler_hue = enemy.battler_hue

@hp = maxhp

@sp = maxsp

end

end

 

class Data_MonsterBook

attr_reader :id_data

#--------------------------------------------------------------------------

# INIZIALIZZAZIONE

#--------------------------------------------------------------------------

def initialize

@id_data = enemy_book_id_set

end

#--------------------------------------------------------------------------

#

#--------------------------------------------------------------------------

def no_add_element

no_add = 0

# 登録無視�属性IDを�得

for i in 1...$data_system.elements.size

if $data_system.elements =~ /図鑑登録無効/

no_add = i

break

end

end

return no_add

end

#--------------------------------------------------------------------------

#

#--------------------------------------------------------------------------

def enemy_book_id_set

data = [0]

no_add = no_add_element

# Setta il nemico all'interno del libro

for i in 1...$data_enemies.size

enemy = $data_enemies

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

#--------------------------------------------------------------------------

# Inizializza la finestra del bestiario

#--------------------------------------------------------------------------

def initialize(index=0)

super(0, 64, 640, 416)

@column_max = 2

@book_data = $game_temp.enemy_book_data

@data = @book_data.id_data.dup

@data.shift

#@data.sort!

@item_max = @data.size

self.index = 0

refresh if @item_max > 0

end

#--------------------------------------------------------------------------

# Dispone i nemici nella finestra

#--------------------------------------------------------------------------

def data_set

data = $game_party.enemy_info.keys

data.sort!

newdata = []

for i in data

next if $game_party.enemy_info == 0

# Se il menico non è nel libro lo aggiunge

if book_id(i) != nil

newdata.push(i)

end

end

return newdata

end

#--------------------------------------------------------------------------

# Mostra i nemici

#--------------------------------------------------------------------------

def show?(id)

if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil

return false

else

return true

end

end

#--------------------------------------------------------------------------

# la posizione nel libro

#--------------------------------------------------------------------------

def book_id(id)

return @book_data.index(id)

end

#--------------------------------------------------------------------------

#

#--------------------------------------------------------------------------

def item

return @data[self.index]

end

#--------------------------------------------------------------------------

# REFRESH

#--------------------------------------------------------------------------

def refresh

if self.contents != nil

self.contents.dispose

self.contents = nil

self.contents.font.name = "Cataneo BT"

end

self.contents = Bitmap.new(width - 32, row_max * 32)

# Se il numero degli oggetti è maggiore di 0 li disegna

if @item_max > 0

for i in 0...@item_max

draw_item(i)

end

end

end

#--------------------------------------------------------------------------

# Disegna l'oggetto

# index : posizione dell'oggetto nell'array

#--------------------------------------------------------------------------

def draw_item(index)

enemy = $data_enemies[@data[index]]

return if enemy == nil

x = 4 + index % 2 * (288 + 32)

y = index / 2 * 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

self.contents.font.name = "Cataneo BT"

draw_enemy_book_id(enemy, x, y)

if show?(enemy.id)

self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)

self.contents.font.name = "Cataneo BT"

else

self.contents.draw_text(x + 28+16, y, 212, 32, "-----------", 0)

self.contents.font.name = "Cataneo BT"

return

end

if analyze?(@data[index])

self.contents.font.color = text_color(3)

self.contents.draw_text(x + 256, y, 24, 32, "", 2)

self.contents.font.name = "Cataneo BT"

end

end

#--------------------------------------------------------------------------

# Analizza le informazioni

#--------------------------------------------------------------------------

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

#--------------------------------------------------------------------------

# INIZIALIZZAZIONE

#--------------------------------------------------------------------------

def initialize

super(0, 0+64, 640, 480-64)

self.contents = Bitmap.new(width - 32, height - 32)

self.contents.font.name = "Cataneo BT"

end

#--------------------------------------------------------------------------

# REFRESH

#--------------------------------------------------------------------------

def refresh(enemy_id)

self.contents.clear

self.contents.font.size = 22

self.contents.font.name = "Cataneo BT"

enemy = Game_Enemy_Book.new(enemy_id)

draw_enemy_graphic(enemy, 96, 240+48+64, 200)

draw_enemy_book_id(enemy, 4, 0)

draw_enemy_name(enemy, 48, 0)

draw_actor_hp(enemy, 288, 0)

draw_actor_sp(enemy, 288+160, 0)

draw_actor_parameter(enemy, 288 , 32, 0)

self.contents.font.color = system_color

self.contents.draw_text(288+160, 32, 120, 32, Enemy_Book_Config::EVA_NAME)

self.contents.font.color = normal_color

self.contents.draw_text(288+160 + 120, 32, 36, 32, enemy.eva.to_s, 2)

self.contents.font.name = "Cataneo BT"

draw_actor_parameter(enemy, 288 , 64, 3)

draw_actor_parameter(enemy, 288+160, 64, 4)

draw_actor_parameter(enemy, 288 , 96, 5)

draw_actor_parameter(enemy, 288+160, 96, 6)

draw_actor_parameter(enemy, 288 , 128, 1)

draw_actor_parameter(enemy, 288+160, 128, 2)

draw_enemy_exp(enemy, 288, 160)

draw_enemy_gold(enemy, 288+160, 160)

self.contents.font.name = "Cataneo BT"

if analyze?(enemy.id) or !Enemy_Book_Config::DROP_ITEM_NEED_ANALYZE

self.contents.draw_text(288, 192, 96, 32, "Oggetti ricevuti")

draw_enemy_drop_item(enemy, 288+96+4, 192)

self.contents.font.color = normal_color

self.contents.font.name = "Cataneo BT"

#draw_element_guard(enemy, 320-32, 160-16+96)

end

end

#--------------------------------------------------------------------------

# Analizza le informazioni

#--------------------------------------------------------------------------

def analyze?(enemy_id)

if $game_party.enemy_info[enemy_id] == 2

return true

else

return false

end

end

end

 

 

class Scene_MonsterBook

#-----------------------------------------------------------------------------

# Scene del bestiario

# ----------------------------------------------------------------------------

def main

$game_temp.enemy_book_data = Data_MonsterBook.new

# Creo la finestra del titolo

@title_window = Window_Base.new(0, 0, 640, 64)

@title_window.contents = Bitmap.new(640 - 32, 64 - 32)

@title_window.contents.font.name = "Cataneo BT"

@title_window.contents.font.size = 24

@title_window.contents.draw_text(100, 0, 320, 32, "Bestiario", 0)

if Enemy_Book_Config::SHOW_COMPLETE_TYPE != 0

case Enemy_Book_Config::SHOW_COMPLETE_TYPE

when 1

e_now = $game_party.enemy_book_now

e_max = $game_party.enemy_book_max

text = e_now.to_s + " / " + e_max.to_s

when 2

comp = $game_party.enemy_book_complete_percentage

text = comp.to_s + " %"

when 3

e_now = $game_party.enemy_book_now

e_max = $game_party.enemy_book_max

comp = $game_party.enemy_book_complete_percentage

text = e_now.to_s + " / " + e_max.to_s + " " + comp.to_s + " %"

end

if text != nil

@title_window.contents.draw_text(280, 0, 288, 32, text, 2)

end

end

@main_window = Window_MonsterBook.new

@main_window.active = true

# Creo la finestra delle informazioni

@info_window = Window_MonsterBook_Info.new

@info_window.z = 110

@info_window.visible = false

@info_window.active = false

@visible_index = 0

 

# Cambio di grafica

Graphics.transition

# Inizio Ciclo

loop do

# Aggiorno la grafica

Graphics.update

# Update dell'input

Input.update

# update

update

# se la scene è diversa interrompo il ciclo

if $scene != self

break

end

end

# Congelo la grafica

Graphics.freeze

# Cancellazione finestre

@main_window.dispose

@info_window.dispose

@title_window.dispose

@comment_window.dispose if @comment_window != nil

end

#--------------------------------------------------------------------------

# Update

#--------------------------------------------------------------------------

def update

# Update delle finestre

@main_window.update

@info_window.update

if @info_window.active

update_info

return

end

# Se è attiva la finestra principale la aggiorno

if @main_window.active

update_main

return

end

end

#--------------------------------------------------------------------------

# Update della finestra principale

#--------------------------------------------------------------------------

def update_main

# Se il tasto premuto è la B torno alla mappa

if Input.trigger?(Input::B)

# Suono se è il tasto premuto

$game_system.se_play($data_system.cancel_se)

$scene = Scene_Map.new

return

end

# Se il tasto premuto è C scrivo la pagina del bestiario

if Input.trigger?(Input::C)

if @main_window.item == nil or @main_window.show?(@main_window.item) == false

# Suono se premuto

$game_system.se_play($data_system.buzzer_se)

return

end

# faccio comparire la pagina del bestiario

$game_system.se_play($data_system.decision_se)

@main_window.active = false

@info_window.active = true

@info_window.visible = true

@visible_index = @main_window.index

@info_window.refresh(@main_window.item)

if @comment_window != nil

@comment_window.refresh(@main_window.item)

if @comment_on

@comment_window.visible = true

else

@comment_window.visible = false

end

end

return

end

end

#--------------------------------------------------------------------------

# Aggiorno le informazioni

#--------------------------------------------------------------------------

def update_info

# Se il tasto premuto è B ritorno alla pagina principale del bestiario

if Input.trigger?(Input::B)

# Suono SE

$game_system.se_play($data_system.cancel_se)

@main_window.active = true

@info_window.active = false

@info_window.visible = false

@comment_window.visible = false if @comment_window != nil

return

end

# Se il tasto premuto è C apro la pagina dei commenti

if Input.trigger?(Input::C)

if @comment_window != nil

# Suono SE

$game_system.se_play($data_system.decision_se)

if @comment_on

@comment_on = false

@comment_window.visible = false

else

@comment_on = true

@comment_window.visible = true

end

return

end

end

if Input.trigger?(Input::L)

# Suono SE

$game_system.se_play($data_system.decision_se)

loop_end = false

while loop_end == false

if @visible_index != 0

@visible_index -= 1

else

@visible_index = @main_window.data.size - 1

end

loop_end = true if @main_window.show?(@main_window.data[@visible_index])

end

id = @main_window.data[@visible_index]

@info_window.refresh(id)

@comment_window.refresh(id) if @comment_window != nil

return

end

if Input.trigger?(Input::R)

# Suono SE

$game_system.se_play($data_system.decision_se)

loop_end = false

while loop_end == false

if @visible_index != @main_window.data.size - 1

@visible_index += 1

else

@visible_index = 0

end

loop_end = true if @main_window.show?(@main_window.data[@visible_index])

end

id = @main_window.data[@visible_index]

@info_window.refresh(id)

@comment_window.refresh(id) if @comment_window != nil

return

end

end

end

 

# Note by dad;

#--------------------------------------------------------------------------

# ISTRUZIONI

# Ecco alcune istruzioni per l'uso :

# 1)Per richiamare questo script dovrete scrivere nell'apposito comando di rpg maker xp

# cioè call script,questo "$scene = Scene_MonsterBook.new"

# 2)Questo codice è utile per far apparire la percentuale di mostri scoperti ed inseriti

# nel proprio bestiario eccolo qui il codice che deve essere sempre inserito nel comando call scrirt:

# Script

# $game_variables[10] = enemy_book_max

# $game_variables[11] = enemy_book_now

# $game_variables[12] = enemy_book_comp

# Fine script.

# 3)Questo codice permette la visuallizzazione subito di tutti i mostri nel bestiario

# (piu' che altro serve per vedere le potenzialita del bestiario.

# Ecco il pezzo di codice da inserire nell'evento :

# Script

# data = Data_MonsterBook.new

# for i in data.id_data

# next if i == 0

# $game_party.add_enemy_info(i, 0)

# end

#Il tasto L corrisponde alla lettera Q e il tasto R alla lettera W

#

# Fine script

#-----------------------------------------------------------------------

 

 

 

 

istruzzioni in fondo allo script

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...