Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Showing only specific skills in a window
#1
Hey

I think I need a little bit of help with scripting once again. ^^"

I'm using a Skill Equipment System and I only want to show skills in the window which have a database ID higher than 245. (There are some passive skills in my game which should not be equipable but still added to the actor's skills of course.)

And well, I really don't know how to do that. I already managed to make them "invisible" but they are still there as blank fields.

Here is the script:

Code:
#===============================================================================
# Skill Equipment System
# Author game_guy
# Editted by KK20
# Version 1.4
#-------------------------------------------------------------------------------
# Intro:
# Okay well its a system that makes it so you can't use all of your skills at
# once while in battle. Instead you have to equip them. Now here's the catch.
# Every skill has its own "ap" so when its equipped it takes some of the actor's
# ap. That way you can't use all of your skills and it adds some uniqueness to
# the game.
#
# Features:
# Equip Skills Strategically
# Only Equip Limited Amount of Skills Using Ap
# Have Different Starting Ap for Each Actor
# Have Different Ap Gain for Each Actor per Level Up
# Have Different Ap for Each Skill
# Have an Exit Scene for When the Skill Equipment Closes
#
# Instructions:
# Okay so these could be confusing but lets try and get through this.
# Okay they're not that confusing. Okay so go down where it says
# # Begin Config
# And do all of you're configuration there.
#
# Now theres some stuff you need to know.
#
# When adding a skill it does not automatically equip it. So to equip a
# skill use this
# $game_actors[actor_id].equip_skill(skill_id)
# To unequip a skill use this
# $game_actors[id].remove_skill(skill_id)
#
# Now it will not equip it unless there's enough ap left. So you can either do
# this $game_actors[id].add_map(amount) to add to max ap or you can do this
# $game_actors[id].clear_skills to unequip all skills and give all ap back.
# Just to make it a bit easier.
#
# You can always remove max ap to by doing this
# $game_actors[id].remove_map(amount) but note that doing that clears the
# equipped skills as well to avoid any problems.
#
# To open the skill equipment scene use this.
# $scene = $scene = Scene_SkillEquip.new(actor_id)
# To tell if a skill is equipped or not you'll notice the text is greyed out.
# That means it equipped. If its white it means it can be equipped.
# In the scene though to equip/unequip things just press the action button.
#
# Well thats about it.
# Credits:
# game_guy ~ for making it
# Ethan ~ for the idea of it
# Branden ~ beta testing
#
# Enjoy and give credits.
#===============================================================================
# [ KK20's change notes ]
#
# V 1.4
#   - Cleaned up and modified a bit of the existing methods in Game_Actor
#   - Fixed the AP display in the window
#   - Allow user to show the skill's AP cost instead of its SP cost in the scene
#   - Added new feature: Permanent Skills
#     + Skills can be permanently equipped
#     + Script call for this is as follows:
#       $game_actors[id].learn_skill(skill_id, true)
#   - Added new feature: Skill Limitations
#     + Certain skills cannot be equipped together at the same time
#===============================================================================
module GameGuy
 #---------------------------------------------------------------------------
 # ApWord     = This is the word that displays when showing the ap the actor
 #              has.
 #---------------------------------------------------------------------------
 ApWord       = "Verfügbare Skills"
 #---------------------------------------------------------------------------
 # StartingAp = The starting ap for every actor. Different amounts can be
 #              defined below at # Config Starting Ap.
 #---------------------------------------------------------------------------
 StartingAp   = 14
 #---------------------------------------------------------------------------
 # ApCost     = The default ap cost for all skills. Different amounts can be
 #              defined below at # Config Ap Costs.
 #---------------------------------------------------------------------------
 ApCost       = 1
 #---------------------------------------------------------------------------
 # ApGain     = The max ap gained when an actor levels up. Different amounts
 #              can be defined below at # Config Sp Gain
 #---------------------------------------------------------------------------
 ApGain       = 0
 #---------------------------------------------------------------------------
 # DisplayAP  = Will display AP costs instead of SP in the scene.
 #              Set to true if you wish to use this. Use false otherwise.
 #---------------------------------------------------------------------------
 DisplayAP    = false
 #---------------------------------------------------------------------------
 # ExitScene  = The scene it goes to when the Skill Equipment closes.
 #
 #---------------------------------------------------------------------------
 ExitScene    =
 #$scene = Scene_Map.new #Scene_Menu.new
 #---------------------------------------------------------------------------
 # SkillLimit = A series of arrays that represent what skills cannot
 #              be equipped at the same time.
 #  Examples: [[2,3]]
 #           >> Greater Heal and Mass Heal cannot be equipped together
 #
 #            [[7,10],[7,11],[7,12],[8,10],[8,11],[8,12],[9,10],[9,11],[9,12]]
 #           >> Cannot equip any type of fire spell along with an ice spell
 #
 #            [[53,54,55,56]]
 #           >> Can only equip one: Sharp, Barrier, Resist, Blink
 #---------------------------------------------------------------------------
 SkillLimit = []
# SkillLimit = [] # <--If you do not wish to use this feature, do this

 def self.start_ap(id)
   case id
   #-------------------------------------------------------------------------
   # Config Starting Ap
   # Use this when configuring
   # when actor_id then return starting_ap
   #-------------------------------------------------------------------------
    when 23 then return 10 # Actor 1 : Aluxes
  # when 2 then return 8  # Actor 2 : Basil
   end
   return StartingAp
 end
 def self.skill_ap(id)
   case id
   #-------------------------------------------------------------------------
   # Config Ap Costs
   # Use this when configuring
   # when skill_id then return ap_cost
   #-------------------------------------------------------------------------
   when 77 then return 0 # Skill Id 1 : Heal
   end
   return ApCost
 end
 def self.ap_gain(id)
   case id
   #-------------------------------------------------------------------------
   # Config Ap gain
   # Use this when configuring
   # when actor_id then return ap_gain
   #-------------------------------------------------------------------------
   when 23 then return 4 # Actor 1 : Aluxes
   end
   return ApGain
 end
end

#==============================================================================
# Game_Actor
#------------------------------------------------------------------------------
# Added stuff for Skill Equipping.
#==============================================================================
class Game_Actor < Game_Battler
 attr_accessor :eskills
 attr_accessor :skills
 attr_accessor :skillap
 attr_accessor :skillmaxap

 alias gg_add_stuff_lat_ap setup
 def setup(actor_id)
   @actor = $data_actors[actor_id]
   @skillap = GameGuy.start_ap(actor_id)
   @skillmaxap = GameGuy.start_ap(actor_id)
   @eskills = []
   return gg_add_stuff_lat_ap(actor_id)
 end

 def skill_learn?(skill_id)
   return @skills.include?(skill_id) || @eskills.include?(skill_id)
 end

 def learn_skill(skill_id, perm = false)
   if perm and skill_id > 0
     remove_skill(skill_id) if @skills.include?(skill_id)
     @eskills.delete(skill_id)
     @skills.push(skill_id)
     @skills.sort!
   elsif skill_id > 0 and not skill_learn?(skill_id)
     @eskills.push(skill_id)
     @eskills.sort!
   end
 end

 def forget_skill(skill_id)
   remove_skill(skill_id)
   @eskills.delete(skill_id)
 end

 def equip_skill(skill_id)
   return unless skill_id > 0 && @eskills.include?(skill_id)
   potential_ap = @skillap
   removal_list = []
   GameGuy::SkillLimit.each{|set|
     if set.include?(skill_id)
       set.each{|id|
         if @skills.include?(id) && @eskills.include?(id) && !removal_list.include?(id)
           potential_ap += GameGuy.skill_ap(id)
           removal_list.push(id)
         end
       }
     end
   }
   if potential_ap >= GameGuy.skill_ap(skill_id)
     removal_list.each{|id| remove_skill(id)}
     @skillap -= GameGuy.skill_ap(skill_id)
     @skills.push(skill_id)
     @skills.sort!
     return true
   else
     return false
   end
 end

 def remove_skill(id)
   @skillap += GameGuy.skill_ap(id) if (@skills.include?(id) and @eskills.include?(id))
   @skills.delete(id)
 end

 def add_map(n)
   @skillmaxap += n
   clear_skills
   @skillap = @skillmaxap
 end

 def remove_map(n)
   @skillmaxap -= n
   if @skillmaxap < 0
     @skillmaxap = 0
   end
   if @skillap > @skillmaxap
     @skillap = @skillmaxap
   end
   clear_skills
 end

 def exp=(exp)
   @exp = [[exp, 999999999999].min, 0].max
   while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
     @level += 1
     @skillap += GameGuy.ap_gain(@id)
     @skillmaxap += GameGuy.ap_gain(@id)
     for j in $data_classes[@class_id].learnings
       if j.level == @level
         learn_skill(j.skill_id)
       end
     end
   end
   while @exp < @exp_list[@level]
     @level -= 1
   end
   @hp = [@hp, self.maxhp].min
   @sp = [@sp, self.maxsp].min
 end

 def clear_skills
   deleting_these = @skills.clone
   deleting_these.each{|id| @skills.delete(id) if @eskills.include?(id) }
   @skillap = @skillmaxap
 end

end

#==============================================================================
# Window_GGAPSkill
#------------------------------------------------------------------------------
# Copy of Window_Skill but just slightly different.
#==============================================================================
class Window_GGAPSkill < Window_Selectable
 def initialize(actor)
   super(0, 128, 640, 352)
   @actor = actor
   @column_max = 2
   refresh
   self.index = 0
 end
 def skill
   return @data[self.index]
 end
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   for i in 0...@actor.eskills.size
     skill = $data_skills[@actor.eskills[i]]
     if skill != nil
       @data.push(skill)
     end
   end
   @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
 def draw_item(index)
   skill = @data[index]
   if @actor.skill_can_use?(skill.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 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)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   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)
 end
 def update_help
   @help_window.set_text(self.skill == nil ? "" : self.skill.description)
 end
end

#==============================================================================
# Window_GGAPSkillEquip
#------------------------------------------------------------------------------
# Window uses for equipping skills.
#==============================================================================
class Window_GGAPSkillEquip < Window_Selectable
 def initialize(actor)
   super(0, 128, 640, 352)
   @actor = actor
   @column_max = 2
   refresh
   self.index = 0
 end
 def skill
   return @data[self.index]
 end
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
    for i in 0...@actor.eskills.size
     skill = $data_skills[@actor.eskills[i]]
     if skill != nil
       @data.push(skill)
     end
   end
   @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
 def draw_item(index)
   skill = @data[index]
   if @actor.skills.include?(skill.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 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)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   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)
   if GameGuy::DisplayAP
     self.contents.draw_text(x + 232, y, 48, 32, GameGuy.skill_ap(skill.id).to_s, 2)
   else
     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
   end
 end
 def update_help
   @help_window.set_text(self.skill == nil ? "" : self.skill.description)
 end
end

#==============================================================================
# Window_GGActorAp
#------------------------------------------------------------------------------
# Window used to display AP and Actor name.
#==============================================================================
class Window_GGActorAp < Window_Base
 def initialize(actor)
   super(0,64,640,64)
   self.contents = Bitmap.new(width-32,height-32)
   @actor = $game_actors[actor]
   refresh
 end
 def refresh
   self.contents.clear
   ap = GameGuy::ApWord
   self.contents.draw_text(0, 0, 640, 32, "#{@actor.name}")
   self.contents.draw_text(0, 0, 640-32, 32, "#{ap} #{@actor.skillap} / " +
                                          "#{@actor.skillmaxap}", 2)
 end
end

#==============================================================================
# Scene_Skill
#------------------------------------------------------------------------------
# Just slightly modded the main method.
#==============================================================================


#==============================================================================
# Scene_SkillEquip
#------------------------------------------------------------------------------
# The scene that deals with equipping skills.
#==============================================================================
class Scene_SkillEquip
 def initialize(actor_id=0)
   @id = actor_id
 end
 def main
   @actor = $game_actors[@id]
   @help_window = Window_Help.new
   @skill_window = Window_GGAPSkillEquip.new(@actor)
   @skill_window.help_window = @help_window
   @status_window = Window_GGActorAp.new(@actor.id)
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   @help_window.dispose
   @skill_window.dispose
   @status_window.dispose
 end
 def update
   @help_window.update
   @skill_window.update
   @status_window.update
   if @skill_window.active
     update_skill
     return
   end
 end
 def update_skill
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(2)
     #$scene = GameGuy::ExitScene
     return
   end
   if Input.trigger?(Input::C)
     skill = @skill_window.skill
     if @actor.skills.include?(skill.id)
       $game_system.se_play($data_system.decision_se)
       @actor.remove_skill(skill.id)
     else
       result = @actor.equip_skill(skill.id)
       if result
         $game_system.se_play($data_system.decision_se)
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     end
     @status_window.refresh
     @skill_window.refresh
     return
   end
 end
end
Reply }
#2
The trick is to make them not load in the window at all.

Code:
#===============================================================================
# ** Skill Equipment System : Specified Skills Add-on
#------------------------------------------------------------------------------
#    by DerVVulfman
#    based on work by game guy
#    version 1.0
#    01-11-2016 (mm/dd/yyyy)
#    RGSS / RPGMaker XP
#
#==============================================================================
#
#  INTRODUCTION:
#
#  This script allows you to specify which skills may be shown in the
#  Skill Equipment system by game guy.
#
#
#------------------------------------------------------------------------------
#
#  INSTRUCTIONS:
#
#  Paste this add-on below game guy's original script,  and fill the
#  array in this script's GameGuy module with the IDs of skills that
#  are to be shown.
#
#
#==============================================================================
#
#  TERMS AND CONDITIONS:
#
#  Free for use, even in commercial games.
#
#==============================================================================

module GameGuy
  SKILLS_DISPLAYED = [57]   # Only adds these skills
                            # (currently just set to Crosscut)
end


#==============================================================================
# ** Window_GGAPSkillEquip
#------------------------------------------------------------------------------
#  This window displays equipable skills on the Skill Equip menu.
#==============================================================================

class Window_GGAPSkillEquip < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Clear all contents
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    # Erase data, start new
    @data = []
    # Cycle through player E-Skills
    for i in 0...@actor.eskills.size
      # Skip if it is not in our special array
      next unless GameGuy::SKILLS_DISPLAYED.include?(@actor.eskills[i])
      # Get the skill
      skill = $data_skills[@actor.eskills[i]]
      # Push into the array as long as it is not nil
      @data.push(skill) unless skill.nil?
    end
    # Get the number of data records
    @item_max = @data.size
    # Exit if no items
    return unless @item_max > 0
    # Make contents
    self.contents = Bitmap.new(width - 32, row_max * 32)
    # Cycle through item count
    for i in 0...@item_max
      # Draw each item by ID
      draw_item(i)
    end
  end
end
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply }
#3
Okay, I think I already thought about something like that, but I had (of course) no idea how to implement it.

Thank you alot!
Now it works fine. :)
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   [RMXP] Showing skill gained by leveling up on battle result FrQise 12 5,612 05-07-2021, 02:05 PM
Last Post: FrQise
   Refreshing original skills names Whisper 2 2,827 05-31-2020, 04:35 PM
Last Post: Whisper
   Sorting Items in Shop Window Melana 13 11,177 01-18-2018, 05:49 AM
Last Post: DerVVulfman
   Script Request - Variables Specific Save File JayRay 2 3,416 04-28-2014, 05:15 AM
Last Post: JayRay
  Changing Window Styles in Game JackMonty 8 7,232 03-22-2013, 11:54 PM
Last Post: JackMonty
   Footprints not showing - Script Conflict DuongCool 1 2,816 02-14-2013, 05:24 AM
Last Post: DerVVulfman
   Something I noticed about the Advanced Shop Status Window yamina-chan 5 7,592 08-21-2011, 09:16 PM
Last Post: yamina-chan
   Syvakal's Conditional Skills And Equipment Crashes Samven 0 3,041 08-02-2011, 01:58 PM
Last Post: Samven
   [Atoa SBS] Changing the command window font MegaPowerNinja 3 6,199 04-12-2011, 10:23 PM
Last Post: Victor Sant
   Repositioning the actor command window. MegaPowerNinja 4 7,078 04-12-2011, 05:21 AM
Last Post: MegaPowerNinja



Users browsing this thread: