Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
- # ║ Actor Escape Bonus │ v1.03 │ (09/01/15) ║
- # ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
- # ║ Author: William Couillard ║
- # ║ Thanks: Cremno ║
- # ║ E-Mail: cooliebk18@yahoo.com ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ABOUT ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script gives your party the ability to escape battles with greater ║
- # ║ success if a certain actor is in the active battle party. For example, ║
- # ║ having a Thief or Elf in the party may make it easier to escape the ║
- # ║ battle. There are also options to allow States to disable the bonus ║
- # ║ chance, and the modifiers that determine the escape chance can be freely ║
- # ║ edited. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ TERMS OF USE ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ► Do not edit the script's header or comments. ║
- # ║ ► Free to use in commercial projects as long as proper credit is given to ║
- # ║ ALL the names in the above header. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ FEATURES ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ► Escape battles with almost 100% success with the correct actor in the ║
- # ║ active battle party (if alive). ║
- # ║ ► Allow States to disable the required actor's ability to enhance the ║
- # ║ escape probability. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ CHANGE LOG ║
- # ╠═══════════════════════════════════════════════════════════════════╤═══════╣
- # ║ ■ September 01, 2015 : Added alias to improve compatibility │ v1.03 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ December 14, 2012 : Check executes every turn. [bugfix] │ v1.02 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ December 13, 2012 : Added Check States option. │ v1.01 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ December 05, 2012 : Initial release. │ v1.00 ║
- # ╠═══════════════════════════════════════════════════════════════════╧═══════╣
- # ║ NEXT VERSION ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ■ Possible update to allow multiple actor IDs to change escape formula. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ METHOD OVERWRITES ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script overwrites a single method in module BattleManager and one ║
- # ║ method of Scene_Battle. ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ module BattleManager ║
- # ║ ► def self.make_escape_ratio ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Scene_Battle > Scene_Base ║
- # ║ ► def turn_start ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ INSTRUCTIONS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ Simply paste this script anywhere above the Main script and below the ║
- # ║ BattleManager module. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ IMPORT SETTING ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- $imported = {} if $imported.nil?
- $imported[:wc_actor_escape_bonus] = true
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Coolie's Actor Escape Bonus Module ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ This module manages this script's settings. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- module COOLIE
- module ESCAPE
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Actor Settings ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ACTOR_ID : Input the ID of the actor that will modify the escape ║
- # ║ chance. ║
- # ║ CHECK_STATES : If true, states will be checked for NULL_STATES matches. ║
- # ║ If states in NULL_STATES match current states, escape ║
- # ║ bonus is reset to normal. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- ACTOR_ID = 1
- CHECK_STATES = true
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Null States Array ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ The states contained within this array will be checked if CHECK_STATES is ║
- # ║ set to true. If any state within this array matches a state currently ║
- # ║ applied to the actor defined in ACTOR_ID, then the escape bonus will be ║
- # ║ nullified. ║
- # ║ ║
- # ║ NOTE: NULL_STATES *MUST* have at least have one state defined. It is a ║
- # ║ good idea to set your death state as a NULL_STATE. Usually, ID 1. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- NULL_STATES = [1]
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Escape Success Formulas ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ These constants determine the default and modified chance to escape a ║
- # ║ battle. When the actor defined in ACTOR_ID is in the party, alive, and ║
- # ║ does not have any of the states defined in NULL_STATES, the bonus defined ║
- # ║ in ESCAPE_MOD_BONUS will be used to determine the chance of escape. ║
- # ║ Otherwise, the value defined in ESCAPE_MOD_DEFAULT will be used. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- ESCAPE_MOD_DEFAULT = 1.5 # Escape Chance modifier. (Default)
- ESCAPE_MOD_BONUS = 5.0 # Escape Chance modifier. (Actor Bonus)
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ BattleManager ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- module BattleManager
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Make Escape Ratio (Creates Escape Success Probability) ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def self.make_escape_ratio
- if $game_party.battle_members.include?($game_actors[COOLIE::ESCAPE::ACTOR_ID]) &&
- $game_actors[COOLIE::ESCAPE::ACTOR_ID].hp > 0
- if COOLIE::ESCAPE::CHECK_STATES == true
- if COOLIE::ESCAPE::NULL_STATES.any? { |s| $game_actors[COOLIE::ESCAPE::ACTOR_ID].state?(s) }
- @escape_ratio = COOLIE::ESCAPE::ESCAPE_MOD_DEFAULT - 1.0 * $game_troop.agi / $game_party.agi
- else
- @escape_ratio = COOLIE::ESCAPE::ESCAPE_MOD_BONUS - 1.0 * $game_troop.agi / $game_party.agi
- end
- else
- @escape_ratio = COOLIE::ESCAPE::ESCAPE_MOD_BONUS - 1.0 * $game_troop.agi / $game_party.agi
- end
- else
- @escape_ratio = COOLIE::ESCAPE::ESCAPE_MOD_DEFAULT - 1.0 * $game_troop.agi / $game_party.agi
- end
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Scene_Battle ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- class Scene_Battle < Scene_Base
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ START TURN ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- alias :wc_actor_escape_bonus_turn_start :turn_start
- def turn_start
- wc_actor_escape_bonus_turn_start
- BattleManager.make_escape_ratio
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ END OF FILE ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement