Main Menu
  • Welcome to The RPG Maker Resource Kit.

Skill Learning Script

Started by magic2345, January 28, 2007, 06:43:23 AM

0 Members and 1 Guest are viewing this topic.

magic2345

Do someone know any good skill learning scripts that is very easy to use and not very complicated and compatible with the SDK and is not in download form?
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

modern algebra

What type of skill learning script are you looking for? Skill shop? Learning through use?

magic2345

I'm looking for the one that needs AP to learn, like in Final Fantasy IX/9

If a character equips a weapon or armor the skill can be used,
but when the character unequip the weapon or armor, the skill can't be used,
to learn that particular skill, you have to equip the weapon or armor and kill enemies to get AP. Every skill needs at least some AP so that it can be learned and used even if the character doesn't equip the weapon or armor.

Thanks in advance and sorry for the bad english.
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

&&&&&&&&&&&&&

&&&&&&&&&&&&&&&&

magic2345

Thats not what I'm looking for...I need it so that when the charcter has enough AP, he still can use the skill even if he doesn't equip it anymore....Like in FFTA or FFIX (as mentioned above)

Thanks anyway,
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

kathis

you could contact blizzard about this he might have some information on it.
Project
New project. The other dimention DND
RPG makers challenge http://rmrk.net/index.php/topic,13503.0.html

Blizzard

SephirothSpawn has made exactly such a script. It's called Equipment Skills, you can find it on http://hbgames.org/forums
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

magic2345

Hey, Thanks! I found it!
But I have a question for those that are an expert scripters. THe instructions said that the code for calling the AP equip screen is: $scene = Scene_Set_Ability.new(ActorID)
The question is...Where do I put it? Do I need to edit the scene_title or something?

The script is:


# Ability System
# By Momomo
#
# Calling ability, it equips and/or removes skill
# and/or we would like to see mono is
# Setting AP, consuming that, you attach and it
# reaching the point where you can remove, you increase.
# Only the ability which is in the midst of equipping,
# is regarded acquisition skill
#
# Event Command
# $scene = Scene_Set_Ability.new(ActorID)
# So, it moves to the equipment scene
#
# When we would like to make equip mandatorily
# in the event and the like, in "event command"
# $game_actors[ActorID].equip_ability(SkillID)
# When with it inputs, it becomes a state where it is equipped
# Furthermore, this time ignoring AP, it is equipped mandatorily
# When the skill which you have not remembered is appointed
# However it is not recorded before the equipment picture, it
# becomes to have equipped
# To forget:
# $game_actors[ActorID].remove_ability(SkillID)
#
#
# By the way with the largest AP decrease by the decrease of level
# Doing, increase the processing when entire AP which is in the midst
# of equipping exceeds maximum AP it is. (-3/16 it is indicated)
#
# 2005.4.29 ??
# ????????
# ??????????????(equip_ability)???(remove_ability)??
# ??HP???SP????????????
#
# 2005.7.18 ??
# ????????????
# ????????????????
#
# 2006.7.22 ??
# ????????1?????????????????????????

module Ability_System_Config
  # AP growth value setting of actor
  # AP = initial value + (LV - 1) * growth value
  # Or less of the decimal point is the cutoff
  # Ap_up [ actor ID ] = [ initial value and growth value ]
  ap_up = []
  ap_up[0]   = [10, 1.0] #value
  ap_up[1]   = [15, 1.5]
  ap_up[2]   = [ 5, 1.0]
  ap_up[7]   = [12, 1.5]
  ap_up[8]   = [16, 1.8]
  AP_UP = ap_up
 
  # Maxium AP
  AP_MAX = 99
 
  # Fixed Ability
  # Abilities that cannot be removed
  FIX_ABILITY = [81, 82, 83, 84, 85, 86, 87, 88, 89]
 
  # The setting of necessity AP
  # Ap [ skill ID ] = necessity AP
  ap = []
  ap[0]   = 0 #value
  ap[1]   = 1
  ap[2]   = 5
  ap[3]   = 10
  ap[57]  = 3
  NEED_AP = ap
 
  # AP Name
  AP_NAME = "AP"
  # The character string which indicates necessity AP
  NEED_AP_TEXT = "AP yang diperlukan"
  # While equipping display color of ability
  EQUIP_ABILITY_COLOR  = Color.new(128, 255, 128, 255)
 
  # Indication setting classified by type of ability
  # The type name which it indicates
  ABILITY_KIND_NAME = ["Attack","Recovery","Other","Everything"]
  # The attribute name for type decision which is granted to skill
  ABILITY_ELEMENT_NAME = ["Attack","Recovery","Other","Everything"]
end

class Game_Actor < Game_Battler
  include Ability_System_Config
end

class Window_Set_Ability < Window_Selectable
  include Ability_System_Config
end

class Window_AbilityStatus < Window_Base
  include Ability_System_Config
end
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor_id : ???? ID
  #--------------------------------------------------------------------------
  alias ability_system_initialize initialize
  def initialize(actor_id)
    @ability = {} # ????????? {id => 0}
    @ability_skill = [] # ??????ID???
    ability_system_initialize(actor_id)
  end
  # AP??????
  def ap_up
    if AP_UP[self.id] == nil
      b_ap = AP_UP[0]
    else
      b_ap = AP_UP[self.id]
    end
    return b_ap
  end
  # ??AP??
  def base_ap
    up = ap_up
    n = up[0] + (self.level - 1) * up[1]
    return n.truncate
  end
  # ??AP??
  def max_ap
    n = base_ap
    return [n, AP_MAX].min
  end
  # ??AP??
  def ap
    return max_ap - total_need_ap
  end
  # ??AP???
  def need_ap(skill_id)
    if NEED_AP[skill_id] != nil
      needap = NEED_AP[skill_id]
    else
      needap = NEED_AP[0]
    end
    return needap
  end
  # ??ID?????????????
  def ability_equip_ok?(skill_id)
    if self.ap < need_ap(skill_id)
      return false
    end
    return true
  end
  # ???????????
  def add_ability(skill_id)
    unless @ability_skill.include?(skill_id)
      @ability_skill.push(skill_id)
      @ability_skill.sort!
    end
  end
  # ???????????
  def del_ability(skill_id)
    @ability_skill.delete(skill_id)
  end
  # ?????????
  def ability_initialize(skill_id)
    if ability_fix?(skill_id)
      @ability[skill_id] = 1
      add_ability(skill_id)
    else
      @ability[skill_id] = 0
    end
  end
  # ??????????
  def equip_ability(skill_id)
    @ability[skill_id] = 1
    add_ability(skill_id)
    hpsp_max_check
  end
  # ??????????
  def remove_ability(skill_id)
    @ability[skill_id] = 0
    del_ability(skill_id)
    hpsp_max_check
  end
  # ??ID???????????????
  def ability_equip?(skill_id)
    unless @ability.include?(skill_id)
      ability_initialize(skill_id)
    end
    return false if @ability[skill_id] == 0
    return true
  end
  # ??ID?????????????
  def ability_fix?(skill_id)
    if FIX_ABILITY.include?(skill_id)
      return true
    else
      return false
    end
  end
  # ????????????AP
  def total_need_ap
    n = 0
    for id in self.skills
      n += need_ap(id)
    end
    return n
  end
  # ?????????
  def og_skills
    return @skills
  end
  # ??????????????
  def skills# ???
    return @ability_skill
  end
  def hpsp_max_check
    # HP ??? SP ????????
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias ability_system_learn_skill learn_skill
  def learn_skill(skill_id)
    ability_system_learn_skill(skill_id)
    if @skills.include?(skill_id) and @ability != nil
      unless @ability.include?(skill_id)
        ability_initialize(skill_id)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias ability_system_forget_skill forget_skill
  def forget_skill(skill_id)
    ability_system_forget_skill(skill_id)
    remove_ability(skill_id)
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #     skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias ability_system_skill_learn? skill_learn?
  def skill_learn?(skill_id)
    if ability_system_skill_learn?(skill_id) or @ability_skill.include?(skill_id)
      return true
    else
      return false
    end
  end
end


class Window_Set_Ability < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor : ????
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 640, 352)
    @actor = actor
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh(index=0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.og_skills.size
      skill = $data_skills[@actor.og_skills[i]]
      if skill != nil and
         skill.element_set.include?(MoMo_Get_Element.get_element_id(ABILITY_ELEMENT_NAME[index]))
        @data.push(skill)
      end
    end
    # ???? 0 ??????????????????????
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #     index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.ability_equip?(skill.id)
      opacity = 255
      self.contents.font.color = EQUIP_ABILITY_COLOR
    else
      if @actor.ability_equip_ok?(skill.id)
        opacity = 255
        self.contents.font.color = normal_color
      else
        opacity = 128
        self.contents.font.color = disabled_color
      end
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
   
    self.contents.draw_text(x + 316, y, 204, 32, NEED_AP_TEXT, 2)
    self.contents.draw_text(x + 548, y, 48, 32, @actor.need_ap(skill.id).to_s, 2)
   
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  end
end

class Window_AbilityStatus < Window_Base
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor : ????
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 64, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_hp(@actor, 284 - 140, 0)
    draw_actor_sp(@actor, 460 - 140, 0)
    draw_actor_ap(@actor, 496, 0)
  end
  def draw_actor_ap(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 48, 32, AP_NAME, 0)
    self.contents.font.color = normal_color
    text = actor.ap.to_s + "/" + actor.max_ap.to_s
    self.contents.draw_text(x, y, 112, 32, text, 2)
  end
end

class Scene_Set_Ability
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor_index : ??????????
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def main
    # ???????
    @actor = $game_party.actors[@actor_index]
    # ???????????????????????????????
    @help_window = Window_Help.new
    @status_window = Window_AbilityStatus.new(@actor)
    @skill_window = Window_Set_Ability.new(@actor)
    @skill_window.active = false
    # ??????????
    command = Ability_System_Config::ABILITY_KIND_NAME
    @kind_window = Window_Command.new(160, command)
    @kind_window.z = 110
    @kind_window.x = 320 - @kind_window.width / 2
    @kind_window.y = 240 - @kind_window.height / 2
    @kind_window.active = true
   
    # ???1??????????????????????
    if command.size == 1
      @no_kindselect = true
      @skill_window.active = true
      @kind_window.active = false
      @kind_window.visible = false
    end
   
    # ?????????????
    @skill_window.help_window = @help_window
    # ?????????
    Graphics.transition
    # ??????
    loop do
      # ????????
      Graphics.update
      # ???????
      Input.update
      # ??????
      update
      # ????????????????
      if $scene != self
        break
      end
    end
    # ?????????
    Graphics.freeze
    # ????????
    @help_window.dispose
    @status_window.dispose
    @skill_window.dispose
    @kind_window.dispose
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    # ????????
    @help_window.update
    @status_window.update
    # ????????????????: update_kind ???
    if @kind_window.active
      update_kind
      return
    end
    # ?????????????????: update_skill ???
    if @skill_window.active
      update_skill
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (????????????????)
  #--------------------------------------------------------------------------
  def update_kind
    @kind_window.update
    # B ??????????
    if Input.trigger?(Input::B)
      # ????? SE ???
      $game_system.se_play($data_system.cancel_se)
      # ??????????
      $scene = Scene_Map.new
      return
    end
    # C ??????????
    if Input.trigger?(Input::C)
      # ?? SE ???
      $game_system.se_play($data_system.decision_se)
      @kind_window.active = false
      @kind_window.visible = false
      @skill_window.active = true
      @skill_window.index = 0
      @skill_window.refresh(@kind_window.index)
      return
    end
    # R ??????????
    if Input.trigger?(Input::R)
      # ???? SE ???
      $game_system.se_play($data_system.cursor_se)
      # ???????
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # ????????????
      $scene = Scene_Set_Ability.new(@actor_index)
      return
    end
    # L ??????????
    if Input.trigger?(Input::L)
      # ???? SE ???
      $game_system.se_play($data_system.cursor_se)
      # ???????
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # ????????????
      $scene = Scene_Set_Ability.new(@actor_index)
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (?????????????????)
  #--------------------------------------------------------------------------
  def update_skill
    # B ??????????
    if Input.trigger?(Input::B)
      # ????? SE ???
      $game_system.se_play($data_system.cancel_se)
      if @no_kindselect
        # ??????????
        $scene = Scene_Map.new
      else
        @kind_window.active = true
        @kind_window.visible = true
        @skill_window.active = false
      end
      return
    end
    # C ??????????
    if Input.trigger?(Input::C)
      # ????????????????????????
      @skill = @skill_window.skill
      # ?????????
      if @skill == nil
        # ??? SE ???
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # ??????
      if @actor.ability_equip?(@skill.id)
        # ??????????
        if @actor.ability_fix?(@skill.id)
          # ??? SE ???
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # ????
        @actor.remove_ability(@skill.id)
        # ?? SE ???
        $game_system.se_play($data_system.equip_se)
      else
        # ????????????
        unless @actor.ability_equip_ok?(@skill.id)
          # ??? SE ???
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # ??
        @actor.equip_ability(@skill.id)
        # ?? SE ???
        $game_system.se_play($data_system.equip_se)
      end
      @skill_window.refresh(@kind_window.index)
      @status_window.refresh
      return
    end
    # R ??????????
    if Input.trigger?(Input::R)
      # ???? SE ???
      $game_system.se_play($data_system.cursor_se)
      if @no_kindselect
        # ???????
        @actor_index += 1
        @actor_index %= $game_party.actors.size
        # ????????????
        $scene = Scene_Set_Ability.new(@actor_index)
      else
        # ?????
        @kind_window.index += 1
        @kind_window.index %= Ability_System_Config::ABILITY_KIND_NAME.size
        @skill_window.index = 0
        @skill_window.refresh(@kind_window.index)
      end
      return
    end
    # L ??????????
    if Input.trigger?(Input::L)
      # ???? SE ???
      $game_system.se_play($data_system.cursor_se)
      if @no_kindselect
        # ???????
        @actor_index += $game_party.actors.size - 1
        @actor_index %= $game_party.actors.size
        # ????????????
        $scene = Scene_Set_Ability.new(@actor_index)
      else
        # ?????
        @kind_window.index += Ability_System_Config::ABILITY_KIND_NAME.size - 1
        @kind_window.index %= Ability_System_Config::ABILITY_KIND_NAME.size
        @skill_window.index = 0
        @skill_window.refresh(@kind_window.index)
      end
      return
    end
    # ????????
    @skill_window.update
  end
end


Thanks!
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

Blizzard

There is an event command called "Call script". Type this text in there and it will be excuted during that event.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

magic2345

I knew that...but I wanted so that it is on the Menu. When I select skill it goes to the AP equip screen...I know something in the scripts have to be changed but I'm not a scripter as scripts are very confusing.....

Thanks,
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

Blizzard

Ah, I see. That's quite simple.

http://rmrk.net/index.php/topic,7193.0.html

Read the part that under 6. a). :)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

magic2345

Nope, doesn't work....hey...maybe its not supposed to be used in the script, maybe its supposed to be used in the events section... What if I make an item that transfers it to the screen! Using common events!....Trying.....Well, its hard.....
Maybe someone can help me? I tried and ended up putting too much Conditional Branches....
Can some do it so that if only the main hero(actor 1) is in the party, it automaticaly goes to his AP equip screen. If there are two heroes in the party, it shows up a choice between those two. If there are three heroes, it shows up between the three. BUT, if the second hero left and only the main and third hero, the choice is between the two, the second hero excluded.
I know its supposed to use tons of conditional branches, but if anyone know a better and easier way, by all means tell me.

Thanks,
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

Irgna

I can do it, but I have to replace another option in the main menu to do so, will that be good?
PROPERTY OF TEABAG!!! ALL HAIL TEABAG!!!

magic2345

Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%

Irgna

Oh, crap... I can't do it after all, it requires me to do something I haven't learned yet... Sorry...
PROPERTY OF TEABAG!!! ALL HAIL TEABAG!!!

modern algebra

#15
SO all you want is to add the option to open that script in the menu? Are you using default menu or a CMS?

For default, it is just a matter of going into scene_menu and adding a few things.

Note:
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"


To add another option, just make an s7 = "Equipment Skills" or something, then change this line:

    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
to this:
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])

And then you have to set what the option does, so go down the script until you find this:
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new


and then add:
      when 6   #equipment skills
        #Play decision SE
        $game_system.se_play($data_system.decision_se)
        #Make status Window Active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0


Then go down the code and find:
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)


and then add:

      when 6  # equipment skills
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Set_Ability.new(@status_window.index)


That should add in the option to access that script from the menu. I just did it quick so there might be errors, but generally that's how you add in options. You'll probably need to resize some windows as well.

Irgna

Hey, thanks, I needed to know how to do that kind of stuff and was about to make a post asking how to do that.
PROPERTY OF TEABAG!!! ALL HAIL TEABAG!!!

magic2345

Yay! It works!! But I need to do it in another project....maybe a script in my project is overriding it....anyways, can you tell me how to resize windows and stuff?

Thanks,
Game I'm Working on:
-ADVENT-
Progress:
Story: 96%
Maps: 4%
Characters: 70%