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.

[FILLED] Unique Skill System

Can't remember the last time I requested a script >.>
anyway this is a combination of both KGC's and Momo Momo's skill equip scripts. What I am asking for is a skill system where a character learns a skill, but cannot use it until it is equipped.

Each skill cost a certain amount of AP/EP or whatever to equip and each character has a maximum number of skills slots (defined by the creator) that they have. Its more or less like Star Ocean 3's skill equip system.

And another thing, I need skills with 0 AP to automatically show up in the skill menu, regardless of whether it is equipped or not (KGC's script had this feature although, it may have been a bug)

This may be tricky, but it can be done. I want the skill the be inaccessible until equipped. This would remove any stat bonuses, status immunities/addons that a skill may have when used together with another script.

Momo Momo did this with his/her skill equip script (I have a ill translated copy of it if you wan't to take a peak.) When I used sephirothspawns actor stat bonus script, I added a skill that would increase a players HP by 10%, when I combined it with momo's script, it ignored the stat bonus until the skill was equipped.

Also if its not to much, could it be a SDK and NON SDK version for the other people that may use the script, if it is every created

If you need a copy of the scripts then let me know ^_^
 
Badda Ba Bump!, Maybe I should've waited another 4 days before I bumped... Anywho I am starting to translate scripts so that should help out with the 100K script request a little.

EDIT: PS How is the new Skill Mana System coming along?
 
I have worked a bit on this, but not much. Have tons to do, so I just skip around script to script.

Haven't touched the skill mana though since I released it, so no updates yet.

@Ultimoore: The new version of the Actor Stat Bonus System I made includes all of that.
 
I thought as much xD, I do the same thing with my projects, work on them until I get bored then got to the next one. Unfortunately, it causes me to make a few unneccesary projects that take up space and time
 
I work about 50 hours a week at a crumby grocery store (no school right now, as I am aiming for a computer programming or engineering job that will pay for school, not that I couldn't get in for free with all my wasted scholarships XD). I script from anywhere to 2-3 hours a day and sleep around the same amount. The rest goes to my family. ^_^

When did this topic become me..?


I have put another 30 minutes into this script, so it should only need about 1 - 2 hours of work left. Should be one of the first follow-up scripts added to the test bed.
 
Well, I actually lost the old script during an upgrade, so I redid the entire system.

Suprisingly though, it only took about an hour and a half. I am not going into great detail on this, since I am pushing a V.4 of my test bed by New Year's Day, so I am just running through everything as fast as possible, concentrating on the scripts themselves now.

Anyways, here it is: (Note: I have done maybe 5 minutes of testing on this. As of now, equipped skills are only bolded and that is all. Let me know if you want this changed to something a little more flashly.)

Code:
#==============================================================================
# ** Skill_Equip
#==============================================================================

module Skill_Equip
  #--------------------------------------------------------------------------
  # * Equip Buttons
  #
  #  ~ Use nil for no button
  #  ~ Keyboard_Equip_Button requires Near Fantastica's Keyboard Module 
  #--------------------------------------------------------------------------
  Input_Equip_Button    = Input::CTRL
  Keyboard_Equip_Button = nil
  #--------------------------------------------------------------------------
  # * Equip Points
  #
  #  ~ Start_Equip_Points = { actor_id => points, ... }
  #  ~ Equip_Points_Level = { actor_id => { level => point, ... }, ... }
  #
  #  Note : Use 0 as actor_id for default for all non-defined actors
  #--------------------------------------------------------------------------
  Start_Equip_Points = {
    0 => 5
  }
  Equip_Points_Level = {}
  #--------------------------------------------------------------------------
  # * Skill Equip Cost
  #
  #  ~ Skill_Equip_Cost = { skill_id => points, ... }
  #  ~ No_Equip_Cost    = [ skill_id, ... ]           Require No Skill Points
  #
  #  Note : Use 0 as skill_id for default for all non-defined skills
  #--------------------------------------------------------------------------
  Skill_Equip_Cost = {
    # Set Default For All At 1
    0 => 1
  }
  No_Equip_Cost    = []
  #--------------------------------------------------------------------------
  # * Equip Slots
  #
  #  ~ Start_Equip_Slots = { actor_id => slots, ... }
  #  ~ Equip_Slots_Level = { actor_id => { level => slots, ... }, ... }
  #
  #  Note : Use 0 as actor_id for default for all non-defined actors
  #--------------------------------------------------------------------------
  Start_Equip_Slots = {
    0 => 5
  }
  Equip_Slots_Level = {}
  #--------------------------------------------------------------------------
  # * Skill Equip Slot Cost
  #
  #  ~ Skill_Equip_Slot_Cost = { skill_id => points, ... }
  #
  #  Note : Use 0 as skill_id for default for all non-defined skills
  #--------------------------------------------------------------------------
  Skill_Equip_Slot_Cost = {
    # Set Default For All At 1
    0 => 1
  }
  #--------------------------------------------------------------------------
  # * Collect Actor Starting Equip Points
  #--------------------------------------------------------------------------
  def self.start_equip_points(actor)
    # Starting Counter
    n = 0
    # Starting Actor Equip Points
    if Start_Equip_Points.has_key?(actor.id)
      n += Start_Equip_Points[actor.id]
    elsif Start_Equip_Points.has_key?(0)
      n += Start_Equip_Points[0]
    end
    # Level Points
    if Equip_Points_Level.has_key?(actor.id)
      Equip_Points_Level[actor.id].each do |level, points|
        if actor.level >= level
          n += points
        end
      end
    elsif Equip_Points_Level.has_key?(0)
      Equip_Points_Level[0].each do |level, points|
        if actor.level >= level
          n += points
        end
      end
    end
    # Return Value
    return n
  end
  #--------------------------------------------------------------------------
  # * Collect Actor Starting Equip Slots
  #--------------------------------------------------------------------------
  def self.start_equip_slots(actor)
    # Starting Counter
    n = 0
    # Starting Actor Equip Points
    if Start_Equip_Slots.has_key?(actor.id)
      n += Start_Equip_Slots[actor.id]
    elsif Start_Equip_Slots.has_key?(0)
      n += Start_Equip_Slots[0]
    end
    # Level Slots
    if Equip_Slots_Level.has_key?(actor.id)
      Equip_Slots_Level[actor.id].each do |level, slots|
        if actor.level >= level
          n += slots
        end
      end
    elsif Equip_Slots_Level.has_key?(0)
      Equip_Slots_Level[0].each do |level, slots|
        if actor.level >= level
          n += slots
        end
      end
    end
    # Return Value
    return n
  end
  #--------------------------------------------------------------------------
  # * Skill Cost
  #--------------------------------------------------------------------------
  def self.skill_cost(skill_id)
    # Return 0 If No Equip Cost
    return 0 if No_Equip_Cost.include?(skill_id)
    # Return Skill Defined Cost
    if Skill_Equip_Cost.has_key?(skill_id)
      return Skill_Equip_Cost[skill_id]
    # Return Default Cost
    elsif Skill_Equip_Cost.has_key?(0)
      return Skill_Equip_Cost[0]
    end
    # Return 0
    return 0
  end
  #--------------------------------------------------------------------------
  # * Skill Slot Cost
  #--------------------------------------------------------------------------
  def self.skill_slot_cost(skill_id)
    # Return Skill Defined Cost
    if Skill_Equip_Slot_Cost.has_key?(skill_id)
      return Skill_Equip_Slot_Cost[skill_id]
    # Return Default Cost
    elsif Skill_Equip_Slot_Cost.has_key?(0)
      return Skill_Equip_Slot_Cost[0]
    end
    # Return 0
    return 0
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :skill_equip_points
  attr_accessor :skill_equip_slots
  attr_accessor :equipped_skills
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_skillequip_gmactr_setup setup
  alias seph_skillequip_gmactr_scu?  skill_can_use?
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(actor_id)
    # Original Setup
    seph_skillequip_gmactr_setup(actor_id)
    # Sets Up Skill Equip Points
    @skill_equip_points = Skill_Equip.start_equip_points(self)
    # Sets Up Skill Equip Slots
    @skill_equip_slots  = Skill_Equip.start_equip_slots(self)
    # Sets Up Equipped Skills
    @equipped_skills = []
  end
  #--------------------------------------------------------------------------
  # * Skill Equipped Test
  #--------------------------------------------------------------------------
  def skill_equipped?(skill_id)
    return Skill_Equip::No_Equip_Cost.include?(skill_id) ||
           @equipped_skills.include?(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Can Equip Skill Test
  #--------------------------------------------------------------------------
  def can_equip_skill?(skill_id)
    return skill_equip_points_left? >= Skill_Equip.skill_cost(skill_id) &&
           skill_equip_slots_left?  >= Skill_Equip.skill_slot_cost(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Skill Points Used?
  #--------------------------------------------------------------------------
  def skill_equip_points_used?
    n = 0
    @equipped_skills.each {|skill_id| n += Skill_Equip.skill_cost(skill_id) }
    return n
  end
  #--------------------------------------------------------------------------
  # * Skill Points Left?
  #--------------------------------------------------------------------------
  def skill_equip_points_left?
    return @skill_equip_points - self.skill_equip_points_used?
  end
  #--------------------------------------------------------------------------
  # * Skill Slots Used?
  #--------------------------------------------------------------------------
  def skill_equip_slots_used?
    n = 0
    @equipped_skills.each do |skill_id|
      n += Skill_Equip.skill_slotcost(skill_id)
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Skill Slots Left?
  #--------------------------------------------------------------------------
  def skill_equip_slots_left?
    return @skill_equip_slots - self.skill_equip_slots_used?
  end
  #--------------------------------------------------------------------------
  # * Skill Can Use Test
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    # If Skill Equipped
    if skill_equipped?(skill_id)
      # Return Original Test
      return seph_skillequip_gmactr_scu?(skill_id)
    end
    # Return False
    return false
  end
  #--------------------------------------------------------------------------
  # * Equip Skill
  #--------------------------------------------------------------------------
  def equip_skill(skill_id)
    # Return If Cannot Equip Skill
    return unless can_equip_skill?(skill_id)
    # Equip Skill
    @equipped_skills << skill_id
  end
  #--------------------------------------------------------------------------
  # * Unequip Skill
  #--------------------------------------------------------------------------
  def unequip_skill(skill_id)
    @equipped_skills.delete(skill_id)
  end
end

#==============================================================================
# ** Window_SkillEquipPoints
#==============================================================================

class Window_SkillEquipPoints < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(320, 400, 320, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 105
    @actor = actor
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(skill_id)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0,  0, 288, 24, 'Skill Equip Slots :')
    self.contents.draw_text(0, 24, 288, 24, 'Skill Equip Points :')
    self.contents.font.color = normal_color
    u = @actor.skill_equip_slots_used?
    m = @actor.skill_equip_slots
    s = Skill_Equip.skill_slot_cost(skill_id)
    p1 = "#{u} / #{m}  ->  #{u + s} / #{m}"
    u = @actor.skill_equip_points_used?
    m = @actor.skill_equip_points
    s = Skill_Equip.skill_cost(skill_id)
    p2 = "#{u} / #{m}  ->  #{u + s} / #{m}"
    self.contents.draw_text(0,  0, 288, 24, p1, 2)
    self.contents.draw_text(0, 24, 288, 24, p2, 2)
  end
end

#==============================================================================
# ** Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias seph_skillequip_wndskl_di draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    # Changes Font Boldness If Skill Equipped
    self.contents.font.bold = @actor.skill_equipped?(@data[index].id)
    # Original Draw Item
    seph_skillequip_wndskl_di(index)
  end
end

#==============================================================================
# ** Scene_Skill
#==============================================================================

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias seph_skillequip_scnskl_main   main
  alias seph_skillequip_scnskl_update update
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Creates Skill Equip Points Window
    a = $game_party.actors[@actor_index]
    @sep_window = Window_SkillEquipPoints.new(a)
    # Original Main Processing
    seph_skillequip_scnskl_main
    # Dispose Skill Equip Points Window
    @sep_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Skill Equip Update
    skill_equip_update
    # Original Update
    seph_skillequip_scnskl_update
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Skill Equip
  #--------------------------------------------------------------------------
  def skill_equip_update
    # If Last Index Changed
    if @last_index != @skill_window.index
      @sep_window.refresh(@skill_window.skill.id)
      @last_index = @skill_window.index
    end
    # If Non-nil Input Button
    unless (button = Skill_Equip::Input_Equip_Button).nil?
      # If Button is Pressed
      if Input.trigger?(button)
        # Equip Skill
        equip_skill
      end
    end
    # If Keyboard Enabled
    if SDK.state('Keyboard Input')
      # Update Keyboard Module
      Keyboard.update
      # If Non-nil Keyboard Button
      unless (button = Skill_Equip::Keyboard_Equip_Button).nil?
        # If Button is Pressed
        if Keyboard.trigger?(button)
          # Equip Skill
          equip_skill
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Equip Skill
  #--------------------------------------------------------------------------
  def equip_skill
    # Gets Skill Data
    skill = @skill_window.skill
    # If Free Skill
    if Skill_Equip::No_Equip_Cost.include?(skill.id)
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # Gets Equipped State
    equipped = @actor.skill_equipped?(skill.id)
    # If Equipped
    if equipped
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Unequip skill
      @actor.unequip_skill(skill.id)
      # Redraw Skill Item
      @skill_window.draw_item(@skill_window.index)
      # Refresh Skill Equip Points Window
      @sep_window.refresh(@skill_window.skill.id)
      return
    end
    # If Cannot Equip
    unless @actor.can_equip_skill?(skill.id)
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      # Set Help Text
      @help_window.set_text('Not Enough Skill Equip Points')
      return
    end
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Equip skill
    @actor.equip_skill(skill.id)
    # Redraw Skill Item
    @skill_window.draw_item(@skill_window.index)
    # Refresh Skill Equip Points Window
    @sep_window.refresh(@skill_window.skill.id)
  end
end

Just let me know.
 
as far as the visuals, its fine nice job, oh and on line 216 I had to change
n += Skill_Equip.skill_slotcost(skill_id) to

n += Skill_Equip.skill_slot_cost(skill_id) to get it running. I was getting a no method error at first :p
 

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