Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: holycloud on November 01, 2010, 01:23:43 pm

Title: Blizzard EQUAP Skill System
Post by: holycloud on November 01, 2010, 01:23:43 pm
Ok so well, I am using blizzard's EQUAP featured in TOA's and what I was wondering is if it would be possible to actually make it possible so the actor doesn't forget the skill when he unequip the weapon/ armor , only if he actualy learned. Because with the base script when I remove the weapon or armor , the actor forget it even thought he completely learned it ( reached max amount of AP).

Exemple :
Heal 10/10 Learned
Fire 5/10 Uncomplete

Let say these 2 skill are from 2 armor or weapon , when I unequipe both I want to keep Heal but not Fire since it is not completed .

Thanks ^^;
Title: Re: Blizzard EQUAP Skill System
Post by: Blizzard on November 01, 2010, 02:57:01 pm
I think I added an option for that. Check out the instructions, I'm pretty sure I did.
Title: Re: Blizzard EQUAP Skill System
Post by: Spoofus on November 01, 2010, 03:06:31 pm
no i dont think you did Blizz i could be wrong,but when i came across this topic i was actually working on the enemy AP values
Title: Re: Blizzard EQUAP Skill System
Post by: holycloud on November 01, 2010, 03:12:10 pm
Blizzard this is the script I am using , which is the lastest you posted ( I think ).

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EQUAP Skills by Blizzard
# Version: 4.3b
# Type: Skill System
# Date: 28.05.2006
# Date v2.0: 13.6.2006
# Date v2.02b: 16.1.2007
# Date v3.0b: 19.2.2007
# Date v3.02b: 7.3.2007
# Date v4.0b: 13.7.2008
# Date v4.1b: 19.10.2008
# Date v4.2b: 22.10.2009
# Date v4.3b: 4.6.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Explanation:
#
#   This add-on will allow you to bound skills to equipment. Equip it and you
#   learn the skill, unequip it and you will forget it. The AP system allows to
#   gain AP for skills and learn the permanently if the max AP for the skill
#   are gathered. (This system is a very similar one to FF9's AP Skill System.)
#
#
# v2.0:
#   - fixed bug, that appeared, when more equipment parts had the same skill
#   - new multi-skill support
#
# v2.02b:
#   - improved coding a little bit
#
# v3.0b:
#   - completely overworked and added optional AP system (similar to FF9)
#     (I want to mention here I made this especially for blazinhandle =) )
#
# v3.02b:
#   - fixed bugs
#
# v4.0b:
#   - fixed a critical bug
#   - no more EQUAP element
#   - skills that have less than 0 max AP cannot be learned
#   - compatible with Guilamme777's Multi-Slot Equipment System
#   - works more convenient
#   - better coding
#
# v4.1b:
#   - fixed problems with gaining AP
#
# v4.2b:
#   - added functionality to prevent some characters from learning certain
#     skills
#
# v4.3b:
#   - fixed a problem with the configuration
#   - now AP values are defined by enemy and not be troop anymore
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 60% compatible with SDK v2.x. WILL cause
#   incompatibility with custom equipment scripts but there are instructions
#   how to configure the script. Compatible with Guilamme777's Multi-Slot
#   Equipment System. Please note, that this script depends on the layout of
#   your Equip Screen and needs to be put UNDER a CMS script if you are using
#   one. WILL corrupt your old savegames. Might not work with some CMS-es.
#
#
# Instructions:
#
# - Configuration:
#
#   Press CRTL+SHIFT+F and type into the window one of the following:
#
#     Start EQ Database
#     Start MAXAP Database
#     Start GAINAP Database
#
#   You can jump now to the database directly. There are more instructions.
#
# - Merge with a Custom Equipment System:
#  
#   To make this system work with any custom equipment script, you need to
#   edit the method "prepare_equap" which fetches all current weapon IDs and
#   armor IDs.
#
#
# NOTE:
#
#   DO NOT USE EQUAP SKILLS AS NORMAL SKILLS! THE SYSTEM WORKS WITH TEMPORARY
#   LEARNING AND FORGETTING THE EQUAP SKILL. IF YOU LET YOUR CHARACTER LEARN AN
#   EQUAP SKILL BY NORMAL MEANS, HE WILL FORGET IT AFTER HE UNEQUIPS THE
#   APPROPRIATE EQUIPMENT!
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com/
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if TONS_OF_ADDONS::EQUAP_SKILLS

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

DISPLAY_AP_GAIN = true # uses a modified Battle Result to display gained AP
DISPLAY_AP_REQ = true # shows CURRENT_AP/NEEDED_AP in the skill's name
DISPLAY_AP_ZERO = false # shows 0/0 if the skill can't be learned
GAIN_DEAD = false # dead actor also gain AP, no matter what

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG
 
 def self.maxap(id)
   case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of MAXAP Database
#
#   Here you can define the APs needed to learn a skill. If you add no skills
#   here the AP system is automatically disabled. Configure it like this
#   template:
#
#     when SKILL_ID then return MAXAP
#
#   SKILL_ID - the ID of the skill that will be learned with AP
#   MAXAP    - how many AP are required to learn the skill
#
#   If you give a skill negative max AP, the skill will be completely bound to
#   the equipment part and will be forgotten when it is unequipped.
#
# Note:
#
#   Don't forget to assign your AP skills to equipment in the EQ Database
#   below. Every skill with 0 AP (default) is a normal skill.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   when 2 then return 100
   when 3 then return 100
   when 4 then return 100
   when 5 then return 100
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   end
   return 0
 end
 
 def self.gainap(id)
   case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of GAINAP Database
#
#   Here you can define how many AP you will get from enemy troops. Configure
#   it like this template:
#
#     when ENEMY_ID then return GAINAP
#
#   ENEMY_ID - the ID of the enemy
#   GAINAP   - how many AP will the player get from this enemy.
#
# Note:
#
#   This will automatically be disabled if there are no AP skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   when 18 then return 10
   when 14 then return 10
   when 15 then return 10
   when 16 then return 10
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   end
   return 0
 end
 
 def self.eq_database(id, weapon = true)
   skill_ids = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of EQ Database
#
#   This is your equipment database. To add one or more new EQUAP skills to a
#   weapon is very simple. Add another "when"-branch in the script snipplet
#   below (they have comments next to it). Configure it like this template:
#
#     when WEAPON_ID
#       @skill_ids.push(EQUAP_SKILL_ID1)
#       @skill_ids.push(EQUAP_SKILL_ID2)
#
#   The same works for armors:
#
#     when ARMOR_ID
#       @skill_ids.push(EQUAP_SKILL_ID1)
#       @skill_ids.push(EQUAP_SKILL_ID2)
#
#   The lines are commented below so you should have no problems with the script.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   if weapon
     case id
     when 2 # weapon ID
       skill_ids.push(4) # EQUAP skill ID
     end
   else
     case id
     when 552 # armor ID
       skill_ids.push(2) # EQUAP skill ID
     end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of EQ Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   end
   return skill_ids
 end
 
 def self.equap_nonlearnable_skills(id)
   case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of NONLEARNABLE SKILLS Database
#
#   Here you can define skills that can't be learned by certain actors at all.
#   Configure it like this template:
#
#     when ACTOR_ID then return [SKILL_ID1, SKILL_ID2, ...]
#
#   ACTOR_ID - the ID of the enemy troop
#   SKILL_ID - the ID of the skill this actor can't learn through EQUAP
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   when 1 then return [3, 5]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of NONLEARNABLE SKILLS Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   end
   return []
 end
 
end
 
#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor
 
 alias setup_equap_later setup
 def setup(id)
   @ap = {}
   setup_equap_later(id)
   test_equap
 end
 
 alias equip_equap_later equip
 def equip(equip_type, id)
   equip_equap_later(equip_type, id)
   test_equap
 end
 
 def add_ap(val)
   @skills.each {|id| @ap[id] = 0 if @ap[id] == nil}
   @ap.each_key {|id|
       @ap[id] = self.ap(id) + val
       @ap[id] = 0 if self.ap(id) < 0
       maxap = BlizzCFG.maxap(id)
       @ap[id] = maxap if self.ap(id) > maxap}
 end
 
 def ap(id)
   return (@ap[id] == nil ? 0 : @ap[id])
 end
 
 def prepare_equap ### edit this method for custom equipment support
   # Guilamme777 compatibility switch
   return self.weapon_ids, self.armor_ids if defined?(G7_MS_MOD)
   weapons = [@weapon_id]
   armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
   return weapons, armors
 end
 
 def test_equap
   non_learnable = BlizzCFG.equap_nonlearnable_skills(self.id)
   (@skills - non_learnable).each {|id|
       maxap = BlizzCFG.maxap(id)
       forget_skill(id) if maxap < 0 || self.ap(id) < maxap}
   weapons, armors = prepare_equap
   skill_ids = []
   weapons.each {|id| skill_ids += BlizzCFG.eq_database(id, true)}
   armors.each {|id| skill_ids += BlizzCFG.eq_database(id, false)}
   (skill_ids - non_learnable).each {|id| learn_skill(id)}
 end
 
end

#==============================================================================
# Game_Troop
#==============================================================================

class Game_Troop
 
 attr_reader :id
 
 alias setup_equap_later setup
 def setup(troop_id)
   setup_equap_later(troop_id)
   @id = troop_id
 end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
 def refresh_extra(aps)
   self.contents.fill_rect(0, 0, self.width, 32, Color.new(0, 0, 0, 0))
   x = 4
   self.contents.font.color = normal_color
   cx = contents.text_size(@exp.to_s).width
   self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
   x += cx + 4
   self.contents.font.color = system_color
   cx = contents.text_size('EXP').width
   self.contents.draw_text(x, 0, 64, 32, 'EXP')
   x += cx + 16
   self.contents.font.color = normal_color
   cx = contents.text_size(@gold.to_s).width
   self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
   x += cx + 4
   self.contents.font.color = system_color
   cx = contents.text_size($data_system.words.gold).width
   self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
   x += cx + 16
   self.contents.font.color = normal_color
   cx = contents.text_size(aps.to_s).width
   self.contents.draw_text(x, 0, cx, 32, aps.to_s)
   x += cx + 4
   self.contents.font.color = system_color
   self.contents.draw_text(x, 0, 128, 32, 'AP')
 end

end

#==============================================================================
# Window_Skill
#==============================================================================

class Window_Skill
 
 alias draw_item_equap_later draw_item
 def draw_item(index)
   skill = @data[index]
   aps = BlizzCFG.maxap(skill.id)
   if DISPLAY_AP_REQ && !$scene.is_a?(Scene_Battle) &&
       (aps > 0 || aps != 0 && DISPLAY_AP_ZERO)
     if @actor.skill_can_use?(skill.id)
       self.contents.font.color = normal_color
     else
       self.contents.font.color = disabled_color
     end
     x, y = 4+index%2*320, 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)
     text = skill.name
     if aps > 0
       text += " (#{@actor.ap(skill.id)}/#{aps})"
     elsif DISPLAY_AP_ZERO
       text += ' (0/0)'
     end
     self.contents.draw_text(x + 28, y, 204, 32, text, 0)
     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
   else    
     draw_item_equap_later(index)
   end
 end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle
 
 alias start_phase5_equap_later start_phase5
 def start_phase5
   start_phase5_equap_later
   aps = 0
   $game_troop.enemies.each {|enemy| aps += BlizzCFG.gainap(enemy.id)}
   @result_window.refresh_extra(aps) if DISPLAY_AP_GAIN
   $game_party.actors.each {|a| a.add_ap(aps) if !a.dead? || GAIN_DEAD}
 end
 
end

end
Title: Re: Blizzard EQUAP Skill System
Post by: Blizzard on November 01, 2010, 03:49:01 pm
Uhm, wait a moment. You want a skill to stay when its AP have been filled up to the maximum, right? That's the default functionality.
Title: Re: Blizzard EQUAP Skill System
Post by: Spoofus on November 01, 2010, 04:03:44 pm
no no he wants the skills not mastered yet to stay even after you unequip the peice of equipment that it was on
Title: Re: Blizzard EQUAP Skill System
Post by: holycloud on November 01, 2010, 04:47:01 pm
Sorry for getting you confused , what I mean is that I would like to make it so that when you completely learn the skill ( meaning you got the AP requirement ) It stays in the skill tree/list even if you un-equip the weapon/armor. Because when I do un-equip or just change it, the actor kind of forget the skill or un-learn . :S
Title: Re: Blizzard EQUAP Skill System
Post by: Spoofus on November 01, 2010, 04:51:24 pm
really i have never had that problem
ill do more testing but it has never happend to me before like what it is doing to you
Title: Re: Blizzard EQUAP Skill System
Post by: holycloud on November 01, 2010, 05:09:02 pm
Ok, well if it works for you , this is weird, because I can't see anything that could interfer with this Skill Script o.o at all.
Title: Re: Blizzard EQUAP Skill System
Post by: Blizzard on November 02, 2010, 02:42:50 am
Have you turned the add-on on properly?