#================================================================= # 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 #=================================================================
class Item #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Skill ID #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def skill_id learn_skill = 0 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> # # 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. There are two examples below. Feel # free to delete them once you understand what you need to do. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ when 1 # Potion learn_skill = 1 # Heal when 2 # High Potion learn_skill = 69 # Poison Edge #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * END CONFIGURATION #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end return learn_skill end end
class Armor #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Skill ID #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def skill_id learn_skill = 0 case @id #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * CONFIGURATION #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # when <armor ID> # learn_skill = <skill_id> # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ when 1 # Bronze Shield learn_skill = 1 # Heal when 2 # Iron Shield learn_skill = 69 # Poison Edge #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * 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_equipment_change change_equip def change_equip (equip_type, item, test = false) last_item = equips[equip_type] # Forget the skill from what was previously equipped unless test skill_id = last_item.nil? ? 0 : last_item.skill_id forget_skill (skill_id) if @unnatural_skills.include? (skill_id) @unnatural_skills.delete (skill_id) end # Run original method ma_skill_teaching_items_equipment_change (equip_type, item, test) unless test skill_id = item.nil? ? 0 : item.skill_id unless @skills.include? (skill_id) || skill_id == 0 learn_skill (skill_id) @unnatural_skills.push (skill_id) end 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) for item in equips next if item.nil? skill_id = item.skill_id next if skill_id == 0 || @skills.include? (skill_id) @unnatural_skills.push (skill_id) learn_skill (skill_id) end end end
#============================================================================== # ** Game_Battler (Skill Teaching modification) #------------------------------------------------------------------------------ # This class deals with battlers. It's used as a superclass for the Game_Actor # and Game_Enemy classes. #==============================================================================
class Game_Battler #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Item Test # user : person using item # item : the item being used #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_skill_teaching_items_test_item item_test def item_test (user, item) effective = ma_skill_teaching_items_test_item (user, item) if self.class != Game_Enemy effective |= !@skills.include? (item.skill_id) end return effective end #-------------------------------------------------------------------------- # * Application of Item Effects # item : item #-------------------------------------------------------------------------- alias ma_skill_teaching_items_effect_item item_effect def item_effect (user, item) # Run original method ma_skill_teaching_items_effect_item (user, item) if item.skill_id != 0 && self.class != Game_Enemy && !@skills.include? (item.skill_id) @unnatural_skills.delete (item.skill_id) learn_skill (item.skill_id) end end end
Serious props go to modern algebra for this script. I owe you a drink or a lunch, bro.
__________________________
We exist within all things and all things exist within us... it's very crowded.
Well yeah, currently the script is using integer for the skill ID assigning, so you can't have 2 integers for that. Look like you'll need to use eventing if you intend to do that.
Group: Member
Posts: 71
Type: Scripter
RM Skill: Advanced
Hey nice script.. i definitely gonna use it in one of my projects but i have an idea of an extra option... maybe you could add an bar of exp of some sort that if you used the item long enough to let the skill permanently add to ur skill for example:
when 1 # Dark Dagger earn_skill = 1 # Darkness #Add the option for the timer (or whatever you gonna call it) #If the Dark Dagger has 100 AP (Ability Points) Darkness is available when the Dark Dagger isn't equipped
Its only an idea maybe its not possible but its a nice script anyway..