Super Simple Journal - V2
I agree this needs to be simplified a bit. - Brewmeister (in response to feedback & excessive support requests)
Changes:
* You only need to edit the list of tasks. The scripts will figure out the rest.
* Added a callback so you can use this from the menu, or from the map with the "Q" key
You will return to the map or menu from whence you came.
* Added @offset near tasks, to make it easier to specify a starting switch other than 1.
* Include separate Menu & Map mods so you don't have to edit any default scripts
* Added an option to use a custom windowskin for your journal
Introduction
If you want a very simple journal, this is the script for you. This script creates a new journal screen for you that contains a list of quests that your character needs to complete. The player can scroll through the list, and that's it. You define your journal entries in the script, and then use switches to turn the entries on and off in your game. Easy!
Create Window_Journal
In this section, we will create the journal and its window.
1. Open your game and script editor. ( Tools -> Script Editor, Script Editor Icon, or F11 )
2. Right-Click on Main, and select Insert
2. In the name box, type Window_Journal
3. In the code page (right side), copy & paste the following script:
Remember to turn off line numbers before using the "Select All" button!
Create Scene_Journal
In this section, we will create the scene that will contain our journal window. The scene determines where the journal window will appear to users and what happens when keys are pressed.
1. Open your script editor.
2. Add a new script called Scene_Journal below Window_Journal (above Main) in your script list.
3. In Scene_Journal, add the following code:
Create Scene_Menu_Mods (optional)
In this section, we will add Journal to the main menu. It will appear after Status.
1. Open your script editor.
2. Add a new script called Scene_Menu_Mods below Scene_Journal (above Main) in your script list.
3. In Scene_Menu_Mods, add the following code:
Create Scene_Map_Mods (optional)
In this section, we will add a script to enable using the "Q" key to open the journal
1. Open your script editor.
2. Add a new script called Scene_Map_Mods below Scene_Menu_Mods (above Main) in your script list.
3. In Scene_Map_Mods, add the following code:
Create Journal Entries
Now that you have your Journal set up, you need to add journal entries to it.
1. Go to your Window_Journal script.
2. Find this section:
@data[1] = "Task 1"
@data[2] = "Task 2"
@data[3] = "Task 3"
3. Replace the tasks with your own. For example:
@data[1] = "Find treasure for Jake"
@data[2] = "Get milk for Ma"
@data[3] = "Destroy the world"
Name your Journal Switches
Now that your journal entries are added to your journal, you turn them on and off with switches.
Let's name our switches so we can find them easily while making our game.
Note: The number assigned to each data entry needs to match the number assigned to each switch. For example, @data[2] = "Get milk for Ma" is turned on/off with switch 0002: Help Ma.
1. Add a new event to one of your maps.
2. Open the Event Commands window.
3. Click Control Switches, select the arrow next to Single and add the following by selecting each switch number, and typing in a name below:
0001: Help Jake
0002: Help Ma
0003: Destroy World
4. You can delete this event if you're not using it. Or leave it for an event you'll use. We just used it to add names to the switches.
Turn Entries On and Off
To turn entries on and off, simply turn the journal switches on or off in the Event Command window for an event on the map.
How do I add more journal entries?
To add new journal entries, you need to update your list of switches and your list of journal entires in Window_Journal.
1. Open the Window_Journal script and add another entry to the data[] array. for example, data[4] = "Save the world"
4. Exit the script editor, and open an event on your map. Add a new switch for the journal entry. (for example, 0004: Save World)
I don't want to start with switch 1
If you don't want to start your journal entry with switch 1, simply adjust the @offset variable in Window_Journal as follows:
Note: The following code assumes that you are starting at switch 100 instead of 1.
@offset = 99
I want to use a different windowskin for my journal
You can use a custom windowskin just for your journal window. For example, a parchment or book page, or just a different style of windowskin. You will need to make & place your custom windowskin in the GraphicsWindowskins folder in you project.
1) Right below the @offset variable, uncomment (delete the # sign) the following line:
self.windowskin = RPG::Cache.windowskin("RMXP4life_Wood.png")
2) Change the "RMXP4life_Wood.png" to the name of your custom windowskin.
Enjoy!
And let me know if anything can be explained better, or doesn't work like it should.
I agree this needs to be simplified a bit. - Brewmeister (in response to feedback & excessive support requests)
Changes:
* You only need to edit the list of tasks. The scripts will figure out the rest.
* Added a callback so you can use this from the menu, or from the map with the "Q" key
You will return to the map or menu from whence you came.
* Added @offset near tasks, to make it easier to specify a starting switch other than 1.
* Include separate Menu & Map mods so you don't have to edit any default scripts
* Added an option to use a custom windowskin for your journal
Introduction
If you want a very simple journal, this is the script for you. This script creates a new journal screen for you that contains a list of quests that your character needs to complete. The player can scroll through the list, and that's it. You define your journal entries in the script, and then use switches to turn the entries on and off in your game. Easy!
Create Window_Journal
In this section, we will create the journal and its window.
1. Open your game and script editor. ( Tools -> Script Editor, Script Editor Icon, or F11 )
2. Right-Click on Main, and select Insert
2. In the name box, type Window_Journal
3. In the code page (right side), copy & paste the following script:
Remember to turn off line numbers before using the "Select All" button!
Code:
#==========================================================================
# Window_Journal
#------------------------------------------------------------------------------
# This window displays a journal.
#==========================================================================
class Window_Journal < Window_Selectable
# ------------------------
def initialize
super(0, 32, 460, 330)
#----------------------------------------------------------
# populate your journal with entries.
@data = []
@data[1] = "Help Man"
@data[2] = "Kill Chicken"
@data[3] = "Make cow eat"
@data[4] = "Sniff the Glove"
@data[5] = "Jump off a bridge after your friends"
# this is the offset for your switches. If you start with switch 100, set
# @offset = 99
@offset = 0
### to change the windowskin for the journal
# self.windowskin = RPG::Cache.windowskin("RMXP4life_Wood.png")
#----------------------------------------------------------
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Draw the contents of the item window
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# variables
@journal_height = (@data.size - 1)*32 # y coord of entire journal (# of entries - 1) * 32
@n = 0 # y coord for each entry
@item_max = 0 # max items to display
# draw the bitmap. the text will appear on this bitmap
self.contents = Bitmap.new(width - 32, @journal_height)
for i in [email=1...@data.size]1...@data.size[/email]
if $game_switches[i + @offset] == true
draw_item(i)
@item_max += 1
end
end
end
#--------------------------------------------------------------------------
# * Draw an individual item in the window
# index : Index of the item to be drawn
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = Rect.new(10, @n, 640, 32)
self.contents.fill_rect(rect, Color.new(0,0,0,0))
self.contents.draw_text(10, @n, 640, 32, "●", 0)
self.contents.draw_text(25, @n, 640, 32, item, 0)
@n += 32
end
end
Create Scene_Journal
In this section, we will create the scene that will contain our journal window. The scene determines where the journal window will appear to users and what happens when keys are pressed.
1. Open your script editor.
2. Add a new script called Scene_Journal below Window_Journal (above Main) in your script list.
3. In Scene_Journal, add the following code:
Code:
#==============================================================================
# Scene_Status
#------------------------------------------------------------------------------
# This class contains the windows for the character status menu that can be
# accessed from the main menu.
#==========================================================================
class Scene_Journal
#--------------------------------------------------------------------------
# Initialize the Status menu
#--------------------------------------------------------------------------
def initialize(callback = 0) #callback from menu
@callback = callback
end
def main
@journal_window = Window_Journal.new
@journal_window.x = 90
@journal_window.y = 70
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@journal_window.dispose
end
#--------------------------------------------------------------------------
# Draw the Status menu
#--------------------------------------------------------------------------
def update
@journal_window.update
if @journal_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# Update menu after player makes a selection
#--------------------------------------------------------------------------
def update_item
# Cancel key pressed (go to menu)
if Input.trigger?(Input::B) or Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
if @callback == 0
$scene = Scene_Menu.new(4)
else
$scene = Scene_Map.new
end
return
end
end
end
Create Scene_Menu_Mods (optional)
In this section, we will add Journal to the main menu. It will appear after Status.
1. Open your script editor.
2. Add a new script called Scene_Menu_Mods below Scene_Journal (above Main) in your script list.
3. In Scene_Menu_Mods, add the following code:
Code:
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Journal"
s6 = "Save"
s7 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 256
@playtime_window.height = 96
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 352
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@gold_window.height = 64
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # journal
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to journal scene
$scene = Scene_Journal.new
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
end
#=============================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#=============================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 50, 32, "Steps")
self.contents.font.color = normal_color
self.contents.draw_text(50, 0, 78, 32, $game_party.steps.to_s, 2)
end
end
Create Scene_Map_Mods (optional)
In this section, we will add a script to enable using the "Q" key to open the journal
1. Open your script editor.
2. Add a new script called Scene_Map_Mods below Scene_Menu_Mods (above Main) in your script list.
3. In Scene_Map_Mods, add the following code:
Code:
class Scene_Map
alias journal_update update
def update
journal_update
if Input.trigger?(Input::L)
$scene = Scene_Journal.new(1)
end
end
end
Create Journal Entries
Now that you have your Journal set up, you need to add journal entries to it.
1. Go to your Window_Journal script.
2. Find this section:
@data[1] = "Task 1"
@data[2] = "Task 2"
@data[3] = "Task 3"
3. Replace the tasks with your own. For example:
@data[1] = "Find treasure for Jake"
@data[2] = "Get milk for Ma"
@data[3] = "Destroy the world"
Name your Journal Switches
Now that your journal entries are added to your journal, you turn them on and off with switches.
Let's name our switches so we can find them easily while making our game.
Note: The number assigned to each data entry needs to match the number assigned to each switch. For example, @data[2] = "Get milk for Ma" is turned on/off with switch 0002: Help Ma.
1. Add a new event to one of your maps.
2. Open the Event Commands window.
3. Click Control Switches, select the arrow next to Single and add the following by selecting each switch number, and typing in a name below:
0001: Help Jake
0002: Help Ma
0003: Destroy World
4. You can delete this event if you're not using it. Or leave it for an event you'll use. We just used it to add names to the switches.
Turn Entries On and Off
To turn entries on and off, simply turn the journal switches on or off in the Event Command window for an event on the map.
How do I add more journal entries?
To add new journal entries, you need to update your list of switches and your list of journal entires in Window_Journal.
1. Open the Window_Journal script and add another entry to the data[] array. for example, data[4] = "Save the world"
4. Exit the script editor, and open an event on your map. Add a new switch for the journal entry. (for example, 0004: Save World)
I don't want to start with switch 1
If you don't want to start your journal entry with switch 1, simply adjust the @offset variable in Window_Journal as follows:
Note: The following code assumes that you are starting at switch 100 instead of 1.
@offset = 99
I want to use a different windowskin for my journal
You can use a custom windowskin just for your journal window. For example, a parchment or book page, or just a different style of windowskin. You will need to make & place your custom windowskin in the GraphicsWindowskins folder in you project.
1) Right below the @offset variable, uncomment (delete the # sign) the following line:
self.windowskin = RPG::Cache.windowskin("RMXP4life_Wood.png")
2) Change the "RMXP4life_Wood.png" to the name of your custom windowskin.
Enjoy!
And let me know if anything can be explained better, or doesn't work like it should.