Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # To call a common event on escape failure,
- # set the common event ID you want to use below.
- # If the common event ID is set to 0, no common event will be called
- # on that condition.
- $ESCAPE_FAILURE_COMMON_EVENT_ID = 0
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Frame Update (party command phase: escape)
- # REPLACEMENT method - Identical to RGSS, except where noted.
- #--------------------------------------------------------------------------
- def update_phase2_escape
- # Calculate enemy agility average
- enemies_agi = 0
- enemies_number = 0
- for enemy in $game_troop.enemies
- if enemy.exist?
- enemies_agi += enemy.agi
- enemies_number += 1
- end
- end
- if enemies_number > 0
- enemies_agi /= enemies_number
- end
- # Calculate actor agility average
- actors_agi = 0
- actors_number = 0
- for actor in $game_party.actors
- if actor.exist?
- actors_agi += actor.agi
- actors_number += 1
- end
- end
- if actors_number > 0
- actors_agi /= actors_number
- end
- # Determine if escape is successful
- success = rand(100) < 50 * actors_agi / enemies_agi
- # If escape is successful
- if success
- # Play escape SE
- $game_system.se_play($data_system.escape_se)
- # Return to BGM before battle started
- $game_system.bgm_play($game_temp.map_bgm)
- # Battle ends
- battle_end(1)
- # If escape is failure
- else
- # McKathlin new: call Escape Failure Common Event.
- common_event_id = $ESCAPE_FAILURE_COMMON_EVENT_ID
- common_event = $data_common_events[common_event_id]
- if common_event != nil
- $game_system.battle_interpreter.setup(common_event.list, 0)
- end
- # End of new McKathlin code.
- # Clear all party member actions
- $game_party.clear_actions
- # Start main phase
- start_phase4
- end
- end # def update_phase2_escape
- end # class Scene_Battle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement