08-04-2011, 05:08 AM
It's cause the stack error with f12 since the 'def skill_effect(user, skill)' don't exist on the Game_Actor. (The error happens only when an enemy use an skill after f12 is pressed)
I've made an test using super and got no error:
I've made an test using super and got no error:
Code:
#==============================================================================
# ** Blue Magic
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.1
# 08-02-2011
# RGSS / RPGMaker XP
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
# This system allows you to learn skills from enemies when attacked. These
# learned skills may be exact copies, or may be similar or variations accor-
# ding to what is defined in the script's configuration page. As such, one
# could let a hero learn the 'Fire' spell if hit with fire or even mass fire.
#
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
# LEARNED SKILL VALUE:
#
# The system creates a 'learned' value for actor battlers which it can pass
# into Sprite_Battler and the RPG::Sprite class. This permits the end user
# to create a 'Learned' damage pop showing if a skill is learned or even
# what type of skill is learned. Using such a damage pop is optional. The
# value passed (learned) will be the same as the ID value of the skill that
# is learned, or a value of '0' as a default, non-learned value.
#
#------------------------------------------------------------------------------
#
# CONFIGURABLES:
#
# There are only three configurables:
#
# BLUE_MAGIC_IDs: This is an array that holds the IDs of the actors who
# are able to learn skills through being attacked.
#
# BLUE_TRIGGER: (optional) This is a value that identifies a specific
# state effect that permits a character to learn through
# being attacked. This is set to 'nil' by default so no
# state is required to learn a skill. (States such as
# Venom, Dizzy, Stun...)
#
# BLUE_MAGIC_SKILL: This is a hash array. It identifies the skill(s) that
# allow your actors to learn skills followed by the actual
# learned skill. This may differ from other scripts in
# that you can define one or more skills that can teach
# a different skill to your actors.
#
# The format: = { skill => learned, skill => learned, ... }
#
#==============================================================================
BLUE_MAGIC_IDs = [1,2] # IDs of actors
BLUE_TRIGGER = nil # State that permits skill learning
BLUE_MAGIC_SKILL = {7 => 7} # IDs of skill and skill learned
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :learned # Learned skill value
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
effective = super(user, skill)
# Clear critical flag
self.learned = 0
if BLUE_MAGIC_IDs.include?(self.id)
# Acquire a learned skill if one exists
new_skill = nil
new_skill = BLUE_MAGIC_SKILL[skill.id] if BLUE_MAGIC_SKILL.include?(skill.id)
# Perform skill learning if skill learnable
if new_skill != nil
# If there isn't a blue magic, skill learning state.
if BLUE_TRIGGER == nil or self.states.include?(BLUE_TRIGGER)
# Do not learn if learned already
unless self.skills.include?(new_skill)
# Learn the new skill
self.learn_skill(new_skill)
self.learned = new_skill
end
end
end
end
return effective
end
end