10-14-2015, 03:28 AM
Enemy Melee Status Attacks
Version: 1.0
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.