[XP] Escape-Enabling Skills

Started by lilbrudder917, March 06, 2010, 01:36:30 pm

Previous topic - Next topic

lilbrudder917

March 06, 2010, 01:36:30 pm Last Edit: March 06, 2010, 03:57:12 pm by Breloom Trainer Brudder
Escape-Enabling Skills
Authors: LilBrudder917
Version: 1.1
Type: Special Skill Effect
Key Term: Battle Add-on



Introduction

This script allows the player to use a skill to activate the Escape option in battle.


Features


  • Multiple Escaping Skills
  • Sound to be played if you can Escape
  • Sound to be played if you can't Escape
  • Can change Chances of Activating
  • Can use a Switch to disable Escape Attempts



Screenshots

N/A


Demo

Maybe later.


Script


Spoiler: ShowHide

#==============================================================================#
#                Escape Enabling Spells by LilBrudder917                       #
#                             v1.1 | 3-6-10                                    #
#==============================================================================#
# What it Does:                                                                #
#     +Allows player to use Skills that allow them to activate the             #
#      -Escape option.                                                         #
#                                                                              #
# Features:                                                                    #
#  + Multiple Escaping Skills                                                  #
#  + Sound to be played if you can Escape                                      #
#  + Sound to be played if you can't Escape                                    #
#  + Can change Chances of Activating                                          #
#  + Can use a Switch to disable Escape Attempts                               #
#                                                                              #
# Possibilities for an Update:                                                 #
#  + Different Skills can have Different Chances                               #
#                                                                              #
# Version History:                                                             #
#  + 1.1 : Uses 2 less Global Variables.                                       #
#==============================================================================#
module Escaping_Skills
#------------------------------------------------------------------------------#
#                              Configuration                                   #
#------------------------------------------------------------------------------#
ESCAPE_SKILLS = 81, 82, 83
Escape_Sound   = "031-Door08"
NoEscape_Sound = "045-Push01"
NoEscapeSwitch = 1
Chance = 100
OutOf = 50
#------------------------------------------------------------------------------#
# Script Below : Don't Touch Unless you know what You're Doing                 #
#------------------------------------------------------------------------------#
end

class Scene_Battle

  alias start_escaping main
  def main
    start_escaping
    @ESCAPED = 0
  end

  alias escape_skill make_skill_action_result
  def make_skill_action_result
    escape_skill
      if @active_battler.current_action.skill_id = Escaping_Skills::ESCAPE_SKILLS
        if !$game_switches[Escaping_Skills::NoEscapeSwitch]
          @ESCAPED = rand(Escaping_Skills::Chance)       
          if @ESCAPED <= Escaping_Skills::OutOf
            Audio.se_play("Audio/SE/"+Escaping_Skills::NoEscape_Sound, 100, 100)
            $game_temp.battle_can_escape = false
            @party_command_window = Window_PartyCommand.new
          else
            Audio.se_play("Audio/SE/"+Escaping_Skills::Escape_Sound, 100, 100)
            $game_temp.battle_can_escape = true
            @party_command_window = Window_PartyCommand.new
          end
        end
      end
    end
  end
 
class Window_PartyCommand < Window_Selectable
  alias escape_fix initialize
  def initialize
    escape_fix
    if $game_temp.battle_can_escape
    draw_item(1, normal_color)
    end
  end
end





Instructions

Put below default scripts and above Main. Configure. Play.


Compatibility

May cause incompatibility problems with exotic Battle Systems.


Credits and Thanks


  • Me, for making it, I guess.



Author's Notes

I've had this idea for a while. Finally got around to making it. Enjoy.

Aqua

Why do you use so many global variables in your scripts?
(Not just talking about this one)

lilbrudder917

March 06, 2010, 03:51:25 pm #2 Last Edit: March 06, 2010, 03:57:30 pm by Breloom Trainer Brudder
Because I'm not sure how to do it any other way.

When I make scripts, I just try to get them working.

EDIT: Updated to v1.1. Uses two less Global Variables because I thought of a way to check it differently that I should have noticed originally.

Aqua

*claps*
Good job for thinking alternatively.

lilbrudder917

March 06, 2010, 04:29:35 pm #4 Last Edit: March 06, 2010, 04:50:28 pm by Breloom Trainer Brudder
And I thought of a way to rid of a lot of them from my CMS as well, so I'm going to post it up soon.

EDIT: It's up.  :P

nathmatt

um this

if @active_battler.current_action.skill_id = Escaping_Skills::ESCAPE_SKILLS


should be this

if @active_battler.current_action.skill_id == Escaping_Skills::ESCAPE_SKILLS
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Morganthedragon