I don't know how I did it, but with a combination of DerVVulfman's help, and Babelfish, I managed to figure out Momo's comment function for his beastiary, or Demon Book. If anyone wants it, here it be!
This script adds a function to Momo's Demon Book wherein you can create comments on the monsters in your game that can be viewed by the player.
Note: I DID NOT MAKE THIS SCRIPT! Ahem. Sorry. Momo made this script, not me. Please don't ask me about how it works, I don't know. I figured this out by a combination of beginner's and dumb luck. If you want to know HOW to use it, ask me. That I may be able to help with :D .
This is the main Beastiary. Put this above main, yada yada.
This is the Book Comment function itself.
This is where you put your comments for monsters. Change
See? Each number next to "str" is your monster's number in the database. To call the beastiary, use this in an event:
Also, to change the name of the Beastiary, just go to Line 468 in the first script, and change the words in quotes to whatever you want.
That's about it! You can post questions on this here! I must have some kind of coding angel or something, cause I can't script for beans, and I figured out this thing! Even I don't know how I did it! If I forgot anything, I'm sorry. This is the first script I've posted.
This script adds a function to Momo's Demon Book wherein you can create comments on the monsters in your game that can be viewed by the player.
Note: I DID NOT MAKE THIS SCRIPT! Ahem. Sorry. Momo made this script, not me. Please don't ask me about how it works, I don't know. I figured this out by a combination of beginner's and dumb luck. If you want to know HOW to use it, ask me. That I may be able to help with :D .
This is the main Beastiary. Put this above main, yada yada.
Code:
#é”物図鑑
#
#エãƒãƒŸãƒ¼ã®éé‡æƒ…å ±ã¯ã€æˆ¦é—˜çµ‚了時(経験値ãªã©ã‚’ç²å¾—ã™ã‚‹æ‰€)ã§è¿½åŠ ã•ã‚Œã¾ã™ã€‚
#よã£ã¦ã€æ•µã‹ã‚‰é€ƒã’ãŸå ´åˆã‚„è² ã‘イベントã§ã®æˆ¦é—˜æ•—北ãªã©ã§ã¯
#図鑑ã«ç™»éŒ²ã•ã‚Œã¾ã›ã‚“。
#ã“ã®ã‚¿ã‚¤ãƒŸãƒ³ã‚°ã‚’変ãˆãŸã„å ´åˆã¯å„自書ãæ›ãˆã¦ä¸‹ã•ã„。
#(class Scene_Battle ã® start_phase5 ã§è¿½åŠ ã—ã¦ã¾ã™ã€‚)
#
#ã¾ãŸã€æ‰€ã€…「アナライズã€ã¨ã„ã†å˜èªžãŒã‚ã‚Šã¾ã™ãŒã€
#ç¾åœ¨ã€ã“ã®é”物辞典ã ã‘ã§ã¯æ©Ÿèƒ½ã—ã¦ãŠã‚Šã¾ã›ã‚“。(自ゲームã§ã®å残)
#Window_MonsterBook_Info ã® DROP_ITEM_NEED_ANALYZE ㌠true ã«ãªã£ã¦ã„ã‚‹ã¨
#ドãƒãƒƒãƒ—アイテムãŒè¡¨ç¤ºã•ã‚Œãªããªã‚Šã¾ã™ã®ã§ã€é€šå¸¸ã¯ false ã«ã—ã¦ãŠã„ã¦ä¸‹ã•ã„。
#
#注æ„
#ã“ã®ã¾ã¾ä½¿ã†ã¨ã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã®ãƒˆãƒ«ãƒ¼ãƒ—ã®1番ã«
#何もè¨å®šã—ã¦ã„ãªã„ã¨ã€ã‚¨ãƒ©ãƒ¼åãã¾ã™ã€‚
#対処ç–ã¨ã—ã¦ã¯
#1.ç´ ç›´ã«ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã®ãƒˆãƒ«ãƒ¼ãƒ—ã®1番ã«ä½•ã§ã‚‚ã„ã„ã‹ã‚‰è¨å®šã™ã‚‹ã€‚
#2.Game_Enemy_Book 㮠「super(1, 0)#ダミー〠ã®å·¦å´ã®æ•°å—ã®éƒ¨åˆ†ã‚’
# å˜åœ¨ã™ã‚‹ãƒˆãƒ«ãƒ¼ãƒ—IDã«æ›¸ãæ›ãˆã‚‹ã€‚
#ã®ã©ã¡ã‚‰ã‹ã«ãªã‚Šã¾ã™ã€‚
#
#2005.2.6 機能追åŠ
#図鑑完æˆåº¦ã®è¡¨ç¤ºæ©Ÿèƒ½ã‚’追åŠ
#SHOW_COMPLETE_TYPE ã§è¨å®šã§ãã¾ã™ã€‚
#イベントコマンドã®ã€Œã‚¹ã‚¯ãƒªãƒ—トã€ã§
#$game_party.enemy_book_max ã§å›³é‘‘ã®ç·é”物数(最大数)
#$game_party.enemy_book_now ã§å›³é‘‘ã®ç¾åœ¨ç™»éŒ²æ•°(ç¾åœ¨æ•°)
#$game_party.complete_percentage ã§å›³é‘‘ã®å®ŒæˆçŽ‡(å°æ•°ç‚¹åˆ‡æ¨ã¦)
#ã‚’å–å¾—ã§ãã¾ã™ã€‚
#
#2005.2.17
#complete_percentageã®ãƒ¡ã‚½ãƒƒãƒ‰åã‚’
#enemy_book_complete_percentageã«å¤‰æ›´(ä»–ã®å›³é‘‘ã¨åŒºåˆ¥ã§ãるよã†ã«)
#イベントコマンドã®ã€Œã‚¹ã‚¯ãƒªãƒ—トã€ã§æœ€å¤§æ•°ç‰ã®å–å¾—ã‚’çŸç¸®ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚
#enemy_book_max ã§å›³é‘‘ã®ç·é”物数(最大数)
#enemy_book_now ã§å›³é‘‘ã®ç¾åœ¨ç™»éŒ²æ•°(ç¾åœ¨æ•°)
#enemy_book_compã§å›³é‘‘ã®å®ŒæˆçŽ‡(å°æ•°ç‚¹åˆ‡æ¨ã¦)
#
#2005.2.18 ãƒã‚°ä¿®æ£
#complete_percentageã®ãƒ¡ã‚½ãƒƒãƒ‰åã‚’
#enemy_book_complete_percentageã«å¤‰æ›´ã—ãŸã®ã«
#complete_percentageã£ã¦å‘¼ã³å‡ºã—ã¦ã¾ã—ãŸã€‚(å˜ãªã‚‹æ›¸ãæ›ãˆæ¼ã‚Œã§ã™ã)
#
#2005.7.4 機能追åŠ
#コメント機能ã«å¯¾å¿œã€‚
#全体的ã«è‰²ã€…ã„ã˜ã‚Šã¾ã—ãŸã€‚
#
#2005.7.4 ãƒã‚°ä¿®æ£
#ç´°ã‹ã„ãƒã‚°ã‚’ä¿®æ£ã€‚
module Enemy_Book_Config
#ドãƒãƒƒãƒ—アイテム表示ã«ã‚¢ãƒŠãƒ©ã‚¤ã‚ºãŒå¿…è¦ã‹ã©ã†ã‹
DROP_ITEM_NEED_ANALYZE = false
#回é¿ä¿®æ£ã®åå‰
EVA_NAME = "回é¿"
#図鑑完æˆçŽ‡ã®è¡¨ç¤ºæ–¹æ³•
#0:表示ãªã— 1:ç¾åœ¨æ•°/最大数 2:%表示 3:両方
SHOW_COMPLETE_TYPE = 3
#コメント機能を使ã†ã‹ã©ã†ã‹(è¦ãƒ»ã‚³ãƒ¡ãƒ³ãƒˆè¿½åŠ スクリプト導入)
COMMENT_SYSTEM = true
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 # 出会ã£ãŸæ•µæƒ…å ±(図鑑用)
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias book_info_initialize initialize
def initialize
book_info_initialize
@enemy_info = {}
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼æƒ…å ±ã®è¿½åŠ (図鑑用)
# type : 通常éé‡ã‹ã‚¢ãƒŠãƒ©ã‚¤ã‚ºã‹ 0:通常 1:アナライズ -1:æƒ…å ±å‰Šé™¤
# 0:ç„¡éé‡ 1:éé‡æ¸ˆ 2:アナライズ済
#--------------------------------------------------------------------------
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
# 登録無視ã®å±žæ€§IDã‚’å–å¾—
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
#--------------------------------------------------------------------------
# â— é”物図鑑ã®å®ŒæˆçŽ‡ã‚’å–å¾—
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_drop_item(enemy, x, y)
self.contents.font.color = normal_color
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
# ç¾çŠ¶ã§ã¯ã¨ã‚Šã‚ãˆãš1ã¤ã®ã¿æç”»
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)
name = treasures[0].name
else
self.contents.font.color = disabled_color
name = "No Item"
end
self.contents.draw_text(x+28, y, 212, 32, name)
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼ã®å›³é‘‘IDã®æç”»
#--------------------------------------------------------------------------
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)
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼ã®åå‰ã®æç”»
# enemy : エãƒãƒŸãƒ¼
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 152, 32, enemy.name)
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼ã‚°ãƒ©ãƒ•ã‚£ãƒƒã‚¯ã®æç”»(アナライズ)
# enemy : エãƒãƒŸãƒ¼
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
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)
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼ã®ç²å¾—EXPã®æç”»
# enemy : エãƒãƒŸãƒ¼
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
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)
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼ã®ç²å¾—GOLDã®æç”»
# enemy : エãƒãƒŸãƒ¼
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
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)
end
end
class Game_Enemy_Book < Game_Enemy
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize(enemy_id)
super(1, 0)#ダミー
@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
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
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[i] =~ /図鑑登録無効/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ◠図鑑用敵IDè¨å®š
#--------------------------------------------------------------------------
def enemy_book_id_set
data = [0]
no_add = no_add_element
# 登録無視ã®å±žæ€§IDã‚’å–å¾—
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, 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
#--------------------------------------------------------------------------
# â— éé‡ãƒ‡ãƒ¼ã‚¿ã‚’å–å¾—
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
# ◠図鑑用IDå–å¾—
#--------------------------------------------------------------------------
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)
#é …ç›®æ•°ãŒ 0 ã§ãªã‘ã‚Œã°ãƒ“ットマップを作æˆã—ã€å…¨é …目をæç”»
if @item_max > 0
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
# index : é …ç›®ç•ªå·
#--------------------------------------------------------------------------
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
draw_enemy_book_id(enemy, x, y)
if show?(enemy.id)
self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
else
self.contents.draw_text(x + 28+16, y, 212, 32, "ï¼ï¼ï¼ï¼ï¼", 0)
return
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
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(0, 0+64, 640, 480-64)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(enemy_id)
self.contents.clear
self.contents.font.size = 22
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)
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)
if analyze?(enemy.id) or !Enemy_Book_Config::DROP_ITEM_NEED_ANALYZE
self.contents.draw_text(288, 192, 96, 32, "Drop Item")
draw_enemy_drop_item(enemy, 288+96+4, 192)
self.contents.font.color = normal_color
#draw_element_guard(enemy, 320-32, 160-16+96)
end
end
#--------------------------------------------------------------------------
# ◠アナライズ済ã‹ã©ã†ã‹
#--------------------------------------------------------------------------
def analyze?(enemy_id)
if $game_party.enemy_info[enemy_id] == 2
return true
else
return false
end
end
end
class Scene_MonsterBook
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
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 Information", 0)
@main_window = Window_MonsterBook.new
@main_window.active = true
# ã‚¤ãƒ³ãƒ•ã‚©ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ä½œæˆ (ä¸å¯è¦–・éžã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«è¨å®š)
@info_window = Window_MonsterBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
@visible_index = 0
if Enemy_Book_Config::COMMENT_SYSTEM
# ã‚³ãƒ¡ãƒ³ãƒˆã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ä½œæˆ (ä¸å¯è¦–・éžã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«è¨å®š)
@comment_window = Window_Monster_Book_Comment.new
@comment_window.z = 120
@comment_window.visible = false
@comment_on = false # コメントフラグ
end
# トランジション実行
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
@comment_window.dispose if @comment_window != nil
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@main_window.update
@info_window.update
if @info_window.active
update_info
return
end
# メインウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_target を呼ã¶
if @main_window.active
update_main
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (メインウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_main
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
if @main_window.item == nil or @main_window.show?(@main_window.item) == false
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE ã‚’æ¼”å¥
$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
#--------------------------------------------------------------------------
# ◠フレーム更新 (インフォウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_info
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル 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
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
if @comment_window != nil
# 決定 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)
# 決定 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)
# 決定 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
This is the Book Comment function itself.
Code:
# å›³é‘‘ã‚³ãƒ¡ãƒ³ãƒˆæ©Ÿèƒ½è¿½åŠ (基本)
#
# 図鑑ã«ã‚³ãƒ¡ãƒ³ãƒˆæ©Ÿèƒ½ã‚’使ã„ã™ã‚‹ã®ã«å¿…é ˆã§ã™ã€‚
#
# 2005.9.19
# ウィンドウã®ä¸é€æ˜Žåº¦ã€ãƒ•ã‚©ãƒ³ãƒˆã¨æ–‡å—色を指定å¯èƒ½ã«ã€‚
class Window_Book_Comment < Window_Base
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = self.window_opa
self.contents.font.name = self.font_name
self.contents.font.color = self.font_color
end
#--------------------------------------------------------------------------
# â— æ–‡å—列変æ›
#--------------------------------------------------------------------------
def transfer(str)
text = str.clone
# 制御文å—処ç†
begin
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
# 便宜上ã€"\\\\" ã‚’ "\000" ã«å¤‰æ›
text.gsub!(/\\\\/) { "\000" }
# "\\C" ã‚’ "\001" ã«ã€"\\G" ã‚’ "\002" ã«å¤‰æ›
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
text.gsub!(/\\[Gg]/) { "\002" }
# ä¸é€æ˜Žåº¦
text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\200[#{$1}]" }
# æ–‡å—サイズ
text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\201[#{$1}]" }
# ルビ
text.gsub!(/\\[Rr]\[(.+?),(.+?)\]/) { "\202[#{$1},#{$2}]" }
# ピクãƒãƒ£è¡¨ç¤º
text.gsub!(/\\[Pp]ic\[([0-9]+),([0-9]+),([^,\]]+)\]/) { "\250[#{$1},#{$2},#{$3}]" }
# ãƒãƒˆãƒ©ãƒ¼è¡¨ç¤º
text.gsub!(/\\[Bb]at\[([0-9]+),([0-9]+),([^,\]]+),([0-9]+)\]/) { "\251[#{$1},#{$2},#{$3},#{$4}]" }
# ã‚ャラグラフィック表示
text.gsub!(/\\[Cc]ha\[([0-9]+),([0-9]+),([^,\]]+),([0-9]+),([0-9]+),([0-9]+)\]/) { "\252[#{$1},#{$2},#{$3},#{$4},#{$5},#{$6}]" }
return text
end
#--------------------------------------------------------------------------
# ◠変æ›ã—ãŸæ–‡å—列をæç”»
#--------------------------------------------------------------------------
def draw_ex_text(ox, oy, str, align=0)
text = str.clone
x = 0
y = 0
# c ã« 1 æ–‡å—ã‚’å–å¾— (æ–‡å—ãŒå–å¾—ã§ããªããªã‚‹ã¾ã§ãƒ«ãƒ¼ãƒ—)
while ((c = text.slice!(/./m)) != nil)
# \\ ã®å ´åˆ
if c == "\000"
# 本æ¥ã®æ–‡å—ã«æˆ»ã™
c = "\\"
end
# \C[n] ã®å ´åˆ
if c == "\001"
# æ–‡å—色を変更
text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
# 次ã®æ–‡å—ã¸
next
end
# \G ã®å ´åˆ
if c == "\002"
# 所æŒã‚´ãƒ¼ãƒ«ãƒ‰ã«å¤‰æ›
c = $game_party.gold.to_s
# æ–‡å—ã‚’æç”»
self.contents.draw_text(ox+4+x, oy+4+ 32 * y, self.contents.text_size(c).width, 32, c)
# x ã«æç”»ã—ãŸæ–‡å—ã®å¹…ã‚’åŠ ç®—
x += self.contents.text_size(c).width
# 次ã®æ–‡å—ã¸
next
end
# \O ã®å ´åˆ
if c == "\200"
text.sub!(/\[([0-9]+)\]/, "")
opacity = $1.to_i
temp = self.contents.font.color
self.contents.font.color = Color.new(temp.red, temp.green, temp.blue, opacity)
# 次ã®æ–‡å—ã¸
next
end
# \H ã®å ´åˆ
if c == "\201"
text.sub!(/\[([0-9]+)\]/, "")
self.contents.font.size = [[$1.to_i, 6].max, 32].min
# 次ã®æ–‡å—ã¸
next
end
# \R ã®å ´åˆ
if c == "\202"
text.sub!(/\[(.+?),(.+?)\]/, "")
x += ruby_set(ox+x,oy+(y*32),$1,$2)
# 次ã®æ–‡å—ã¸
next
end
# \Pic ã®å ´åˆ
if c == "\250"
text.sub!(/\[([0-9]+),([0-9]+),([^,\]]+)\]/, "")
ope = self.contents.font.color.alpha
set_picture($1.to_i, $2.to_i, $3, ope)
# 次ã®æ–‡å—ã¸
next
end
# \Bat ã®å ´åˆ
if c == "\251"
text.sub!(/\[([0-9]+),([0-9]+),([^,\]]+),([0-9]+)\]/, "")
ope = self.contents.font.color.alpha
set_battler($1.to_i, $2.to_i, $3, $4.to_i, ope)
# 次ã®æ–‡å—ã¸
next
end
# \Cha ã®å ´åˆ
if c == "\252"
text.sub!(/\[([0-9]+),([0-9]+),([^,\]]+),([0-9]+),([0-9]+),([0-9]+)\]/, "")
ope = self.contents.font.color.alpha
set_character($1.to_i, $2.to_i, $3, $4.to_i, $5.to_i, $6.to_i, ope)
# 次ã®æ–‡å—ã¸
next
end
# 改行文å—ã®å ´åˆ
if c == "\n"
# y ã« 1 ã‚’åŠ ç®—
y += 1
x = 0
# 次ã®æ–‡å—ã¸
next
end
# æ–‡å—ã‚’æç”»
self.contents.draw_text(ox+4+x, 4+oy+ 32 * y, 40, 32, c)
# x ã«æç”»ã—ãŸæ–‡å—ã®å¹…ã‚’åŠ ç®—
x += self.contents.text_size(c).width
end
end
#--------------------------------------------------------------------------
# ◠ルビæç”»
#--------------------------------------------------------------------------
def ruby_set(x,y,str,ruby)
text_w = self.contents.text_size(str).width
text_h = self.contents.text_size(str).height
f_size_back = self.contents.font.size
ruby_size = 10
self.contents.font.size = ruby_size
ruby_w = self.contents.text_size(ruby).width
self.contents.draw_text(4+x, 4+4+y-ruby_size+1, text_w, ruby_size, ruby, 1)
self.contents.font.size = f_size_back
self.contents.draw_text(4+x, 4+4+y, text_w, text_h, str)
return text_w
end
#--------------------------------------------------------------------------
# ◠ピクãƒãƒ£ãƒ¼æç”»
#--------------------------------------------------------------------------
def set_picture(x, y, filename, opacity=255)
bitmap = RPG::Cache.picture(filename)
self.contents.blt(x, y, bitmap, bitmap.rect, opacity)
end
#--------------------------------------------------------------------------
# â— ãƒãƒˆãƒ©ãƒ¼æç”»
#--------------------------------------------------------------------------
def set_battler(x, y, filename, hue, opacity=255)
bitmap =RPG::Cache.battler(filename, hue)
self.contents.blt(x, y, bitmap, bitmap.rect, opacity)
end
#--------------------------------------------------------------------------
# â— ã‚ャラクターæç”»
#--------------------------------------------------------------------------
def set_character(x, y, filename, hue, dir, pat, opacity=255)
bitmap = RPG::Cache.character(filename, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
cy = ch * (dir / 2 - 1)
cx = cw * (pat - 1)
src_rect = Rect.new(cx, cy, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
end
def window_opa
end
def font_name
end
def font_color
end
end
This is where you put your comments for monsters. Change
Code:
# å›³é‘‘ã‚³ãƒ¡ãƒ³ãƒˆæ©Ÿèƒ½è¿½åŠ (é”物図鑑)
#
# コメントã«ã¯å†’険日記ã¨åŒæ§˜ã®åˆ¶å¾¡æ–‡å—ãŒä½¿ç”¨å¯èƒ½ã§ã™ã€‚
# 詳ã—ãã¯å†’険日記ã®æ–¹ã‚’ã”覧下ã•ã„。
#
# 2005.9.19
# ウィンドウã®ä¸é€æ˜Žåº¦ã€ãƒ•ã‚©ãƒ³ãƒˆã¨æ–‡å—色を指定å¯èƒ½ã«ã€‚
module MoMo_M_Book_Comment
# コメントウィンドウã®æ¨ªå¹…
C_WINDOW_WIDTH = 640
# コメントウィンドウã®ç¸¦å¹…
C_WINDOW_HEIGHT = 128
# コメントウィンドウã®X座標
C_WINDOW_X = 0
# コメントウィンドウã®Y座標
C_WINDOW_Y = 352
# コメントウィンドウã®ä¸é€æ˜Žåº¦
C_WINDOW_OPA = 255
# 使用ã™ã‚‹ãƒ•ã‚©ãƒ³ãƒˆå(å¸Œæœ›é †ã«é…列ã«è¿½åŠ ã—ã¦ãã ã•ã„)
C_WINDOW_FONT_NAME = ["Tahoma"]
# 使用ã™ã‚‹æ–‡å—色
# Color.new(赤ã®å€¤, ç·‘ã®å€¤, é’ã®å€¤, ä¸é€æ˜Žåº¦) ※0~255ã¾ã§
C_WINDOW_FONT_COLOR = Color.new(255, 255, 255, 255)
end
class Window_Monster_Book_Comment < Window_Book_Comment
def initialize
x = MoMo_M_Book_Comment::C_WINDOW_X
y = MoMo_M_Book_Comment::C_WINDOW_Y
width = MoMo_M_Book_Comment::C_WINDOW_WIDTH
height = MoMo_M_Book_Comment::C_WINDOW_HEIGHT
super(x, y, width, height)
end
def draw_comment(id)
self.contents.clear
comment = get_comment(id)
draw_ex_text(0, 0, transfer(comment))
end
def get_comment(id)
return comment_set[0] if comment_set[id] == nil
return comment_set[id]
end
def comment_set
return MoMo_M_Book_Comment::M_BOOK_COMMENT
end
def refresh(id)
draw_comment(id)
end
def window_opa
return MoMo_M_Book_Comment::C_WINDOW_OPA
end
def font_name
return MoMo_M_Book_Comment::C_WINDOW_FONT_NAME
end
def font_color
return MoMo_M_Book_Comment::C_WINDOW_FONT_COLOR
end
end
module MoMo_M_Book_Comment
str = []
# str[エãƒãƒŸãƒ¼ID]
str[0] = <<-EOS #デフォ(コメント未è¨å®šæ™‚用ã€é€šå¸¸ã¯ä½¿ç”¨ã—ãªã„)
コメントãªï½žã—ï¼
EOS
str[1] = <<-EOS #ゴースト
Put your monster comment here!
EOS
str[2] = <<-EOS #ゴースト
Put your next monster comment here!
EOS
M_BOOK_COMMENT = str
end
See? Each number next to "str" is your monster's number in the database. To call the beastiary, use this in an event:
Code:
$scene = Scene_MonsterBook.new
Also, to change the name of the Beastiary, just go to Line 468 in the first script, and change the words in quotes to whatever you want.
That's about it! You can post questions on this here! I must have some kind of coding angel or something, cause I can't script for beans, and I figured out this thing! Even I don't know how I did it! If I forgot anything, I'm sorry. This is the first script I've posted.