06-11-2023, 02:32 PM
(06-11-2023, 03:18 AM)kyonides Wrote: Weird... yet still possible if you did it the wrong way or you're missing a skill refresh step... The problem is that any of the existing iterations of the engine simply adds a skill to the actor's list in no time. This tardiness is suspicious. How did you add them? Are you sure you didn't miss anything? Or you using a conflicting script?
(06-11-2023, 04:27 AM)DerVVulfman Wrote: I agree with kyonides. The Game_Actor class has values like @name, @class, and of course an array called @skills. And the @skills array merely has a list of skill IDs... not hard to really add a skill into. And once a skill ID is added into the array, it should be immediately useful.
(06-11-2023, 02:57 AM)Steel Beast 6Beets Wrote: I created a common event that adds three new attacks to a character's repertoire when equipping an accessory but the changes only show up after a battle.
So I am curious. Is it the common event that should apply the skills, or is it the equipping of the accessory that grants the skills?
Under normal circumstances, no armor piece gives one skills. And under normal circumstances, you cannot unequip/equip weapons or armor during battle which would lend you skills given by armor thus.
Certainly, more info is needed.
I recently discovered the wonder of switch-triggered parallel common events (and created a accessory that adds 1 gold every 24 frames) and I thought I could sidestep the limitation of modern algebra's skill teaching equipment and items script that only allow one skill per equipment piece/item. The script in question:
Code:
#==============================================================================
# Skill Teaching Equipment & Items
# Version 1.0
# Author: modern algebra (rmrk.net)
# Date: January 27, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Insert this script just above Main. To configure your database, see the
# Configuration Section at lines 29, 66, and 97 (by default; once you've
# configured some of the data, this will change)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** RPG
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adds an additional stat, skill_id, to weapons, armors, and items
#==============================================================================
module RPG
#==============================================================================
# ** Item
#==============================================================================
class Item
#
attr_sec_reader :skill_id, 'get_stats (0)'
attr_sec_reader :class_limits, 'get_stats (1)'
attr_sec_reader :actor_limits, 'get_stats (2)'
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Stats
# parameter : 0 => skill ID, 1 => classes, 2 => actors
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def get_stats (parameter)
learn_skill = 0
class_limits, actor_limits = ['all'], ['all']
case @id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# It is very easy to configure the database. All that you need to do
# is write:
#
# when <item ID>
# learn_skill = <skill_id>
# class_limits = [<class IDs that can use>]
# actor_limits = [<actor IDs that can use>]
#
# For every item that you want to teach skills. To discover what the
# ID of an item or a skill is, look at the number directly to the left
# of their names in the Database. For the other 2, fill those in
# if only specific classes or actors can gain the skill. If you do not
# specify, it is assumed that any actor can use the item and gain the
# skill. There are two examples below. Feel free to delete them once
# you understand what you need to do.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 251 # Skill Scroll
learn_skill = 401 # Slap
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 252 # Skill Scroll
learn_skill = 402 # Lazer Beam
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 253 # Skill Scroll
learn_skill = 403 # Photon Blaster
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 254 # Skill Scroll
learn_skill = 404 # Transfusion
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 255 # Skill Scroll
learn_skill = 405 # Bag of Tricks
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 256 # Skill Scroll
learn_skill = 406 # Arc Immunity
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 257
learn_skill = 407
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 258 # Skill Scroll
learn_skill = 408 # Sacrifice
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 259 # Skill Scroll
learn_skill = 409 # Inmolation
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 260 # Skill Scroll
learn_skill = 410 # Body Down
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 261 # Skill Scroll
learn_skill = 411 # Mind Down
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 262 # Skill Scroll
learn_skill = 412 # Rotten Herbs
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 263 # Skill Scroll
learn_skill = 413 # Miserable Company
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 264 # Skill Scroll
learn_skill = 414 # Doping
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 265 # Skill Scroll
learn_skill = 415 # Nootropics
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 266 # Skill Scroll
learn_skill = 416 # Tainted Cure
class_limits = [11, 13, 15, 16,]
when 267 # Skill Scroll
learn_skill = 417 # Narcotic Healing
class_limits = [11, 13, 15, 16,]
when 268 # Skill Scroll
learn_skill = 418 # Toxic Strike
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 269 # Skill Scroll
learn_skill = 419 # Unseen Strike
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 270 # Skill Scroll
learn_skill = 420 # Speechless Strike
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
when 271 # Skill Scroll
learn_skill = 421 # Entrust
class_limits = [10, 11, 12, 13, 14, 15, 16, 17, 18]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * END CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
return [learn_skill, class_limits, actor_limits][parameter]
end
end
#==============================================================================
# ** Weapon
#==============================================================================
class Weapon
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def skill_id
learn_skill = 0
case @id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# when <weapon ID>
# learn_skill = <skill_id>
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 453 # Handgun
learn_skill = 482 # Drive-By Shot
when 477 # Morning Star
learn_skill = 444 # Wallop
when 478 # Shotel
learn_skill = 446 # Spin Cut
when 479 # Machete
learn_skill = 443 # Dire Slice
when 997 # Sword of Donduria
learn_skill = 590 # Art: Donduria Slash
when 998 # Rod of Acon
learn_skill = 591 # Art: Acon Burst
when 999 # Hero Sword
learn_skill = 899 # End of Times
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * END CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
return learn_skill
end
end
#==============================================================================
# ** Armor
#==============================================================================
class Armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def skill_id
learn_skill = 0
case @id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# when <armor ID>
# learn_skill = <skill_id>
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 263 # Stone Mask
learn_skill = 305 # Blood Fest
when 270 # Mighty Might
learn_skill = 398 # Focus
when 271 # Magical Magic
learn_skill = 399 # Concentrate
when 372 # Blood Tear
learn_skill = 481 # Bloody Mess
when 264 # Amber Crystal
learn_skill = 306 # Aura Drain
when 380 # Frost Stud
learn_skill = 486 # Cold Air
when 382 # Stellar Circle
learn_skill = 447 # Resistance Drive
when 383 # Silver tiara
learn_skill = 448 # Nimble Drive
when 384 # Mercury's Bandana
learn_skill = 449 # Swift Drive
when 471 # Marilith Mask
learn_skill = 390 # Marilith Power
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * END CONFIGURATION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
return learn_skill
end
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
# * Change Equipment
# equip_type : type of equipment
# id : weapon or armor ID (If 0, remove equipment)
#--------------------------------------------------------------------------
alias ma_skill_teaching_items_change_equipment equip
def equip (equip_type, id)
# Forget the skill from what was previously equipped
skill_id = 0
case equip_type
when 0; skill_id = $data_weapons[@weapon_id].skill_id if @weapon_id != 0
when 1; skill_id = $data_armors[@armor1_id].skill_id if @armor1_id != 0
when 2; skill_id = $data_armors[@armor2_id].skill_id if @armor2_id != 0
when 3; skill_id = $data_armors[@armor3_id].skill_id if @armor3_id != 0
when 4; skill_id = $data_armors[@armor4_id].skill_id if @armor4_id != 0
end
forget_skill (skill_id) if @unnatural_skills.include? (skill_id)
@unnatural_skills.delete (skill_id)
# Run original method
ma_skill_teaching_items_change_equipment (equip_type, id)
skill_id = 0
case equip_type
when 0; skill_id = $data_weapons[@weapon_id].skill_id if @weapon_id != 0
when 1; skill_id = $data_armors[@armor1_id].skill_id if @armor1_id != 0
when 2; skill_id = $data_armors[@armor2_id].skill_id if @armor2_id != 0
when 3; skill_id = $data_armors[@armor3_id].skill_id if @armor3_id != 0
when 4; skill_id = $data_armors[@armor4_id].skill_id if @armor4_id != 0
end
# Learn the skill from the weapon just equipped
unless @skills.include? (skill_id) || skill_id == 0
@unnatural_skills.push (skill_id)
learn_skill (skill_id)
end
end
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
alias ma_skill_teaching_items_actor_setup setup
def setup(actor_id)
@unnatural_skills = []
# Run original method
ma_skill_teaching_items_actor_setup (actor_id)
# If there is a skill attached to weapon, learn it
unless @weapon_id == 0
skill_id = $data_weapons[@weapon_id].skill_id
unless skill_id == 0 || @skills.include? (skill_id)
@unnatural_skills.push (skill_id)
learn_skill (skill_id)
end
end
# If there are skills attached to the armors, learn them
armor = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
for armor_id in armor
next if armor_id == 0
skill_id = $data_armors[armor_id].skill_id
next if skill_id == 0 || @skills.include? (skill_id)
@unnatural_skills.push (skill_id)
learn_skill (skill_id)
end
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
def item_effect (item)
# Run original method
effective = super (item)
# If the item is a skill teacher, and if the actor does not already possess
# the skill, and if his class and he are not restricted from using this
# item to gain the skill
if item.skill_id != 0 && (!@skills.include? (item.skill_id) || @unnatural_skills.include? (item.skill_id)) &&
(item.class_limits.include? ('all') || item.class_limits.include? (@class_id)) &&
(item.actor_limits.include? ('all') || item.actor_limits.include? (@actor_id))
@unnatural_skills.delete (item.skill_id)
learn_skill (item.skill_id)
effective |= true
end
return effective
end
end
And it works. Well, aside for what I stated early about changes only showing up after a battle. Or just simply changing screens as I just discovered.