Hello guys, I need help with some script issue (RPG XP). Since most of the scripts of ForeverZer0 are posted here, I am going to post it here. Its about ForeverZer0's Journal script.
His script allows to create journals about characters, items, weapons etc. You can also set pictures for each subject. For example for the entry aluxes (main character) you can set a picture that will be displayed. And heres what bothers me.
Below theres an example. I want to make a picture (A picture for a entry) displayed that will go completly over the windowskin. however the windowskin dont let the picture go beyond it.
My example picture (its the red square) was 640x480, then I made smaller, tried all sizes but the picture just wont go over the invisible boundaries that seem to be configurated in the script. Can anybode edit the code, so that the picture will be displayed completly without any boundaries that hides it.
I want the script to let the picture cover the whole windowskin area. But something blocks it.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = true
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = true
AUTO_ARMORS = true
AUTO_ITEMS = true
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
when 3 then ['Iowa', 'Who cares...']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
when 3
'A boring state.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = true
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['People'].include?(id)
$game_system.journal['People'].push(id)
$game_system.journal['People'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['Places'].include?(id)
$game_system.journal['Places'].push(id)
$game_system.journal['Places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['People'].delete(id)
$game_system.journal['People'].sort!
end
def self.delete_location(id)
$game_system.journal['Places'].delete(id)
$game_system.journal['Places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'People'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'Places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['None'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words}").width > width
result.push(current_text)
current_text = words
else
current_text = "#{current_text} #{words}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
@type = ''
end
def id=(id)
@id = id
refresh
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'People'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'Places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
if pic != nil
rect = Rect.new(0, 0, pic.width, pic.height)
self.contents.blt(self.width-pic.width-64, 32, pic, rect)
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats)}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info)}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio)}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
window.visible = window.active = false
window.height = 480
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@journal_window = Window_Journal.new
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
elsif Input.trigger?(Input::C)
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
(http://fs5.directupload.net/images/161026/temp/edi7ca32.png) (http://www.directupload.net/file/d/4520/edi7ca32_png.htm)
*puts script in code tags*
In that case, you're better off making the window transparent and drawing the image behind the window. Due to the way RMXP draws its windows, drawing a picture IN IT won't work out to your liking.
I can probably whip something up quick by tomorrow.
To be honest, I dont want a windowskin to be shown. I want to use a picture instead of a windowskin which will be displayed. In my testproject I made the windowskin transparent by setting the opacity to 0 since I dont know how to erase the windowskin. Im not a scripter T_T. And this was my first edit.
I used
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture("70")
to make display a picture instead of a window. That one picture acts as the display for the whole journal. And thats the way I want it. But my edit was coded in a very noobie way.
I only took the default script from him not to confuse people.
Could you also make it possible for me to choose a picture instead of a windowskin?
Because my edit is so pretty much noobie, Im not even going to post it...
So I'm just trying to understand everything here.
You want the right window to not show any windowskin at all.
In this case, are all pictures going to be this big? Or do you just want a background image?
Can you give me a dirty Microsoft Paint (or whatever art program) mock-up of what an entry looks like?
Yes. I want to use a background picture instead of the windowskin. But:
The red square I was talking about was not the background image. It was about the pictures that can be set for each entry. Like for the entry Aluxes it would be a picture of him. But sadly I want the image to cover the whole area which is currently not possible.
I've two images below.
One is the standard menu and a entry. And the second is the display picture for the entry aluxes which doesnt cover the whole area. My actual problem.
http://www.directupload.net](http://fs5.directupload.net/images/161027/prktptce.png)[/URL]
(http://fs5.directupload.net/images/161026/temp/edi7ca32.png) (http://www.directupload.net/file/d/4520/edi7ca32_png.htm)
Well that didn't really answer my question entirely.
So all I did was just made the journal window's back_opacity zero and created a Sprite object behind it. In its current state, this assumes all your images are the same size as the entry window.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = false
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = true
AUTO_ARMORS = true
AUTO_ITEMS = true
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
when 3 then ['Iowa', 'Who cares...']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
when 3
'A boring state.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = true
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['People'].include?(id)
$game_system.journal['People'].push(id)
$game_system.journal['People'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['Places'].include?(id)
$game_system.journal['Places'].push(id)
$game_system.journal['Places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['People'].delete(id)
$game_system.journal['People'].sort!
end
def self.delete_location(id)
$game_system.journal['Places'].delete(id)
$game_system.journal['Places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'People'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'Places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['None'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 0
@type = ''
@journal_pic = Sprite.new
@journal_pic.z = self.z - 100
@journal_pic.x, @journal_pic.y = self.x, self.y
end
def id=(id)
@id = id
refresh
end
alias dispose_picture dispose
def dispose
@journal_pic.bitmap.dispose if @journal_pic.bitmap
@journal_pic.dispose
dispose_picture
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'People'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'Places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
@journal_pic.bitmap = nil
if pic != nil
@journal_pic.bitmap = pic
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
window.visible = window.active = false
window.height = 480
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@journal_window = Window_Journal.new
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
@dummy_window.visible = true
elsif Input.trigger?(Input::C)
@dummy_window.visible = false
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
Well that was everything I asked for. Thanks.
Theres only one issue that im facing. If I select on a entry and go back to select a "none" entry I get the image of the entry which I viewed last.
Also, for some reasons, Items wont show up on the journal even when I use commands like Journal.add_item(1)
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = false
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = true
AUTO_ARMORS = true
AUTO_ITEMS = true
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
when 3 then ['Iowa', 'Who cares...']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
when 3
'A boring state.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = false
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['People'].include?(id)
$game_system.journal['People'].push(id)
$game_system.journal['People'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['Places'].include?(id)
$game_system.journal['Places'].push(id)
$game_system.journal['Places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['People'].delete(id)
$game_system.journal['People'].sort!
end
def self.delete_location(id)
$game_system.journal['Places'].delete(id)
$game_system.journal['Places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'People'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'Places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['None'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 0
@type = ''
@journal_pic = Sprite.new
@journal_pic.z = self.z - 100
@journal_pic.x, @journal_pic.y = self.x, self.y
end
def id=(id)
@id = id
refresh
end
alias dispose_picture dispose
def dispose
@journal_pic.bitmap.dispose if @journal_pic.bitmap
@journal_pic.dispose
dispose_picture
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'People'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'Places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
@journal_pic.bitmap = nil
if pic != nil
@journal_pic.bitmap = pic
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
@no_entries = []
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
if $game_system.journal_entries(key) == ['None']
@no_entries.push(key)
end
window.visible = window.active = false
window.height = 480
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@journal_window = Window_Journal.new
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
$game_system.se_play($data_system.decision_se)
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
@dummy_window.visible = true
elsif Input.trigger?(Input::C)
if @no_entries.include?(Journal::LIST_ORDER[@index])
$game_system.se_play($data_system.buzzer_se)
return
end
@dummy_window.visible = false
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
I don't see what's wrong with adding journal entries. Did you configure your entries correctly?
I didint change the configuration at all, I used the standard script, now Im using your edited code below. Even if I have items thru the command "Journal.add_item(1)" the names of the items wont show up. I think the script does display the items but I cant see their names. And I can select them. Also if I own 0 items, the "noone" text doesnt show up like in the other sections.
Heres his original code:
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = true
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = true
AUTO_ARMORS = true
AUTO_ITEMS = true
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
when 3 then ['Iowa', 'Who cares...']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
when 3
'A boring state.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = true
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['People'].include?(id)
$game_system.journal['People'].push(id)
$game_system.journal['People'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['Places'].include?(id)
$game_system.journal['Places'].push(id)
$game_system.journal['Places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['People'].delete(id)
$game_system.journal['People'].sort!
end
def self.delete_location(id)
$game_system.journal['Places'].delete(id)
$game_system.journal['Places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'People'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'Places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['None'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
@type = ''
end
def id=(id)
@id = id
refresh
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'People'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'Places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
if pic != nil
rect = Rect.new(0, 0, pic.width, pic.height)
self.contents.blt(self.width-pic.width-64, 32, pic, rect)
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
window.visible = window.active = false
window.height = 480
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@journal_window = Window_Journal.new
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
elsif Input.trigger?(Input::C)
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
Your understanding of the script is completely off from what it does.
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
For this, it's expected that you do something like
def self.item_info(id)
text = case id
when 1 then ['Potion', 'Shop']
when 2 then ['High Potion', 'Shop']
when 3 then ['Full Potion', 'Shop']
end
end
You have to provide the information; it's not getting it from your database.
But I understand that this seems pretty tedious and pointless. This script can be heavily improved upon, but considering this was one of F0's first scripts, it's understandable why it is pretty rudimentary.
I think that part could be simplified with this.
def self.item_info(id)
item = $data_items[id]
return item.nil? ? [] : [item.name, item.description]
end
Same thing for
self.weapon_info(id) and
self.armor_info(id) def self.weapon_info(id)
weapon = $data_weapons[id]
return weapon.nil? ? [] : [weapon.name, weapon.description]
end
def self.armor_info(id)
armor = $data_armors[id]
return armor.nil? ? [] : [armor.name, armor.description]
end
now those parts above will get the information from your database
Right. But just pointing it out that the second item, which you think is the "description", is actually the "origin".
I actually suggest doing this instead:
def self.item_info(id)
return case id
when 1 then ['Another name for Potion', 'Some Dude in an Alley']
when 2 then ['Second Item Name', 'Some Unique Place']
else [$data_items[id].name, "Multiple Locations"]
end
end
def self.item_bio(id)
return case id
when 1
'A bottle containing blue liquid. Got it from some stranger I met in the city. Do you think it is even safe to drink this?'
when 2
'Some unique description'
else
$data_items[id].description
end
end
Allows for customization for certain things, but fail-safes on the default database.
Quote from: KK20 on October 28, 2016, 08:28:59 pm
Your understanding of the script is completely off from what it does.
def self.item_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
For this, it's expected that you do something like
def self.item_info(id)
text = case id
when 1 then ['Potion', 'Shop']
when 2 then ['High Potion', 'Shop']
when 3 then ['Full Potion', 'Shop']
end
end
You have to provide the information; it's not getting it from your database.
But I understand that this seems pretty tedious and pointless. This script can be heavily improved upon, but considering this was one of F0's first scripts, it's understandable why it is pretty rudimentary.
Oh your right, that solved the item issue. I thought that the name of the items are borrowed form the database which is not true. Well, anyone would think so :)
Theres one question. In addition to your edits above I've changed the complete windowskin with a fixed background image since this was my ultimate goal anway. But by doing that, I get the old problem where the image of the entry still is visible even when Im not in the entry anymore. The images should close when I deselect the entry. I tried changing the .Z here and there but got no proper results.
Only thing I did was to create a new sprite and set every command opacity to 0. I marked them with #edit1
Changed Line 499 - 538:
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
window.visible = window.active = false
window.height = 480
window.opacity = 0 #edit1
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
@command_window.opacity = 0 #edit1
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@dummy_window.opacity = 0 #edit1
@journal_window = Window_Journal.new
@journal_window.opacity = 0 #edit1
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
# Transition and start main loop for the scene.
@sprite = Sprite.new #edit1
@sprite.bitmap = RPG::Cache.picture("70") #edit1
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@sprite.bitmap.dispose #edit1
@sprite.dispose #edit1
#spriteset.dispose
@windows.each {|window| window.dispose}
end
And the complete script:
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = false
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = true
AUTO_ARMORS = true
AUTO_ITEMS = true
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
when 3 then ['Iowa', 'Who cares...']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
when 3
'A boring state.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['Potion', 'Shop']
when 2 then ['High Potion', 'Shop']
when 3 then ['Full Potion', 'Shop']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = false
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['People'].include?(id)
$game_system.journal['People'].push(id)
$game_system.journal['People'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['Places'].include?(id)
$game_system.journal['Places'].push(id)
$game_system.journal['Places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['People'].delete(id)
$game_system.journal['People'].sort!
end
def self.delete_location(id)
$game_system.journal['Places'].delete(id)
$game_system.journal['Places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'People'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'Places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['None'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 0
@type = ''
@journal_pic = Sprite.new
@journal_pic.z = self.z - 100
@journal_pic.x, @journal_pic.y = self.x, self.y
end
def id=(id)
@id = id
refresh
end
alias dispose_picture dispose
def dispose
@journal_pic.bitmap.dispose if @journal_pic.bitmap
@journal_pic.dispose
dispose_picture
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'People'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'Places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
@journal_pic.bitmap = nil
if pic != nil
@journal_pic.bitmap = pic
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
@no_entries = []
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
if $game_system.journal_entries(key) == ['None']
@no_entries.push(key)
end
window.visible = window.active = false
window.height = 480
window.opacity = 0 #edit1
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
@command_window.opacity = 0 #edit1
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@dummy_window.opacity = 0 #edit1
@journal_window = Window_Journal.new
@journal_window.opacity = 0 #edit1
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
@sprite = Sprite.new #edit1
@sprite.bitmap = RPG::Cache.picture("70") #edit1
@sprite.z = -1
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@sprite.bitmap.dispose #edit1
@sprite.dispose #edit1
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
$game_system.se_play($data_system.decision_se)
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
@dummy_window.visible = true
elsif Input.trigger?(Input::C)
if @no_entries.include?(Journal::LIST_ORDER[@index])
$game_system.se_play($data_system.buzzer_se)
return
end
@dummy_window.visible = false
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
Stick this method into class Window_Journal
alias pic_visible visible=
def visible=(bool)
@journal_pic.visible = bool if @journal_pic
pic_visible(bool)
end
Quote from: KK20 on October 29, 2016, 02:15:31 pm
Stick this method into class Window_Journal
alias pic_visible visible=
def visible=(bool)
@journal_pic.visible = bool if @journal_pic
pic_visible(bool)
end
Sorry, for not letting you rest, but how do I create a new section aside from the caracters, location, weapon, armors items?
I want to create the section Mythology where some of the games mythlogy is explained. But since it isnt in the datebase of RPG XP, it is different I guess.
The simple answer is that you can't. The current state of the script does not allow for more entries in an easily-customizable manner. This would require a script request.
Quote from: KK20 on November 11, 2016, 01:40:05 pm
The simple answer is that you can't. The current state of the script does not allow for more entries in an easily-customizable manner. This would require a script request.
Oh, damn, that script is very limited how it seems.
Btw. can you move this to script requests?
Sorry for double post, can you move this to script request then if it requieres a script request? And heres my current code:
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
# I wrote this script after seeing a request here on CP for something similar.
# It basically just allows the player to view a Journal that show the player
# information about people they have encountered and places they have visited.
# Can also log weapons, armors, and items.
#
# Features:
# - Easy to use/configure
# - Nice simple interface
# - Will log people, places, weapons, armors, and items seperately
# - Configurable what type of entries you would like to log.
# - Configurable layout
# - Option to use pictures
# - Fully compatible "stats" you want the system to display.
#
# Instructions:
# - Place script in the usual place.
# - All configuration is below, and explained in each section.
# - All pictures must be in folder labeled "Journal" within your game's
# Picture folder.
# - All you have to do is assign arbitrary "ids" to each person and location
# respectively. After you have completed configuration, when you want the
# person/place to be added to the Journal, use these script calls:
#
# Journal.add_character(ID)
# Journal.add_location(ID)
# Journal.add_weapon(ID)
# Journal.add_armor(ID)
# Journal.add_item(ID)
#
# You can also delete entries in the same way:
#
# Journal.delete_character(id)
# Journal.delete_location(id)
# Journal.delete_weapon(id)
# Journal.delete_armor(id)
# Journal.delete_item(id)
#
# Where the "ID" is the number you assigned to each.
# - To call the scene, use this script call:
#
# $scene = Scene_Journal.new
#
# - The script comes with a fix for those who like to use smaller text sizes
# (like myself), which will allow for more information to be displayed on
# the screen at once.
# - If you would like to change the look up a little bit, just change around
# the X and Y values in Window_Journal.
#
# Credits/Thanks:
# - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
module Journal
# If true, a line height of 20 pixels will be used, which looks better with
# smaller font sizes.
SMALL_TEXT = false
# The width of the entry list used for Scene_Journal. The other windows will
# automatically adjust to this width.
LIST_WIDTH = 192
# Define what aspects of the journal you would like to use. Choose from the
# values listed below and add them to the array. DO NOT change the values.
# Omit values for types you do not want to use.
# 'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
LIST_ORDER = ['characters', 'places', 'Weapons', 'Armors', 'Items']
# Configure if you would like for items, weapons, and armors to be unlocked
# automatically when they are first aquired by the player. If using this
# options, IDs MUST match the IDs used in the Database. You will also need to
# manually add anything the player begins with at game start.
AUTO_WEAPONS = false
AUTO_ARMORS = false
AUTO_ITEMS = false
#-------------------------------------------------------------------------------
CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.character_info(id)
info = case id
when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1
'Our everyday hero, that seems to make an appearance in every demo.'
when 2
'Random witch girl.'
when 3
'Another RPGXP character.'
end
return text != nil ? text : ''
end
#-------------------------------------------------------------------------------
LOCATION_STATS = ['Name:', 'Country:']
# Configure the values used for the above array for each location. Just make
# sure the value that corresponds to each stat is at the same index in the [].
# Just make sure that the first stat is the name, it will be used on the menu
# to select which character/location will be viewed.
def self.location_info(id)
info = case id
when 1 then ['New York', 'USA']
when 2 then ['Ohio', 'USA']
end
return info != nil ? info : []
end
# Short paragraph/description of location. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.location_bio(id)
return case id
when 1
'The state north of Pennsylvania.'
when 2
'The state west of Pennsylvania.'
else
''
end
end
#-------------------------------------------------------------------------------
WEAPON_STATS = ['Name:', 'Origin:']
def self.weapon_info(id)
text = case id
when 1 then ['Bronze Sword', 'Everywhere.']
when 2 then ['Iron Sword', 'Right here.']
when 3 then ['Mythril Sword', 'Blah blah.']
end
end
def self.weapon_bio(id)
return case id
when 1
'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
when 2
'Slighly better than the Bronze sword.'
when 3
'Yet another sword that is in almost every RPG.'
else
''
end
end
#-------------------------------------------------------------------------------
ARMOR_STATS = ['Name:', 'Origin:']
def self.armor_info(id)
text = case id
when 1 then ['', '']
when 2 then ['', '']
when 3 then ['', '']
end
end
def self.armor_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
ITEM_STATS = ['Name:', 'Origin:']
def self.item_info(id)
text = case id
when 1 then ['Potion', 'Shop']
when 2 then ['High Potion', 'Shop']
when 3 then ['Full Potion', 'Shop']
end
end
def self.item_bio(id)
return case id
when 1
''
when 2
''
when 3
''
else
''
end
end
#-------------------------------------------------------------------------------
# Set the following to true if you would loke pictures to be displayed for
# the respective type of Journal entries. They will be defined below.
CHARACTER_PIC = true
LOCATION_PIC = true
WEAPON_PIC = true
ARMOR_PIC = true
ITEM_PIC = false
# Filenames of character pictures.
def self.character_pic(id)
file = case id
when 1 then 'Aluxes'
when 2 then 'Hilda'
when 3 then 'Basil'
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of location pictures.
def self.location_pic(id)
file = case id
when 1 then ''
when 2 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.weapon_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filename of weapon pictures.
def self.armor_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
# Filenames of item pictures.
def self.item_pic(id)
file = case id
when 1 then ''
when 2 then ''
when 3 then ''
end
return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
end
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
def self.add_character(id)
unless $game_system.journal['characters'].include?(id)
$game_system.journal['characters'].push(id)
$game_system.journal['characters'].sort!
end
end
def self.add_location(id)
unless $game_system.journal['places'].include?(id)
$game_system.journal['places'].push(id)
$game_system.journal['places'].sort!
end
end
def self.add_weapon(id)
unless $game_system.journal['Weapons'].include?(id)
$game_system.journal['Weapons'].push(id)
$game_system.journal['Weapons'].sort!
end
end
def self.add_armor(id)
unless $game_system.journal['Armors'].include?(id)
$game_system.journal['Armors'].push(id)
$game_system.journal['Armors'].sort!
end
end
def self.add_item(id)
unless $game_system.journal['Items'].include?(id)
$game_system.journal['Items'].push(id)
$game_system.journal['Items'].sort!
end
end
def self.delete_character(id)
$game_system.journal['characters'].delete(id)
$game_system.journal['characterse'].sort!
end
def self.delete_location(id)
$game_system.journal['places'].delete(id)
$game_system.journal['places'].sort!
end
def self.delete_weapon(id)
$game_system.journal['Weapons'].delete(id)
$game_system.journal['Weapons'].sort!
end
def self.delete_armor(id)
$game_system.journal['Armors'].delete(id)
$game_system.journal['Armors'].sort!
end
def self.delete_item(id)
$game_system.journal['Items'].delete(id)
$game_system.journal['Items'].sort!
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
attr_accessor :journal
alias zer0_journal_init initialize
def initialize
zer0_journal_init
@journal = {}
Journal::LIST_ORDER.each {|key| @journal[key] = [] }
end
def journal_entries(type)
entries = []
case type
when 'characters'
@journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
when 'places'
@journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
when 'Weapons'
@journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
when 'Armors'
@journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
when 'Items'
@journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
end
return entries.empty? ? ['none'] : entries
end
end
#===============================================================================
# ** Game_Party
#===============================================================================
class Game_Party
alias zer0_auto_add_weapon gain_weapon
def gain_weapon(weapon_id, n)
# Unlock weapon ID if recieved.
if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
Journal.add_weapon(weapon_id)
end
zer0_auto_add_weapon(weapon_id, n)
end
alias zer0_auto_add_armor gain_armor
def gain_armor(armor_id, n)
# Unlock armor ID if recieved.
if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
Journal.add_armor(armor_id)
end
zer0_auto_add_armor(armor_id, n)
end
alias zer0_auto_add_item gain_item
def gain_item(item_id, n)
# Unlock item ID if recieved.
if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
Journal.add_item(item_id)
end
zer0_auto_add_item(item_id, n)
end
end
#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#===============================================================================
# ** Window_Journal
#===============================================================================
class Window_Journal < Window_Base
attr_accessor :type
def initialize
super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 0
@type = ''
@journal_pic = Sprite.new
@journal_pic.z = 1000 #@journal_pic.z = self.z - 100
@journal_pic.x, @journal_pic.y = self.x, self.y
end
def id=(id)
@id = id
refresh
end
alias dispose_picture dispose
def dispose
@journal_pic.bitmap.dispose if @journal_pic.bitmap
@journal_pic.dispose
dispose_picture
end
alias pic_visible visible=
def visible=(bool)
@journal_pic.visible = bool if @journal_pic
pic_visible(bool)
end
def refresh
self.contents.clear
return if @id == nil
# Set local variables, branching by what type is being viewed.
case @type
when 'characters'
stats = Journal::CHARACTER_STATS
info = Journal.character_info(@id)
bio = Journal.character_bio(@id)
pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
when 'places'
stats = Journal::LOCATION_STATS
info = Journal.location_info(@id)
bio = Journal.location_bio(@id)
pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
when 'Weapons'
stats = Journal::WEAPON_STATS
info = Journal.weapon_info(@id)
bio = Journal.weapon_bio(@id)
pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
when 'Armors'
stats = Journal::ARMOR_STATS
info = Journal.armor_info(@id)
bio = Journal.armor_bio(@id)
pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
when 'Items'
stats = Journal::ITEM_STATS
info = Journal.item_info(@id)
bio = Journal.item_bio(@id)
pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
end
width = 640 - Journal::LIST_WIDTH - 40
bio = self.contents.slice_text(bio, width)
@journal_pic.bitmap = nil
if pic != nil
@journal_pic.bitmap = pic
end
# Draw the values on the window's bitmap.
self.contents.font.color = system_color
y = Journal::SMALL_TEXT ? 20 : 32
stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
self.contents.draw_text(0, 320, 128, y, 'Description:')
self.contents.font.color = normal_color
info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}
end
end
#===============================================================================
# ** Scene_Journal
#===============================================================================
class Scene_Journal
#-------------------------------------------------------------------------------
def main
# Create lists of the entries for each Journal content type.
@entry_lists, @index = [], 0
@no_entries = []
# Create list of entry titles.
Journal::LIST_ORDER.each {|key|
next unless $game_system.journal.has_key?(key)
window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
if $game_system.journal_entries(key) == ['none']
@no_entries.push(key)
end
window.visible = window.active = false
window.height = 480
window.opacity = 0 #edit1
@entry_lists.push(window)
}
# Create main command window.
@command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
@command_window.height = 480
@command_window.opacity = 0 #edit1
# Create main window for viewing information and dummy window.
@dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
@dummy_window.opacity = 0 #edit1
@journal_window = Window_Journal.new
@journal_window.opacity = 0 #edit1
@windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
@sprite = Sprite.new #edit1
@sprite.bitmap = RPG::Cache.picture("70") #edit1
@sprite.z = -1
# Transition and start main loop for the scene.
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
# Dispose all windows and prepare for transition.
Graphics.freeze
@sprite.bitmap.dispose #edit1
@sprite.dispose #edit1
@windows.each {|window| window.dispose}
end
#-------------------------------------------------------------------------------
def update
# Update all the windows.
@windows.each {|window| window.update }
# Branch update method depending on what window is active.
@command_window.active ? update_command : update_entry_selection
end
#-------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Deactivate command window and make selected entry list active.
$game_system.se_play($data_system.decision_se)
@index = @command_window.index
@command_window.active = @command_window.visible = false
@entry_lists[@index].active = @entry_lists[@index].visible = true
end
end
#-------------------------------------------------------------------------------
def update_entry_selection
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# Deactivate entry list and make command window active.
@command_window.active = @command_window.visible = true
@entry_lists[@index].active = @entry_lists[@index].visible = false
@journal_window.visible = false
@dummy_window.visible = true
elsif Input.trigger?(Input::C)
if @no_entries.include?(Journal::LIST_ORDER[@index])
$game_system.se_play($data_system.buzzer_se)
return
end
@dummy_window.visible = false
@journal_window.visible = true
$game_system.se_play($data_system.decision_se)
type = Journal::LIST_ORDER[@index]
# Set the type and id variables for the journal window and refresh.
@journal_window.type = type
@journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
end
end
end
BUMP
BUMP
Long time no Bump^^
I'm surprised you're still persistent with this. Given I'm the only active support scripter here, and I haven't responded in a couple months, chances are I'm not going to do it.
Thanks for your reply at least.
Well, yes, I dont expect anybody to help me because I dont pay anyone to do it, apart from those who are volunteers.
I didint know that you're the only active supporter, I read some topics and some others commenting.
And my request isnt specific to you.
Yeah the other members have pretty much retired from RPG Maker, so the only support they can give is general answers to basic questions or their own scripts. When it comes to script requests, like this, I'm the only one who does them. And it's been like this for like the past 5 years since I joined.
Can't you just find another script that is similar?
Oh okay, if thats the case...
btw: I choose this script after not finding anything similar to what I was looking for. It was what I was looking for and it was simple.
I hardly doubt that there are much choices.