Call Common Event by Variable
Version: 1.0
Author: modern algebra
Date: September 8, 2008
Version History
- <Version 1.0> 09/08/08 - Original Release
Description
This script allows you to call a common event by setting a variable to its ID.
Features
- Uses an in-game variable of your choosing to control common event calls
- Can call common events by setting your control variable to the ID of a common event. Very useful for a number of Event systems.
Screenshots
N/A for this kind of scriptlet
Instructions
See inside Script Header.
Script
#==============================================================================
# Call Common Event by Variable
# Version 1.0
# Author: modern algebra
# Date: September 8, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# First, go down to line 36 and set the constant, COMMON_EVENT_VARIABLE_ID.
# Basically, just set it to the ID of the variable that you want to control
# what common event is called. So, if you set it to 20, as it is right now,
# then that means that Variable 20 will control what common event is called
# when you run the Call Common Event command. So, basically, if Variable 20
# is set to 15 and then you Call Common Event, it will call Common Event 15
# regardless of what you put into the actual parameter field of the Call
# Common Event event command. If the variable is set to 0 or less, then it
# will abide by the normal rules however, and so you can use the parameter
# field for direct selection.
#
# Also notable is the fact that the variable will automatically reset to 0
# once the Call Common Event event command is executed. So, even if you just
# set the value of your control variable to 15, once you call the common
# event the value of your variable will once again be 0. This is to avoid any
# accidents.
#==============================================================================
# ** Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new constant - COMMON_EVENT_VARIABLE_ID
# aliased method - command_117 (Call Common Event)
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMMON_EVENT_VARIABLE_ID = 20
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Call Common Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_cl_cmn_evnt_var_cmnd_117_89rn command_117
def command_117
var = $game_variables[COMMON_EVENT_VARIABLE_ID]
@params[0] = var unless var <= 0
# Run Original Method
value = modalg_cl_cmn_evnt_var_cmnd_117_89rn
# Reset Variable
$game_variables[COMMON_EVENT_VARIABLE_ID] = 0
return value
end
end
Credit
Support
Please post here in this topic at rmrk.net for swiftest support. Also, if you have any suggestions, please post here. I am always looking for ways to improve my scripts.
Known Compatibility Issues
No known compatibility issues.
Demo
No demo necessary.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.