Posts: 11,214
Threads: 648
Joined: May 2009
Blue Magic
Version: 1.1
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 according 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.
Script
Blue Magic
Instructions
Fairly easy to use, and the instructions are in the script.
Compatibility
Made specifically for use with RPGMaker XP and the RGSS code. Only needs rewrites or edits for a 'Learning' damage pop as the sample code below shows.
Sample Edit Code
Sample Edits for Damage Pop
Terms and Conditions
Free for use in games both commercial and free. Just give due credit.
Posts: 212
Threads: 9
Joined: Mar 2011
This is a pretty sweet script. I wonder if mog has one for his abs o.o
Posts: 797
Threads: 24
Joined: Feb 2010
Even tough this has been posted a while back, I wanted to point out a bug. It works all great and fine, exept for this one thing: you can't use heeling spells from the menu anymore. The game will react as if you'd be trying to heal someone who has max health.
The game does not crash or anything, but still I belive this is something that should be brought to attention.
Friendship is born at that moment when one person says to another: "What! You, too? Thought I was the only one." (C.S. Lewis)
For the time you're laughing, there's nothing wrong in the world. (Colin Mochrie)
If it's funny, make sure people laugh. If it's not funny, make it funny (unless it's actually really serious). (silvercheers)
Please don't spell my name "Yamina-chan". It's all small. Thank you =D
Posts: 11,214
Threads: 648
Joined: May 2009
Er...
Le BUMP!
to version 1.1
Rather than utilizing an 'alias' method, I tried using a 'super' class system which didn't work out so well. It's been re-done with the traditional 'alias' system to tell if a skill worked or not. Thanks, yamina-chan for finding it didn't work.
Actually, I'm amazed no one saw the problem for two years it's been out.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links
Posts: 797
Threads: 24
Joined: Feb 2010
Maybe people tested only if the lerning of a new skill would work but did not test it enough to find some bugs?
I couldn't find any in the new version so far, so I'd say good job ^^
Friendship is born at that moment when one person says to another: "What! You, too? Thought I was the only one." (C.S. Lewis)
For the time you're laughing, there's nothing wrong in the world. (Colin Mochrie)
If it's funny, make sure people laugh. If it's not funny, make it funny (unless it's actually really serious). (silvercheers)
Please don't spell my name "Yamina-chan". It's all small. Thank you =D
Posts: 191
Threads: 81
Joined: Jul 2009
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:
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