State Common Events

Introduction
This is a script I wrote that allows you to call Common Events when a State is added or removed. It's very useful, if you want to control the state's functionality more so than default system allows via turn start/end counters.
 
 
Optional
Common Events may not work in battle for you, if they do not then please use this script and follow the screenshots below.
Hime - Scene Interpreter
 
 
Screenshots

Spoiler
G2Uls4W.png

 
 
7cdWXXR.png
 
 
Script
Dropbox
 
 
Commercial
My script can be used in any project, all I require is credit. Hime's script is not allowed in commercial projects without permission. Special thanks to Fomar0153 and Hime for their notetag guide.
This is beyond useful for battle mechanic enthusiasts like myself. Bookmarking. Thank you!
This is beyond useful for battle mechanic enthusiasts like myself. Bookmarking. Thank you!
Thanks! 🙂  It was requested by someone else, I didn't come up with the idea.

Although, my requirements changed - Hime's script may not be required although it is still useful if you want more control without having to get own dirty with the Script Editor, so this works for even commercial projects.
Does anyone have a working link for this script please?

I've been looking everywhere for it, but any post by the author (either as Aeirex or Helladen) has the same broken Dropbox link and no way to get the script.
Does anyone have a working link for this script please?

I've been looking everywhere for it, but any post by the author (either as Aeirex or Helladen) has the same broken Dropbox link and no way to get the script.

Here you go, I just happened to have an old copy in one of my projects:

Code:
#==============================================================================
# ▼ State Common Events
# -- Author: Aeirex
# -- Version: 1.0.0
# -- Last Updated: 2015.01.06
# -- Level: Easy
# -- Requires: Hime - Scene Interpreter
#==============================================================================

#==============================================================================
# ■ Script Import
#==============================================================================
$imported = {} if $imported.nil?
$imported["AE-StateCommonEvents"] = true
#==============================================================================

#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This is a basic state script which allows common event injection to states.
#==============================================================================

#==============================================================================
# ■ Configuration
#==============================================================================
module AeirexStateHelper
  InCombat = false # States will only call a Common Event in combat.
end
#==============================================================================

#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Use these tags in States.
# <add common event: #>
# <remove common event: #>
#
# Add common event will trigger when a State is added. It will only process the
# common event after it is added and not before.
#
# Remove common event will trigger when a State is removed. It will only process
# the common event after it is removed and not before.
#
# This script relies on Hime - Scene Interpreter since RPG Maker VX ACE lacks
# global Common Events and are restricted to only process on the game map.
# Menus and battles do not work with common events, so this script is required
# for this script to work. You need to follow the instructions of the script,
# to specify which scene that the common event will open in.
#==============================================================================

#==============================================================================
# * States
#==============================================================================
class RPG::State
  #------------------------------------------------------------------------
  # * new add state: common event
  #------------------------------------------------------------------------
  def add_common_event
    if @add_common_event.nil?
      if @note =~ /<add common event: (.*)>/i
        @add_common_event = $1.to_i
      else
        @add_common_event = 0
      end
    end
    
    @add_common_event
  end

  #------------------------------------------------------------------------
  # * new remove state: common event
  #------------------------------------------------------------------------
  def remove_common_event
    if @remove_common_event.nil?
      if @note =~ /<remove common event: (.*)>/i
        @remove_common_event = $1.to_i
      else
        @remove_common_event = 0
      end
    end
    
    @remove_common_event
  end
 
end

#==============================================================================
# * Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase   
  #------------------------------------------------------------------------
  # * alias method: add_state
  #------------------------------------------------------------------------
  alias add_state_ace add_state
  def add_state(state_id)   
    add_state_ace(state_id)

    # Call the common event only if in battle
    if !AeirexStateHelper::InCombat || $game_party.in_battle
      $game_temp.reserve_common_event($data_states[state_id].add_common_event)
    end
  end
 
  #------------------------------------------------------------------------
  # * alias method: erase_state
  #------------------------------------------------------------------------
  alias erase_state_ace erase_state
  def erase_state(state_id)   
    erase_state_ace(state_id)

    # Call the common event only if in battle
    if !AeirexStateHelper::InCombat || $game_party.in_battle
      $game_temp.reserve_common_event($data_states[state_id].remove_common_event)
    end
  end
 
end

#==============================================================================
# ▼ End of File
#==============================================================================
Thanks SO much for that! I'm glad that script can be preserved for others to use in future, too.

Original thread: https://forums.rpgmakerweb.com/threads/state-common-events.35607/