Created
January 12, 2015 21:23
-
-
Save HimeWorks/e4bb1589e456abeb94eb to your computer and use it in GitHub Desktop.
Pre-Battle Common Event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demonstration of how to run a common event when you encounter an enemy | |
class Scene_Map < Scene_Base | |
alias :th_encounter_common_event_start :start | |
def start | |
th_encounter_common_event_start | |
@battle_pending = false | |
end | |
# Overwrite | |
def update_encounter | |
if $game_player.encounter | |
$game_temp.reserve_common_event(1) # common event to run | |
$game_map.setup_starting_event | |
@battle_pending = true | |
end | |
if @battle_pending && !$game_map.interpreter.running? | |
SceneManager.call(Scene_Battle) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment