RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Skill Teaching Equipment & Items (VX Edition)

0 Members and 2 Guests are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Skill Teaching Equipment & Items
Version: 2.0b
Author: modern algebra
Date: February 20, 2010

Version History


  • <Version 2.0b> 02.20.2010 - Fixed error that, if a skill was learned through natural means while an equipped item already taught the skill, then the skill would disappear upon unequip.
  • <Version 2.0> 06.28.2008 - New configuration, as well as multiple skills per Item
  • <Version 1.0> 01.27.2008 - Original release

Description


This script allows you to assign skills to items, weapons and armors. When assigned to an item, it is possible to permanently learn the skill assigned when the item is used. For weapons and armors, you are able to learn the skill while the weapon or armor is equipped. Once the weapon or armor is unequipped, you will no longer have access to that skill.

Features

New in Version 2.0:

  • Configuration is done in the Notes Field of the respective items. See the instructions for details
  • One item, weapon, or armor can now teach more than one skill
  • You can now set a level requirement for the weapons, armors, or items to teach the skill. So, if you want a Long Sword to teach Fire, but you want the actor to be level 10 before he gets it, the script can now perform that task.

Original:

  • Allows items to teach actors skills permanently
  • Allows weapon and armor to teach the actor skills for as long as he has the respective equipment equipped
  • Very intuitive configuration; it is easy to set up

Screenshots

N/A for this type of script

Instructions


Insert this script just above Main.
To configure this script, merely go into the item, weapon, or armor in the database. In the Notes Field, put in this code:

        \ls[skill_id, level_min]

  where skill_id is the ID of the skill you want the item to teach and level_min is optional and makes it so that the skill the item teaches is only taught if the actor is at least that level. If it's left blank, it is assumed that there is no level requirement.
  
 You can put in as many of these as you like, so if, for example, an item has this in it's notes:

       \ls[5]
       \ls[8, 7]

 Then that item would teach skill 5 no matter what level the actor is, and once the actor reaches level 7 will teach skill 8. The script will take every instance of that code regardless of what else is in the Note Field

Script


Code: [Select]
#==============================================================================
#  Skill Teaching Equipment & Items
#  Version 2.0b
#  Author: modern algebra (rmrk.net)
#  Date: February 20, 2010
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Insert this script just above Main.
#
#    To configure this script, merely go into the item, weapon, or armor in the
#   database. In the Notes Field, put in this code:
#
#        \ls[skill_id, level_min]
#
#      where skill_id is the ID of the skill you want the item to teach and
#     level_min is optional and makes it so that the skill the item teaches
#     is only taught if the actor is at least that level. If it's left blank,
#     it is assumed that there is no level requirement.
#   
#    You can put in as many of these as you like, so if, for example, an item
#   has this in it's notes:
#
#       \ls[5]
#       \ls[8, 7]
#
#    Then that item would teach skill 5 no matter what level the actor is, and
#   once the actor reaches level 7 will teach skill 8. The script will take
#   every instance of that code regardless of what else is in the Note Field
#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#    Summary of Changes:
#      new method - skill_ids
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill IDs
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def skill_ids
    # Only works for Item, Weapon, and Armor
    return if self.class == RPG::Skill
    learn_skills = []
    # Dissect Note
    text = self.note.dup
    while text[/\\ls\[(\w+),*\s*(\d*?)\]/i] != nil
      text.sub! (/\\ls\[(\w+),*\s*(\d*?)\]/i) { '' }
      learn_skills.push ([$1.to_i, $2.to_i])
    end
    return learn_skills
  end
end 

#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - change_equip, setup, level_up
#==============================================================================

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)
    unless test
      last_item = equips[equip_type]
      # Forget the skills from what was previously equipped
      skill_ids = last_item.nil? ? [] : last_item.skill_ids
      skill_ids.each { |skill_id|
        forget_skill (skill_id[0]) if @unnatural_skills.include? (skill_id[0])
        @unnatural_skills.delete (skill_id[0])
      }
    end
    # Run original method
    ma_skill_teaching_items_equipment_change (equip_type, item, test)
    unless test
      last_item = equips[equip_type]
      # Learn the skills from current_equipment
      skill_ids = last_item.nil? ? [] : last_item.skill_ids
      skill_ids.each { |skill_id|
        unless skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
          @unnatural_learning = true
          learn_skill (skill_id[0])
          @unnatural_learning = false
        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?
      item.skill_ids.each { |skill_id|
        next if skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
          @unnatural_learning = true
          learn_skill (skill_id[0])
          @unnatural_learning = false
      }
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Level Up
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_skl_teacher_equip_actor_lvlup level_up
  def level_up
    modalg_skl_teacher_equip_actor_lvlup
    # Check Equipment and learn skills if not already learned
    equips.each { |item|
      next if item == nil
      item.skill_ids.each { |skill_id|
        unless skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
          @unnatural_learning = true
          learn_skill (skill_id[0])
          @unnatural_learning = false
        end
      }
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Learn Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_lrnskll_eqpmnt_8ik2 learn_skill
  def learn_skill (skill_id, *args)
    if @unnatural_learning
      @unnatural_skills.push (skill_id) unless @unnatural_skills.include? (skill_id)
    elsif skill_learn? (skill_id)
      @unnatural_skills.delete (skill_id)
    end
    ma_lrnskll_eqpmnt_8ik2 (skill_id, *args)
  end
end

#==============================================================================
# ** Game_Battler (Skill Teaching modification)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - item_test, item_effect
#==============================================================================

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
      item.skill_ids.each { |skill_id|
        effective |= !skill_learn? ($data_skills[skill_id[0]]) && self.level > skill_id[1]
      }
    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)
    item.skill_ids.each { |skill_id|
      learn_skill (skill_id[0]) if self.class != Game_Enemy && self.level > skill_id[1]
    }
  end
end

Credit


  • modern algebra

Thanks

  • ryu009, for requesting the script

Support


Just post in this topic at rmrk for quick support

Known Compatibility Issues

Should be compatible with any script that does not perform the same function as this one. If any issues arise, I wwill be happy to fix them for you.

Demo


See attached.

Author's Notes


This script was requested by ryu009 (for weapons, at least: I decided to expand upon his request though).


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 20, 2010, 06:44:59 PM by Modern Algebra »

**
Rep: +0/-0Level 86
Ryu is the best!
Awesome script thanks :) i bought RMVX on the first day it came out, I've been waiting for it forever.  It's finally here.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Updated to Version 2.0

I have changed the way the script is configured. I think it is now easier to deal with. See the Instructions for details.
It is also now possible to have one item, weapon, or armor teach more than one skill.

You may think this wasn't worth an entire update to 2.0 - but the script is not very large, and so it was rather major in that regard.

**
Rep: +0/-0Level 85
Hey modernalgebra this is an awesome script!  2 questions though:

1.) Is there a way to make it so different items memorize skills at different rates?  If so could you tell me, if not, would there be possibly an easy bit of code I could paste into the script to accomplish this?

2.)  Is there a way to make it so items give skills to only certain characters?  Same thing as above, if there's an easy code I could paste in that would be awesome.  If it's a little more extensive than that I realize this is not the place to ask you to make complex code updates.

Thanks!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
I don't really know what you are asking for.

If you mean have the item teach one skill at level 5 and then another at level 10, that's what the level_min argument is for.

**
Rep: +0/-0Level 85
Ah you know what I totally misread the script.  I was reading that items can permanently teach a skill to a character, and thought it applied to equipment as well.

An example of what I was thinking would be like:  Weapon Short Sword gives skill slash when equipped.  Every time character uses skill slash in battle it adds to an AP for that skill.  When the AP reaches whatever AP is needed to permanently memorize the skill, the skill is memorized and the equipment no longer needed.  I've been looking for a script like this that is compatible with the tentekai sideview battle script, but to no avail.  Your script is the closest though! 

If only I were smart I could maybe come up with something on my own. :(

On that same note though, is there still a way to restrict who can learn skills?  For instance:  If i have as magic scroll, I only want mage actors to be able to learn it.  Can I prevent warriors from using the item?  Same goes for equipment.  Can I have a sword give a skill to a Barbarian character, but no skill or even a different skill to a Paladin?

My guess is no from what I'm reading in your description of the script, but maybe you're expert skills in scripting know of a little fix I could add into my script to get any of these above features to work?
« Last Edit: July 22, 2008, 04:46:52 AM by gabiot »

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Hmm. I actually was wondering the same thing. If you're familiar with the way Abilities are learned in FFIX, that is what I was specifically wondering.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
@gabiot - this script does not, but you can use this script in conjunction with Equipment Requirements and it can restrict who uses what.

As for the permanence thing, I'll think about it.
« Last Edit: July 22, 2008, 12:32:13 PM by modern algebra »

**
Rep:
Level 85
Great script! I like it alot, and will be using it if you don't mind. Don't worry; you will be accredited.
yes!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
I'm glad you like it. :P

And of course I don't mind - that's what it's here for.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Any thought on including to learn skills permanently over time with the equipped gear?  :P

--Edit--
I totally found a script that is exactly like learning abilities in FFIX. Difference being is that it doesn't use items to teach skills.
« Last Edit: August 01, 2008, 01:03:15 AM by grafikal007 »

**
Rep:
Level 84
I want to know the script that is like FFIX. could you please let me know where it is

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
it shouldn't be too hard to modify this to make it an EQ-AP system.

If modern is alright with it I may be able to mod this into the FFIX system.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
grafikal said that he had found one. I don't know if it's the same or not, though.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
grafikal said that he had found one. I don't know if it's the same or not, though.

if he had posted a link I wouldn't have offered
Cloud 2010 is also looking for the same thing.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

**
Rep: +0/-0Level 84


**
Rep: +0/-0Level 84
Hm. I´m getting an error at line 74:

forget_skill (skill_id[0]) if @unnatural_skills.include? (skill_id[0])


Error:

NoMethodError occured
undefined method `include?´for nil:NilClass

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
That's strange. Are you using any other scripts?

**
Rep: +0/-0Level 84
Yep. I few. Several KGC scripts, your advanced areas and quest script, plus Neo Message System, Face Battlers, Skill Shop and GoodVSEvil...

On of the KGC scripts is Passive Skills (wich also gives an error here: "if last_effects [:two_swords_style] != nil &&"... I solved that by taking
out the []... that is probably not a good idea, but the game works)...

When I remove Passive Skills, your script is giving an error at line 87 instead.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
What is the error given at line 87?

Actually, can you just upload your scripts.rvdata? I'll put it in a project.


*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, I've taken a look. I was not able to get an error, but I did play around a bit and there are some pretty weird things going on.

For instance, try unequipping Ralph's shield and re-equipping.

I deleted this script, and both KGC Equipment scripts and it was still happening so I don't know what script is doing that.

**
Rep: +0/-0Level 84
Okay, thanks for your support and efforts anyway!

I guess I´ll have to fiddle around with them some more. Great script by the way, I´d love to get it to work!

**
Rep: +0/-0Level 84
Not to sound disrespectful but couldn't this be done pretty easily with events?