Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skill Learning Script

I got this script from SephirothSpawn. here is the script that i adapted

Code:
class Game_Actor < Game_Battler
  # actor_id => {skill_id => {item_id => times to be used, ...}, ...}
  # use 0 as actor id for all actors
  Item_Use_To_Skills = {
  1 => {
    57 => {13 => 3}, 
    58 => {16 => 3}, 
    60 => {18 => 5}
    },
  7 => {
    1 => {1 => 25},
    2 => {2 => 40},
    3 => {3 => 50},
    4 => {12 => 10},
    5 => {12 => 30},
    6 => {9 => 5},
    25 => {37 => 20},
    26 => {37 => 30},
    27 => {37 => 40},
    53 => {39 => 20},
    54 => {39 => 30},
    55 => {39 => 40},
    },
  8 => {
   7 => {33 => 5},
   8 => {33 => 10},
   9 => {33 => 15},
   10 => {34 => 5},
   11 => {34 =>10},
   12 => {34 => 15},
   13 => {35 => 5},
   14 => {35 => 10},
   15 => {35 => 15},
   16 => {42 => 5},
   17 => {42 => 10},
   18 => {42 => 15},
   19 => {36 => 5},
   20 => {36 => 10},
   21 => {36 => 15},
   22 => {43 => 5},
   23 => {43 => 10},
   24 => {43 => 15},
   },
  9 => {
   28 => {38 => 5},
   29 => {38 => 10},
   30 => {38 => 15},
   82 => {36 => 10},
   83 => {43 => 10},
   84 => {34 => 10},
   85 => {33 => 10},
  },
  10 => {
   35 => {41 => 3},
   36 => {41 => 6},
   37 => {41 => 9}, 
   38 => {41 => 12},
   39 => {41 => 15},
   40 => {41 => 18},
   41 => {41 => 21},
   42 => {41 => 24},
   43 => {41 => 27},
   44 => {41 => 30},
   45 => {41 => 33},
   46 => {41 => 36},
   47 => {41 => 39},
   48 => {41 => 42},
   49 => {41 => 45},
   50 => {41 => 48},
   51 => {41 => 51},
   52 => {41 => 54},
   31 => {41 => 5},
   32 => {41 => 8},
   33 => {41 => 14},
   34 => {41 => 25},
  },
  }
  alias seph_useitems4skills_gmactr_setup setup
  alias seph_useitems4skills_gmactr_ie item_effect
  def setup(actor_id)
    seph_useitems4skills_gmactr_setup(actor_id)
    @skill_item_use = {}
  end
  def skill_item_use_count(item_id)
    return @skill_item_use.has_key?(item_id) ?
      @skill_item_use[item_id] : 0
  end
  def item_effect(item)
    seph_useitems4skills_gmactr_ie(item)
    @skill_item_use[item.id] = 0 unless @skill_item_use.has_key?(item_id)
    @skill_item_use[item.id] += 1
    Item_Use_To_Skills.each do |actor_id, skill_data|
      next unless [0, self.id].include?(actor_id)
      skill_data.each do |skill_id, usage_req|
        next if self.skills.include?(skill_id)
        learn_skill = true
        usage_req.each do |item_id, n|
          learn_skill = false if n > skill_item_use_count(item_id)
        end
        if learn_skill
          self.learn_skill(skill_id)
        end
      end
    end
  end
end

here is the link for his post
http://www.rmxp.org/forums/showthread.php?t=8033

I keep getting error messages. Can someone please help?
 
no worries i understand that ur busy lol.. it says

??????? 'Item Learning' ? 90 ??? NameError ????????
undefined local variable or method 'item_id' for #<Game_Actor:0x46ef528>
 
kk will try.. thanks again for creating this script... maybe one day you could show me how to script?.. ive read the tutorials and all that but im still confused as ever.. lol
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top