=begin #=============================================================================== Title: Scripted Action Trigger Author: Hime Date: Dec 27, 2014 -------------------------------------------------------------------------------- ** Change log Dec 27, 2014 - initial release -------------------------------------------------------------------------------- ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Credits to Hime Works in your project * Preserve this header -------------------------------------------------------------------------------- ** Description: This script allows you to manually perform a check to see if there are any events that can be triggered by the player. It is almost equivalent to pressing the action button on the map, except no button is actually pressed. The purpose of this script is to simulate action triggering using things such as common events so that you can make it seem as if using an item is triggering an event. -------------------------------------------------------------------------------- ** Installation In the script editor, place this script below Materials and above Main -------------------------------------------------------------------------------- ** Usage Use the script call reserve_action_trigger #============================================================================== =end $imported = {} if $imported.nil? $imported[:TH_ScriptedActionTrigger] = true #=============================================================================== # ** Rest of the script #=============================================================================== class Game_System alias :th_scripted_action_trigger_initialize :initialize def initialize th_scripted_action_trigger_initialize clear_action_trigger end def action_trigger_reserved? !@reserved_action_triggers.empty? end def reserve_action_trigger(char=$game_player) @reserved_action_triggers << char end def get_reserved_action_trigger @reserved_action_triggers.shift end def clear_action_trigger @reserved_action_triggers = [] end end class Game_Map alias :th_scripted_action_trigger_update :update def update(*args) th_scripted_action_trigger_update(*args) update_reserved_action_trigger end def update_reserved_action_trigger return if @interpreter.running? if $game_system.action_trigger_reserved? char = $game_system.get_reserved_action_trigger char.check_action_event end end end class Game_Interpreter def reserve_action_trigger $game_system.reserve_action_trigger end end