RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Evasion Upgrade

Started by cozziekuns, June 07, 2010, 01:56:53 AM

0 Members and 1 Guest are viewing this topic.

cozziekuns

Evasion Upgrade
Version: 1.0
Author: Cozziekuns
Date: June 6, 2010

Version History




  • <Version 1.0> 06.06.2010 - Original Release

Planned Future Versions


  • None! Please suggest some features.

Description



Actors and classes now have their individual evasion properties, and states can now change an actors evasion. Originally, I was just going to make the alter the state properties, but I realised that you cannot set actor and class evasion through the database, so I added them in as a bonus.

Features


  • Allows you to alter the evasion stat with status effects.
  • Allows you to give actors individual evasion stats.
  • Allows you to give classes individual evasion stats.

Instructions

See header.

Script




#===============================================================================
#
# Cozziekuns Evasion Upgrade
# Last Date Updated: 6/6/2010
#
# Actors and classes now have their individual evasion properties, and states
# can now change an actors evasion. Originally, I was just going to make the
# alter the state properties, but I realised that you cannot set actor and
# class evasion through the database, so I added them in.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 06/06/10 - Created Script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# It's pretty self explanatory. If you want a state to increase an actors
# evasion by a specific number, put the following command in the states notebox:
#
# \evasion[number]
#
# Where number is the amount you want to add to your actors evasion. Originally,
# that was the only feature I was going to include, but I noticed that all
# actors have the same evasion, so I made the two modules ACTOR_INDIVIDUAL_EVA
# and CLASS_INDIVIDUAL_EVA. ACTOR_INDIVIDUAL_EVA follows the following template:
#
# Actor ID => Evasion
#
# So if I wanted Ralph to have 10 Evasion, I would use:
#
# 1 => 10
#
# Remember that the evasion amount is stacked to the default evasion amount(5).
# The same rules go for CLASS_INDIVIDUAL_EVA, except the template is now:
#
# Class ID => Evasion
#
# So if I wanted a Ninja with the class ID of 2 to have 25 Evasion, I would use:
#
# 2 => 25
#
#===============================================================================

module COZZIEKUNS
  module CEU
   
    USE_ACTOR_INDIVIDUAL_EVA = true # Do you want actors to have an individual evasion stat?
    ACTOR_INDIVIDUAL_EVA ={
      # Actor ID => Evasion
      1 => 5,
      2 => 2,
      3 => 95,
      4 => 90,
    }
   
    USE_CLASS_INDIVIDUAL_EVA = true # Do you want classes to have an individual evasion stat?
    CLASS_INDIVIDUAL_EVA ={
      # Class ID => Evasion
      1 => 23,
      2 => 42,
      3 => 0,
      4 => 1,
    }
   
  end
end
   
$imported = {} if $imported == nil
$imported["CozEvasnUpgrd"] = true

#==============================================================================
# ** RPG::State
#------------------------------------------------------------------------------
#  The superclass of all states.
#==============================================================================

class RPG::State
  #--------------------------------------------------------------------------
  # * Evasion to add
  #--------------------------------------------------------------------------
  def evasion_to_add
    @evasion = 0
    if self.note[/\\evasion\[(\d+)]/i] != nil
      @evasion = $1.to_i
    end
    return @evasion
  end
end

#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
#  The superclass of all items.
#==============================================================================

class RPG::Item < RPG::UsableItem
  #--------------------------------------------------------------------------
  # * Evasion parameter increase
  #--------------------------------------------------------------------------
  def evasion_param_increase
    @evasion = 0
    if self.note[/\\evasion\[(\d+)]/i] != nil
      @evasion = $1.to_i
    end
    return @evasion
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  alias coz_ceu_setup setup
    def setup(actor_id)
      coz_ceu_setup(actor_id)
      @uaie = COZZIEKUNS::CEU::USE_ACTOR_INDIVIDUAL_EVA
      @aie = COZZIEKUNS::CEU::ACTOR_INDIVIDUAL_EVA
      @ucie = COZZIEKUNS::CEU::USE_CLASS_INDIVIDUAL_EVA
      @cie = COZZIEKUNS::CEU::CLASS_INDIVIDUAL_EVA
    end
  #--------------------------------------------------------------------------
  # * Get Normal Attack Element
  #--------------------------------------------------------------------------
  alias coz_ceu_eva eva
  def eva
    result = coz_ceu_eva
    for state in states
      result += state.evasion
    end
    if @uaie
      if @aie.include?(@actor_id)
        result += @aie[@actor_id]
      end
    end
    if @ucie
      if @cie.include?(@class_id)
        result += @cie[@class_id]
      end
    end
    return result
  end
end

#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Evasion Rate
  #--------------------------------------------------------------------------
  alias coz_ceu_enemy_eva eva
    def eva
      result = coz_ceu_enemy_eva
      for state in states
        result += state.evasion
      end
      return result
    end
  end



Credit




  • cozziekuns

Thanks


  • All those games where you can increase your evasion with a status effect (My mind's blank right now).

Support



Just post down here.

Known Compatibility Issues

Shouldn't be any, since basically everything's aliased.

Author's Notes



I need to stop writing scripts about status effects. I could be the status effect king or something o.o

Restrictions

:ccby:

SirJackRex

It's like pokemon?

Nice script, I always liked that mechanic!

cozziekuns

Yeah, it's like Pokemon. So that's what I was thinking of when I was designing this.

Anyways, glad you like it!