State Common Events

Helladen

Deviant Designer
Veteran
Joined
Jul 13, 2012
Messages
635
Reaction score
185
First Language
English
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


 
 
 
 
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.
 
Last edited by a moderator:

Kenen

Veteran
Veteran
Joined
Apr 3, 2012
Messages
256
Reaction score
153
First Language
English
Primarily Uses
RMMV
This is beyond useful for battle mechanic enthusiasts like myself. Bookmarking. Thank you!
 

Helladen

Deviant Designer
Veteran
Joined
Jul 13, 2012
Messages
635
Reaction score
185
First Language
English
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.
 
Last edited by a moderator:

Banjo

Veteran
Veteran
Joined
Jan 4, 2013
Messages
63
Reaction score
11
First Language
English
Primarily Uses
RMVXA
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.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
414
Reaction score
145
First Language
English
Primarily Uses
RMVXA
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
#==============================================================================
 

Banjo

Veteran
Veteran
Joined
Jan 4, 2013
Messages
63
Reaction score
11
First Language
English
Primarily Uses
RMVXA
Thanks SO much for that! I'm glad that script can be preserved for others to use in future, too.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

This little brat (my nephew) just invent a new way of enjoying his orange juice by pouring it inside of used perfume bottle and sprayed it to his mouth...
Jamaica? No, Aunty. I said, I'm on RPG Maker :*/
Lunar New Year is over :( but it's time to get back to work!
I keep giving myself deadlines because I'm so excited to finish something but I notice areas where I'm rushing the story and that's what's gonna weaken my overall project, gotta stop that

Forum statistics

Threads
93,691
Messages
914,663
Members
123,289
Latest member
mintminstrel
Top