[XP] Tons of Add-ons

Started by Blizzard, January 09, 2008, 08:50:47 am

Previous topic - Next topic

Blizzard

Ah, I see what you are trying to do. Change this:

@message_box_skin = ['Original', 'Chaos Project Skin']


back to this:

@message_box_skin = 'Original'


Now insert this code below my STCMS:

class Scene_Menu
 
  alias update_options_amsfix_later update_options
  def update_options
    update_options_amsfix_later
    $ams.font_type = $game_system.fontname
    $ams.name_font_type = $game_system.fontname
    $ams.font_size = $game_system.fontsize
    $ams.name_font_size = $game_system.fontsize
    $ams.message_box_skin = $game_system.windowskin_name
    $ams.name_box_skin = $game_system.windowskin_name
  end
 
end



That's it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

matte012

April 26, 2009, 01:06:57 pm #361 Last Edit: April 26, 2009, 01:09:06 pm by matte012
 :clap: Hurray for Blizzard  :clap: PWNage Potion for everyone *nods*

EDIT: I know I am the worst at scripting but I cannot find the RGB part of your code. All I do gives me errors, or does something I can't possibly understand

Blizzard

April 26, 2009, 01:43:17 pm #362 Last Edit: April 26, 2009, 01:44:51 pm by Blizzard
I'll show you the code of draw_actor_hp and you will understand how it works.

      if rate > 0.6
        color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
        color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
      elsif rate > 0.2 && rate <= 0.6
        color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
        color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
      elsif rate <= 0.2
        color1 = Color.new(400 * rate, 0, 0, 192)
        color2 = Color.new(240, 0, 0, 192)
      end
      # background color
      color3 = Color.new(0, 80, 0, 192)


There are 3 colors being used. color1 is the darker main color, color2 is the main bar color and color3 is the background color of the empty bar. My code changes the color so it needs to calculate colors depending on the filling rate.
I'll explain this line specifically:

Quote        color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)


I have colored the color components. When the bar is filled between 60% and 100%, the red component slowly increases, the green component stays the same and the blue component also slowly decreases. This formula gives a change from green to yellow when the filling rate drops from 100% to 60%.

The important thing here is that you can either edit the formulas or you can simple replace it with fixed colors.

Code: Green bar
      color1 = Color.new(0, 80, 0, 192)
      color2 = Color.new(0, 240, 0, 192)
      color3 = Color.new(0, 80, 0, 192)

Code: Red bar
      color1 = Color.new(80, 0, 0, 192)
      color2 = Color.new(240, 0, 0, 192)
      color3 = Color.new(80, 0, 0, 192)

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Shining Riku

Um, In one of my projects I'm trying to use the Item Scene addon but it just isn't working.

I was trying to set up a diary that would get pages added to it as you progressed through the game, but the pages show up in my inventory and the diary does nothing even though I have the Itemcall query set to True.

So, I don't know what's going on. :P
There aren't any error messages to report either.

And another question related but unrelated to the rest of my post: What scope would you suggest I set the Diary to, Blizz? The User, All Allies, etc...

Blizzard

There could be problems if you are using a CMS. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

I get en error with Equap skills
Script ToA 2 NoMethodError Occured
undefined method equap_learnable_skills for BlizzCFG:Module

Blizzard

Did you delete the configuration part of EQUAP? Yes, you did. You deleted that method as well.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Quote from: Rival Blizzard on May 04, 2009, 05:39:43 am
Did you delete the configuration part of EQUAP? Yes, you did. You deleted that method as well.


What I didnt erase anything. I simply set it to true and tested it and I got that error.
Or was you talking to yourself.

Blizzard

If you are getting that error, you don't have that method defined. Post your EQUAP configuration.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

May 04, 2009, 09:50:58 am #369 Last Edit: May 04, 2009, 05:50:36 pm by Youngster Gi Gi
I didnt even configure it. I set it to true to test it out with Blizz ABS.

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EQUAP Skills by Blizzard
# Version: 4.2b
# Type: Skill System
# Date: 28.05.2006
# Date v2.0: 13.06.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
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# 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
#
#
# 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 = true # 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
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  def 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 1 then return -1
    when 2 then return 10
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def 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 TROOP_ID then return GAINAP
#
#   TROOP_ID - the ID of the enemy troop
#   GAINAP   - how many AP will the player get from this troop.
#
# Note:
#
#   This will automatically be disabled if there are no AP skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def 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 1 # weapon ID
        skill_ids.push(10) # EQUAP skill ID
        skill_ids.push(11) # EQUAP skill ID
      when 5
        skill_ids.push(8)
        skill_ids.push(12)
      when 9
        skill_ids.push(1)
        skill_ids.push(3)
      end
    else
      case id
      when 1 # armor ID
        skill_ids.push(1) # EQUAP skill ID
        skill_ids.push(25) # EQUAP skill ID
      when 3
        skill_ids.push(7)
        skill_ids.push(4)
      when 5
        skill_ids.push(15)
      when 8
        skill_ids.push(32)
        skill_ids.push(29)
      when 13
        skill_ids.push(2)
        skill_ids.push(25)
      when 18
        skill_ids.push(27)
      when 19
        skill_ids.push(25)
      when 29
        skill_ids.push(10)
      end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of EQ Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return skill_ids
  end
 
  def 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 [59, 60]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# 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 = $game_system.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 = $game_system.maxap(id)
        forget_skill(id) if maxap < 0 || self.ap(id) < maxap}
    weapons, armors = prepare_equap
    skill_ids = []
    weapons.each {|id| skill_ids += $game_system.eq_database(id, true)}
    armors.each {|id| skill_ids += $game_system.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 = $game_system.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 = $game_system.gainap($game_troop.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


EDIT:
Umm I fixed it blizz. You musta not noticed but the non_learnable_skills is under $game_system not BlizzCFG.
line 1788 needs to be
non_learnable = $game_system.equap_nonlearnable_skills(self.id)



EDIT 2:
I'm not gettin AP when I kill enemies in babs

Mightylink

Hi, awesome addon as always, I updated to the latest version 6.88b and now my status icons arnt working properly. They work on the player fine but on the monster they appear over the middle of their name, any way I can get it to offset to the right or left?

Spoiler: ShowHide

Blizzard

I'll look into that. I might have messed up something.

Quote from: Youngster Gi Gi on May 04, 2009, 09:50:58 am
I didnt even configure it. I set it to true to test it out with Blizz ABS.

EDIT:
Umm I fixed it blizz. You musta not noticed but the non_learnable_skills is under $game_system not BlizzCFG.
line 1788 needs to be
non_learnable = $game_system.equap_nonlearnable_skills(self.id)



._.;

Quote from: Youngster Gi Gi on May 04, 2009, 09:50:58 am
EDIT 2:
I'm not gettin AP when I kill enemies in babs


._.;;; I'll fix that when I have time. I'll probably change it so each enemy gives AP.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Shining Riku

Sorry for taking so long to get back.
The only CMS i'm using is yours, Blizz.  :P

I also have another problem. I'm trying to use Multi-hit in another project using the newest version of add-ons but it won't work. I'm using the default battle system and the only changes I can think of that were done to it was Juan's battle icons.

It's set to true and everything, I went inside and set up the script, and even tried it on different weapons and skills.

No difference at all. :(
That's really all I know.

Other than that as far as I know those are the only problem's I'm having. It's no emergency so i'll just use a common event for now. Lemme know if you need to know anything else.

Shining Riku

I've found another critical error in the newest edition of Addons that makes my game crash right after opening up the game and selecting "New Game"

Spoiler: ShowHide


I tried cutting the nonlearnable skills thing out but didn't save the script. Didn't change anything.
It hates me, so I'm gonna use an older version of the equap thing that I have that actually has the AP thing fixed without the nonlearnable stuff.

I know it at least won't crash my game, if it'll even work. I feel like I'm being ignored and treated as a brainless n00b sometimes, but I understand that you're very very busy, Blizz, and I wish you the best of luck with your life. Sorry If i'm such a helpless person, but I don't have your knowledge to fix this problem...

G_G

Quote from: Youngster Gi Gi on May 04, 2009, 09:50:58 am
I didnt even configure it. I set it to true to test it out with Blizz ABS.

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EQUAP Skills by Blizzard
# Version: 4.2b
# Type: Skill System
# Date: 28.05.2006
# Date v2.0: 13.06.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
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# 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
#
#
# 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 = true # 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
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  def 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 1 then return -1
    when 2 then return 10
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def 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 TROOP_ID then return GAINAP
#
#   TROOP_ID - the ID of the enemy troop
#   GAINAP   - how many AP will the player get from this troop.
#
# Note:
#
#   This will automatically be disabled if there are no AP skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def 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 1 # weapon ID
        skill_ids.push(10) # EQUAP skill ID
        skill_ids.push(11) # EQUAP skill ID
      when 5
        skill_ids.push(8)
        skill_ids.push(12)
      when 9
        skill_ids.push(1)
        skill_ids.push(3)
      end
    else
      case id
      when 1 # armor ID
        skill_ids.push(1) # EQUAP skill ID
        skill_ids.push(25) # EQUAP skill ID
      when 3
        skill_ids.push(7)
        skill_ids.push(4)
      when 5
        skill_ids.push(15)
      when 8
        skill_ids.push(32)
        skill_ids.push(29)
      when 13
        skill_ids.push(2)
        skill_ids.push(25)
      when 18
        skill_ids.push(27)
      when 19
        skill_ids.push(25)
      when 29
        skill_ids.push(10)
      end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of EQ Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return skill_ids
  end
 
  def 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 [59, 60]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# 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 = $game_system.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 = $game_system.maxap(id)
        forget_skill(id) if maxap < 0 || self.ap(id) < maxap}
    weapons, armors = prepare_equap
    skill_ids = []
    weapons.each {|id| skill_ids += $game_system.eq_database(id, true)}
    armors.each {|id| skill_ids += $game_system.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 = $game_system.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 = $game_system.gainap($game_troop.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


EDIT:
Umm I fixed it blizz. You musta not noticed but the non_learnable_skills is under $game_system not BlizzCFG.
line 1788 needs to be
non_learnable = $game_system.equap_nonlearnable_skills(self.id)



EDIT 2:
I'm not gettin AP when I kill enemies in babs



In case you didnt notice I posted the fix for it already...in fact awhile ago....

Blizzard

What GG said. I just didn't have time to fix it yet.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Shining Riku

Oh....Ok.
I'm sorry.

I can fix that easy.

I'm really good at wasting people's time it would appear.  :bag:

G_G

Any updates coming yet? I really look forward to the Equap Skills fix for babs.

G_G

Quote from: game_guy on May 24, 2009, 11:07:03 pm
Any updates coming yet? I really look forward to the Equap Skills fix for babs.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.