Enemy Melee Status Attacks
#1
Enemy Melee Status Attacks
Version: 1.0


Introduction
This little script corrects an oversight whereby enemies can inflict status ailments while performing a melee attack. This acts as a small level of as actor combatants had that luxury with their weapons.


Script
Code:
#==============================================================================
# ** Enemy Melee Status Attacks
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 1.0
#    10-13-2015
#    RGSS / RPGMaker XP
#==============================================================================
#
#  INTRODUCTION:
#
#  This little script corrects an oversight whereby enemies can inflict status
#  ailments while performing a melee attack.   This acts  as a  small level of
#  as actor combatants had that luxury with their weapons.
#
#------------------------------------------------------------------------------
#
#  INSTALLATION
#
#  Place this script below Scene_Debug and above Main.  Configure as directed.
#
#------------------------------------------------------------------------------
#
#  INSTRUCTIONS:
#
#  The system uses a hash array system.  Each array within the hash is for a
#  specific enemy within the database.  If no enemy is specified, the system
#  assumes that  the enemy will not deliver a status ailment when attacking.
#  Each enemy added is set up  to deliver both states to inflict and states
#  to cancel.  The syntax for each enemy array is thus:
#
#      ENEMY[enemy_id] = [ [Plus States Array], [Minus States Array] ]
#
#                                *  *  *
#
#  Both the  Plus States and Minus States  shown above  are arrays  of their
#  own, each of these holds smaller 2-element arrays.  OR, one of the arrays
#  may be empty or set to nil if an enemy is designed  only to apply a state
#  or designed only to remove a state...
#
#             ENEMY[enemy_ID] = [ [Plus States Array], nil ]
#             ENEMY[enemy_ID] = [ [], [Minus States Array] ]
#
#  ... with each states array (be it Plus or Minus) appearing thus...
#
#   [  [state_ID, chance%], [state_ID, chance%],.. [state_ID, chance%]  ]
#
#
#                                *  *  *
#
#  Each states array as I previously described, may hold 1 or more 2-element
#  arrays.  These two element arrays are the heart of the system.  The first
#  element  in each array  is the ID value of the status effect  within your
#  database, while the second is a percentage chance of the enemy attempting
#  to affect its target with a strike.  As such,  an array of  [5,75]  would
#  mean that an enemy will try to 'mute' its target 75% of the time.
#
#      *** Status ailment strikes are still subject to State Defenses. ***
#
#
#                                *  *  *
#
#  Each states array as I previously described, may hold 1 or more 2-element
#  Obviously,  it is much easier to see it working,  so let me show you some
#  examples.
#
#
#   ENEMY[4]   = [ [ [3,25] ] ,           nil        ]
#   ENEMY[9]   = [ [ [8,30] ] ,          [ [16,45] ] ]
#   ENEMY[25]  = [ [ [7,20],[12,50] ] ,  [ [15,75] ] ]
#
#  The first enemy listed (#4: Hellhound)  is a nasty mutt most of the time.
#  By default, it has a skill that hits a target with venom (state #3).  But
#  here, the Hellhound can do just that 25% of the time  [3, 25].   However,
#  it is the only thing it does on an attack, and does not remove any status
#  effects... so the minus states is set to nil.
#  
#  The Zombie is a fairly difficult foe, able to deal a mass delay effect on
#  the whole party.  But what about hitting a single character?    The above
#  settings for the Zombie allow it to paralyze (status #8) a target 30%  of
#  the time [8,30].  However, it isn't just applying an ailment.  This time,
#  we have an enemy  that can now nullify a hero's status bonus.   With each
#  strike,  it will also attempt to remove any BLINK (#16) state 45%  of the
#  time [16, 46].
#
#  Perhaps it isn't the best of ideas to give a Lich  any more power than it
#  has.  But then again, what good is a script like this if you're not going
#  to make it even more powerful?   With this configuration, a lich will try
#  to make an enemy fall asleep (Sleep #7) 20% of the time while also making
#  the target become feeble (Feeble #12) 50% of the time:  [[7,20],[12,50]].
#  And if that's not enough, each strike will also attempt to break down the
#  magic resistance (Resist #15) of a hero 75% of the time [15,75].
#
#  
#
#                                *  *  *
#
#  Perhaps it isn't the best of ideas to give a Lich  any more power than it
#  Just be mindful about the format and the braces in each enemy array...
#
#  ENEMY[id] = {            .... the whole data line .....          ]
#  ENEMY[id] = {  [  ...plus states...  ], [  ...minus states... ]  ]
#  ENEMY[id] - [  [  [states],[states]  ], [  [states],[states]  ]  ]
#  
#
#------------------------------------------------------------------------------
#
#  COMPATIBILITY:
#
#  This script overwrites the 'plus_state_set' and 'minus_state_set' methods
#  within Game_Enemy.   I am not aware of any other script that even touches
#  these methods.  But if there IS such a script, then you may have an issue.
#
#==============================================================================
#
#  TERMS AND CONDITIONS:
#
#  Free for use, even in commercial games.  Just due credits is required.
#
#==============================================================================


module EMSA
  
  ENEMY = {}
  
  # ENEMY LIST        STATE PLUS            STATE MINUS
  # ==========        ==============        ==========
  #
    ENEMY[38] =   [ [ [8,100],[10,50] ],    nil ]
end


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

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (+)
  #--------------------------------------------------------------------------
  def plus_state_set
    return handle_state_set(0)
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #--------------------------------------------------------------------------
  def minus_state_set
    return handle_state_set(1)
  end  
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #--------------------------------------------------------------------------
  def handle_state_set(index)
    returned_set = []
    temp = EMSA::ENEMY[@enemy_id][index] if EMSA::ENEMY.has_key?(@enemy_id)
    unless temp.nil?
      temp.each {|i|
        roll = rand(100)
        if roll < i[1]
          returned_set.push(i[0])
        end
      }
    end
    return returned_set
  end
end


Instructions
In the script. It's my way.


Compatibility
For RPGMaker XP. It overwrites the plus_state_set' and 'minus_state_set' methods in Game_Enemy, so it will conflict with other scripts that do the same. BUT... I don't know any that do.


Author's Notes
Since I've been scripting since 2005, I never saw a script that does this. WHY has no one thought of this?


Terms and Conditions
Free for use, even in commercial games. Just due credits is required.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#2
(10-14-2015, 03:28 AM)DerVVulfman Wrote: Author's Notes
Since I've been scripting since 2005, I never saw a script that does this.  WHY has no one thought of this?

Perhaps because you could get a similar result by making an unnamed skill that inflicts an ailment and shares the same animation as the monster's normal attack?

Still, this script does allow to set up the probability of the aliment being inflicted. That's an option sorely lacking in RPG Maker XP.
Reply }
#3
Granted, you could make a skill that uses no SP and make it look like a melee attack, but the mechanics of such an attack is still using skill mechanics rather than the parameters used by the default attack method.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#4
Good point. And nothing guarantees that the skill will cause the same damage as the normal attack.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Collateral Attacks DerVVulfman 2 280 11-10-2024, 08:55 AM
Last Post: Bennerdeben
   DerVV's Point-Increasing Status Menu DerVVulfman 1 642 07-16-2024, 04:41 AM
Last Post: DerVVulfman
   VARIABLE ENEMY HP & SP DerVVulfman 0 836 06-14-2024, 07:18 PM
Last Post: DerVVulfman
   Saumon's Enemy Reveals DerVVulfman 0 846 03-12-2024, 08:40 PM
Last Post: DerVVulfman
   Weapons Blocked from Attacks DerVVulfman 0 906 12-03-2023, 03:41 AM
Last Post: DerVVulfman
Smile  Soul's Better Status Screen SoulZetaformGames 7 10,956 11-11-2021, 09:20 AM
Last Post: kyonides
   Enemy Action Sets DerVVulfman 10 8,560 07-21-2021, 03:24 AM
Last Post: DerVVulfman
   Enemy Challenge for Experience DerVVulfman 0 3,222 11-25-2019, 12:30 AM
Last Post: DerVVulfman
   Leveled Enemy Lists DerVVulfman 0 3,414 09-13-2019, 04:06 AM
Last Post: DerVVulfman
   ATOA Status Effect Pops DerVVulfman 6 12,307 01-29-2016, 06:30 AM
Last Post: Lightness



Users browsing this thread: 2 Guest(s)