*Evented Page Conditions
Version: 1.0
Author: Night_Runner
Release Date: 27 May 2012
Platform: RPG Maker VX Ace
Exclusive Script at RPG RPG Revolution
Introduction
This script allows developers to use condional branches to set whether an event's page should be active.
In my second screenshot I show how a developer could allow/disallow a page based on the conditional branch, which checks if a short sword is in the party's inventory.
Features
By using the event's commands to set whether a page should be active allows much more control over development, and makes the events flow a lot nicer.
A lot of the features added through this script could easily be implemented with events, but this script is designed to minimise the lag that could be created through eventing, and would save on a lot of switches/variables, keeping the switch/variable lists cleaner.
NOTE
There are two conditional branches that I do not update the events for, the first being the enemy (their state or whatever) since this script can't be run during battle, and second being the direction of the player/event, because it would take too much processing to reset the event's page every time the player turns.
Script
CODE
#==============================================================================
# ** VXAce: Night_Runner's Evented Page Conditions
#------------------------------------------------------------------------------
# History:
# Date Created: 27/May/2012
# Inspired by: Tsukihime's Scripted event page conditions
# @>http://www.rpgrevolution.com/forums/index.php?showtopic=56516
# Script Posted:
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=56520
#
# Description:
# This script allows developers to use condional branches to set whether an
# event's page should be active.
#
# How to Install:
# Highlight and copy the entire script.
# In your game's editor, select Tools >> Script Editor.
# Along the left hand side scroll to the bottom, right click on after
# 'Materials' and select 'Insert'.
# Paste in the blank window on the right.
#
# How to Use:
# See the screenshots attached.
#==============================================================================
#==============================================================================
# ** Game_Timer
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Timer
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_update update unless $@
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update(*args)
# Get the count at the start of the event
count_at_start = @count
# Run the original update
nr_cusCond_update(*args)
# If the counter has changed
fr = Graphics.frame_rate
# Note the divide operation takes a lot of time, so we have this check
# without the divide first to try and reduce wasted processing
# This will reduce wastage when the count is not active
if count_at_start != @count
if (count_at_start / fr) != (@count / fr)
on_change
end
end
end
#--------------------------------------------------------------------------
# * Processing When the Time Changes
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_refresh refresh unless $@
alias nr_cusCond_learn_skill learn_skill unless $@
alias nr_cusCond_forget_skill forget_skill unless $@
alias nr_cusCond_change_class change_class unless $@
#--------------------------------------------------------------------------
# * Set Name
#--------------------------------------------------------------------------
def name=(*args)
# Apply the name
@name = args
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(*args)
# Run the original refresh
nr_cusCond_refresh(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Learn Skill
#--------------------------------------------------------------------------
def learn_skill(*args)
# Run the original learn_skill
nr_cusCond_learn_skill(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Forget Skill
#--------------------------------------------------------------------------
def forget_skill(*args)
# Run the original forget_skill
nr_cusCond_forget_skill(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Change Class
#--------------------------------------------------------------------------
def change_class(*args)
# Run the original change_class
nr_cusCond_change_class(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_add_actor add_actor unless $@
alias nr_cusCond_remove_actor remove_actor unless $@
alias nr_cusCond_gain_gold gain_gold unless $@
alias nr_cusCond_lose_gold lose_gold unless $@
#--------------------------------------------------------------------------
# * Add an Actor
#--------------------------------------------------------------------------
def add_actor(*args)
# Run the original add_actor
nr_cusCond_add_actor(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Remove Actor
#--------------------------------------------------------------------------
def remove_actor(actor_id)
# Run the original remove_actor
nr_cusCond_remove_actor(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Increase Gold
#--------------------------------------------------------------------------
def gain_gold(*args)
# Run the original gain_gold
nr_cusCond_gain_gold(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Decrease Gold
#--------------------------------------------------------------------------
def lose_gold(*args)
# Run the original gain_gold
nr_cusCond_lose_gold(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Vehicle
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_get_on get_on unless $@
alias nr_cusCond_get_off get_off unless $@
#--------------------------------------------------------------------------
# * Board Vehicle
#--------------------------------------------------------------------------
def get_on
# Run the original get_on
nr_cusCond_get_on(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Get Off Vehicle
#--------------------------------------------------------------------------
def get_off
# Run the original get_off
nr_cusCond_get_off(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# Edited to allow checking the conditions using the event.
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_conditions_met? conditions_met? unless $@
#--------------------------------------------------------------------------
# * Determine if Event Page Conditions Are Met
#--------------------------------------------------------------------------
def conditions_met?(page, *args)
# If the event is looking to use this script
if page.list.inspect.include?("reject_page")
# Create the interpreter, set it up, and test
interpreter = Game_Interpreter.new
interpreter.setup(page.list, @event.id)
interpreter.cusCond_execute
# If the page should be used
if interpreter.cosCond_use_page == true
return true
# If the page should not be used
elsif interpreter.cosCond_use_page == false
return false
end
# If undecided, run the original conditions_met?
end
# Run the original conditions_met?
return nr_cusCond_conditions_met?(page, *args)
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# Edited to allow executing the event, to check if the conditions are met
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :cosCond_use_page
#--------------------------------------------------------------------------
# * Use Event
#--------------------------------------------------------------------------
def use_page
# If we are not testing the event, do nothing
return if @cusCond_testing_event != true
# Let the Game_Event know that the conditions are met
@cosCond_use_page = true
@index = @list.size
end
#--------------------------------------------------------------------------
# * Reject Page
#--------------------------------------------------------------------------
def reject_page
# If we are not testing the event, do nothing
return if @cusCond_testing_event != true
# Let the Game_Event know that the conditions are NOT met
@cosCond_use_page = false
@index = @list.size
end
#--------------------------------------------------------------------------
# * Execute
#--------------------------------------------------------------------------
def cusCond_execute
# Default to not using the page (if use_page and reject page are not found)
@cosCond_use_page = false
# Set a flag, we are testing the starting conditions
@cusCond_testing_event = true
# Loop through running the page
while @list[@index] do
execute_command
@index += 1
end
# Disable the 'testing conditions' flag (for completeness)
@cusCond_testing_event = false
end
end
#==============================================================================
# ** End of Script.
#==============================================================================
# ** VXAce: Night_Runner's Evented Page Conditions
#------------------------------------------------------------------------------
# History:
# Date Created: 27/May/2012
# Inspired by: Tsukihime's Scripted event page conditions
# @>http://www.rpgrevolution.com/forums/index.php?showtopic=56516
# Script Posted:
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=56520
#
# Description:
# This script allows developers to use condional branches to set whether an
# event's page should be active.
#
# How to Install:
# Highlight and copy the entire script.
# In your game's editor, select Tools >> Script Editor.
# Along the left hand side scroll to the bottom, right click on after
# 'Materials' and select 'Insert'.
# Paste in the blank window on the right.
#
# How to Use:
# See the screenshots attached.
#==============================================================================
#==============================================================================
# ** Game_Timer
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Timer
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_update update unless $@
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update(*args)
# Get the count at the start of the event
count_at_start = @count
# Run the original update
nr_cusCond_update(*args)
# If the counter has changed
fr = Graphics.frame_rate
# Note the divide operation takes a lot of time, so we have this check
# without the divide first to try and reduce wasted processing
# This will reduce wastage when the count is not active
if count_at_start != @count
if (count_at_start / fr) != (@count / fr)
on_change
end
end
end
#--------------------------------------------------------------------------
# * Processing When the Time Changes
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_refresh refresh unless $@
alias nr_cusCond_learn_skill learn_skill unless $@
alias nr_cusCond_forget_skill forget_skill unless $@
alias nr_cusCond_change_class change_class unless $@
#--------------------------------------------------------------------------
# * Set Name
#--------------------------------------------------------------------------
def name=(*args)
# Apply the name
@name = args
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(*args)
# Run the original refresh
nr_cusCond_refresh(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Learn Skill
#--------------------------------------------------------------------------
def learn_skill(*args)
# Run the original learn_skill
nr_cusCond_learn_skill(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Forget Skill
#--------------------------------------------------------------------------
def forget_skill(*args)
# Run the original forget_skill
nr_cusCond_forget_skill(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Change Class
#--------------------------------------------------------------------------
def change_class(*args)
# Run the original change_class
nr_cusCond_change_class(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_add_actor add_actor unless $@
alias nr_cusCond_remove_actor remove_actor unless $@
alias nr_cusCond_gain_gold gain_gold unless $@
alias nr_cusCond_lose_gold lose_gold unless $@
#--------------------------------------------------------------------------
# * Add an Actor
#--------------------------------------------------------------------------
def add_actor(*args)
# Run the original add_actor
nr_cusCond_add_actor(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Remove Actor
#--------------------------------------------------------------------------
def remove_actor(actor_id)
# Run the original remove_actor
nr_cusCond_remove_actor(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Increase Gold
#--------------------------------------------------------------------------
def gain_gold(*args)
# Run the original gain_gold
nr_cusCond_gain_gold(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Decrease Gold
#--------------------------------------------------------------------------
def lose_gold(*args)
# Run the original gain_gold
nr_cusCond_lose_gold(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
# Edited to refresh the map when certain actions occur.
#==============================================================================
class Game_Vehicle
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_get_on get_on unless $@
alias nr_cusCond_get_off get_off unless $@
#--------------------------------------------------------------------------
# * Board Vehicle
#--------------------------------------------------------------------------
def get_on
# Run the original get_on
nr_cusCond_get_on(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Get Off Vehicle
#--------------------------------------------------------------------------
def get_off
# Run the original get_off
nr_cusCond_get_off(*args)
# Update for the changes
on_change
end
#--------------------------------------------------------------------------
# * Processing When Changes Occur
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# Edited to allow checking the conditions using the event.
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_cusCond_conditions_met? conditions_met? unless $@
#--------------------------------------------------------------------------
# * Determine if Event Page Conditions Are Met
#--------------------------------------------------------------------------
def conditions_met?(page, *args)
# If the event is looking to use this script
if page.list.inspect.include?("reject_page")
# Create the interpreter, set it up, and test
interpreter = Game_Interpreter.new
interpreter.setup(page.list, @event.id)
interpreter.cusCond_execute
# If the page should be used
if interpreter.cosCond_use_page == true
return true
# If the page should not be used
elsif interpreter.cosCond_use_page == false
return false
end
# If undecided, run the original conditions_met?
end
# Run the original conditions_met?
return nr_cusCond_conditions_met?(page, *args)
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# Edited to allow executing the event, to check if the conditions are met
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :cosCond_use_page
#--------------------------------------------------------------------------
# * Use Event
#--------------------------------------------------------------------------
def use_page
# If we are not testing the event, do nothing
return if @cusCond_testing_event != true
# Let the Game_Event know that the conditions are met
@cosCond_use_page = true
@index = @list.size
end
#--------------------------------------------------------------------------
# * Reject Page
#--------------------------------------------------------------------------
def reject_page
# If we are not testing the event, do nothing
return if @cusCond_testing_event != true
# Let the Game_Event know that the conditions are NOT met
@cosCond_use_page = false
@index = @list.size
end
#--------------------------------------------------------------------------
# * Execute
#--------------------------------------------------------------------------
def cusCond_execute
# Default to not using the page (if use_page and reject page are not found)
@cosCond_use_page = false
# Set a flag, we are testing the starting conditions
@cusCond_testing_event = true
# Loop through running the page
while @list[@index] do
execute_command
@index += 1
end
# Disable the 'testing conditions' flag (for completeness)
@cusCond_testing_event = false
end
end
#==============================================================================
# ** End of Script.
#==============================================================================
Customization
N/A
Compatibility
This script is designed to be compatible with all known scripts currently available for RPG Maker VX Ace
Screenshot
[Show/Hide] Screenshots
DEMO
http://min.us/m3hiuxyhX
*Installation Instructions
CODE
# How to Install:
# Highlight and copy the entire script.
# In your game's editor, select Tools >> Script Editor.
# Along the left hand side scroll to the bottom, right click on after
# 'Materials' and select 'Insert'.
# Paste in the blank window on the right.
# Highlight and copy the entire script.
# In your game's editor, select Tools >> Script Editor.
# Along the left hand side scroll to the bottom, right click on after
# 'Materials' and select 'Insert'.
# Paste in the blank window on the right.
FAQ
Ask away
Terms and Conditions
Use as you see fit.
Credits are appreciated, but not necessary
Credits
Tsukihime's Scripted event page conditions for the inspiration
http://www.rpgrevolution.com/forums/index....showtopic=56516

