Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - KK20

3261
Class Window_BlacksmithCommand: ShowHide
#===============================================================================
# ** Window_BlacksmithCommand
#===============================================================================

class Window_BlacksmithCommand < Window_Selectable
 
  def initialize(level, type = 0)
    super(0, 64, 480, 64)
    @level = level
    @commands = []
    # Determine which shop this is
    case type
    when 1 then @commands.push('Forge')
    when 2 then @commands.push('Extract')
    when 0
      @commands.push('Forge')
      @commands.push('Extract')
    end
    # If the game allows enchantments
    if Blacksmith::USE_ENCHANTMENTS
      @commands.push('Enchant')
    end
    @commands.push('Exit')
    @item_max = @column_max = @commands.size
   
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    refresh
    self.index = 0
  end
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    (0...@item_max).each {|i| draw_item(i) }
  end
  #-----------------------------------------------------------------------------
  def draw_item(index)
    w = self.width / @item_max
    self.contents.font.color = @level[index] ? normal_color : disabled_color
    self.contents.draw_text(4 + (w * index), 0, w, 32, @commands[index])
  end
  #-----------------------------------------------------------------------------
  def at_index
    return @commands[@index]
  end
end

Class Scene_Blacksmith: ShowHide
#===============================================================================
# ** Scene_Blacksmith
#===============================================================================

class Scene_Blacksmith
 
  def initialize(type = 0, weapons = [], armors = [], items = [], level = nil)
    # Set available goods for this shop based off passed argument.
    @goods = []
    @goods += weapons.collect {|id| $data_weapons[id] }
    @goods += armors.collect {|id| $data_armors[id] }
    @goods += items.collect {|id| $data_items[id] }
    @goods.uniq!
    # Configure the level variable
    @level = (level == nil) ? Array.new(4, true) : (level + [true])
    @enchants = Blacksmith::USE_ENCHANTMENTS
    @type = type
  end
  #-----------------------------------------------------------------------------
  def main
    # Create a Proc to handle confirmation of choices
    @confirm_proc = Proc.new {
      @help_window.set_text('Are you sure?')
      window = Window_Command.new(160, ['Confirm', 'Cancel'])
      window.x, window.y, window.z = 224, 192, 9999
      loop { Graphics.update; Input.update; window.update
        if Input.trigger?(Input::C) || Input.trigger?(Input::B)
          result = (Input.trigger?(Input::C) && window.index == 0)
          $game_system.se_play($data_system.cancel_se) unless result
          window.dispose
          break(result)
        end
      }
    }
    # Initialize the needed windows.
    @command_window = Window_BlacksmithCommand.new(@level, @type)
    @forge_window = Window_BlacksmithForge.new(@goods)
    @extract_window = Window_BlacksmithExtract.new
    @materials_window = Window_BlacksmithMaterials.new
    @enchant_window = Window_BlacksmithEnchant.new
    @status_window = Window_BlacksmithStatus.new
    @dummy_window = Window_Base.new(0, 128, 640, 352)
    @gold_window = Window_Gold.new
    @gold_window.x, @gold_window.y = 480, 64 
    @help_window = Window_Help.new
    # Bind the help window to the other windows.
    @forge_window.help_window = @extract_window.help_window = @help_window
    @enchant_window.help_window = @help_window
    # Set a windows array for easier handling of all windows.
    @windows = [@command_window, @forge_window, @extract_window, @help_window,
      @materials_window, @status_window, @dummy_window, @gold_window, @enchant_window]
    # Create map sprite if configured to do so, and set window opacity
    if Blacksmith::MAP_BACK
      @spriteset = Spriteset_Map.new
      @windows.each {|window| window.opacity = 160 }
    end
    # Execute the transition and start the main loop.
    Graphics.transition
    loop {Graphics.update; Input.update; update; break if $scene != self }
    # Freeze the Graphics and dispose the windows
    Graphics.freeze
    @windows.each {|window| window.dispose }
    if Blacksmith::MAP_BACK && @spriteset != nil
      @spriteset.dispose
    end
  end
  #-----------------------------------------------------------------------------
  def update
    # Update the windows
    @windows.each {|window| window.update }
    # Branch method depending on current action.
    if @command_window.active
      update_command
    elsif @extract_window.active
      update_extract
    elsif @forge_window.active
      update_forge
    elsif @materials_window.active
      update_materials
    elsif @enchant_window.active
      update_enchant
    end
  end
  #-----------------------------------------------------------------------------
  def back_to_map
    # Play SE and return to the map.
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Map.new
  end
  #-----------------------------------------------------------------------------
  def update_command
    # Set help text depending on the selected index.
    help_text = case @command_window.at_index
    when "Forge" then 'Use materials to forge new weapons, armors, and items.'
    when "Extract" then 'Extract materials from weapons, armors, and items.'
    when "Enchant" then 'Enchant weapons, armors, and items using other items.'
    when "Exit" then 'Exit the shop.'
    end
    @help_window.set_text(help_text)
    # Check for Input.
    if Input.trigger?(Input::B)
      back_to_map
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      # Branch depending on command index
      case @command_window.at_index
      when "Forge"
        # Play SE and return if option is locked.
        unless @level[0]
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Shift scene to forge phase.
        @dummy_window.visible = false
        @forge_window.refresh(false)
        @command_window.active = false
        @forge_window.active = @forge_window.visible = true
        @status_window.visible = true
      when "Extract"
        # Play SE and return if option is locked.
        unless @level[1]
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Shift scene to extract phase
        @extract_window.refresh
        @command_window.active = @dummy_window.visible = false
        @extract_window.active = @extract_window.visible = true
        @status_window.visible = true
      when "Enchant"
        # Play SE and return if option is locked.
        if @enchants
          unless @level[2]
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # Shift scene to enchant phase.
          @forge_window.refresh(true)
          @command_window.active = @dummy_window.visible = false
          @forge_window.active = @forge_window.visible = true
          @status_window.visible = true
        else
          back_to_map
        end
      when "Exit"
        back_to_map
      end
    end
  end
  #-----------------------------------------------------------------------------
  def update_forge
    # Update for input when forge window is active.
    @item = @status_window.item = @forge_window.item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = @dummy_window.visible = true
      @forge_window.active = @forge_window.visible = false
      @status_window.visible = false
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @forge_window.active = @forge_window.visible = false
      if @command_window.at_index == "Forge"
        @materials_window.refresh(@item, 0)
        @materials_window.visible = @materials_window.active = true
      else
        @enchant_window.refresh
        @enchant_window.visible = @enchant_window.active = true
      end
    end
  end
  #-----------------------------------------------------------------------------
  def update_extract
    # Update for input when extraction window is active.
    @item = @status_window.item = @extract_window.item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = @dummy_window.visible = true
      @extract_window.active = @extract_window.visible = false
      @status_window.visible = false
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @materials_window.refresh(@item, 1)
      @extract_window.active = @extract_window.visible = false
      @materials_window.visible = @materials_window.active = true
    end
  end
  #-----------------------------------------------------------------------------
  def update_enchant
    # Update input on the enchantment items screen.
    if Input.trigger?(Input::B)
      # Return to previous screen if cancel button is pressed.
      $game_system.se_play($data_system.cancel_se)
      @enchant_window.visible = @enchant_window.active = false
      @forge_window.active = @forge_window.visible = true
    elsif Input.trigger?(Input::C) && @confirm_proc.call
      enchant_item
    end
  end
  #-----------------------------------------------------------------------------
  def enchant_item
    # Apply enchantment to weapon/armor using item
    $game_party.lose_item(@enchant_window.item.id, 1)
    Blacksmith.create_item(@forge_window.item, @enchant_window.item)
    # Play SE
    $game_system.se_play(RPG::AudioFile.new(*Blacksmith::ENCHANT_SE))
    # Refesh windows
    [@enchant_window, @status_window].each {|window| window.refresh }
    @forge_window.refresh(true)
    # Return to previous screen
    @enchant_window.visible = @enchant_window.active = false
    @forge_window.active = @forge_window.visible = true
  end
  #-----------------------------------------------------------------------------
  def update_materials
    # Show help text.
    text = 'Press the Action Button to proceed. Press Cancel to go back'
    @help_window.set_text(text)
    if Input.trigger?(Input::B)
      # Return to previous screen if cancel button is pressed.
      $game_system.se_play($data_system.cancel_se)
      @materials_window.visible = @materials_window.active = false
      if @command_window.at_index == "Forge"
        @forge_window.active = @forge_window.visible = true
      else
        @extract_window.active = @extract_window.visible = true
      end
    elsif Input.trigger?(Input::C) && @confirm_proc.call
      @command_window.at_index == "Forge" ? forge_item : extract_item
    end
  end
  #-----------------------------------------------------------------------------
  def forge_item
    # Set local variables depending on item type.
    case @item
    when RPG::Weapon
      quantity, type = $game_party.weapon_number(@item.id), 0
      materials = Blacksmith.weapon_forges(@item.id)
      price = Blacksmith.weapon_gold(@item.id)[0]
    when RPG::Armor
      quantity, type = $game_party.armor_number(@item.id), 1
      materials = Blacksmith.armor_forges(@item.id)
      price = Blacksmith.armor_gold(@item.id)[0]
    when RPG::Item
      quantity, type = $game_party.item_number(@item.id), 2
      materials = Blacksmith.item_forges(@item.id)
      price = Blacksmith.item_gold(@item.id)[0]
    end
    # If player doesn't have the materials or gold, play SE and end method.
    unless Blacksmith.materials?(type, @item.id)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # End method and play buzzer if inventory is full.
    return $game_system.se_play($data_system.buzzer_se) if quantity == 99
    # Play the defined SE used when forging.
    $game_system.se_play(RPG::AudioFile.new(*Blacksmith::FORGE_SE))
    # Remove required materials from inventory and subtract gold cost.
    if materials != nil
      materials.each {|material|
        case material[0]
        when 0 then $game_party.lose_weapon(material[1], material[2])
        when 1 then $game_party.lose_armor(material[1], material[2])
        when 2 then $game_party.lose_item(material[1], material[2])
        end
      }
    end
    $game_party.lose_gold(price)
    # Add forged item
    case @item
    when RPG::Weapon then $game_party.gain_weapon(@item.id, 1)
    when RPG::Armor then $game_party.gain_armor(@item.id, 1)
    when RPG::Item then $game_party.gain_item(@item.id, 1)
    end
    # Reset windows.
    @materials_window.visible = @materials_window.active = false
    @forge_window.active = @forge_window.visible = true
    # Refresh any windows that may have changed
    [@status_window, @gold_window, @extract_window, @forge_window,
      @enchant_window].each {|window| window.refresh }
  end
  #-----------------------------------------------------------------------------
  def extract_item
    # Set local variables depending on item type.
    case @item
    when RPG::Weapon
      quantity = $game_party.weapon_number(@item.id)
      materials = Blacksmith.weapon_extractions(@item.id)
      price = Blacksmith.weapon_gold(@item.id)[1]
    when RPG::Armor
      quantity = $game_party.armor_number(@item.id)
      materials = Blacksmith.armor_extractions(@item.id)
      price = Blacksmith.armor_gold(@item.id)[1]
    when RPG::Item
      quantity = $game_party.item_number(@item.id)
      materials = Blacksmith.item_extractions(@item.id)
      price = Blacksmith.item_gold(@item.id)[1]
    end
    # If nothing is defined for the extraction, return.
    if materials == nil || (materials.empty? && price == 0)
      return $game_system.se_play($data_system.buzzer_se)
    end
    # Play extraction SE
    $game_system.se_play(RPG::AudioFile.new(*Blacksmith::EXTRACT_SE))
    # Perform extraction, adding materials and increasing gold.
    materials.each {|material|
      case material[0]
      when 0 then $game_party.gain_weapon(material[1], material[2])
      when 1 then $game_party.gain_armor(material[1], material[2])
      when 2 then $game_party.gain_item(material[1], material[2])
      end
    }
    $game_party.gain_gold(price)
    # Remove extracted item from inventory
    case @item
    when RPG::Weapon then $game_party.lose_weapon(@item.id, 1)
    when RPG::Armor then $game_party.lose_armor(@item.id, 1)
    when RPG::Item then $game_party.lose_item(@item.id, 1)
    end
    # Reset windows.
    @materials_window.visible = @materials_window.active = false
    @extract_window.active = @extract_window.visible = true
    # Refresh any windows that may have changed
    [@status_window, @gold_window, @extract_window].each {|window| window.refresh }
  end
end


Script call has been modified to the following:
$scene = Scene_Blacksmith.new(type, weapons, armors, items, level)
where "type" refers to what shop you want. "type" is an integer. These values do the following:
0 => Forge and Extract
1 => Forge only
2 => Extract only
3262
General Discussion / Re: Screenshot Thread
February 23, 2012, 03:24:43 am
Can't really say I have beautiful maps, but c'mon, it's Advance Wars!
Grit is so cheap: ShowHide
3263
RMXP Script Database / Re: [XP] HoT DoT
February 19, 2012, 01:51:25 pm
Actually, there were a few more bugs with this script than what you said. I went ahead and fixed them.
The following is updated to Version 1.02.
Hot Dot v1.02: ShowHide
#==============================================================================
# HoT DoT
# Author: Shdwlink1993
# Version: 1.02
# Type: Poison Control
#
# Editted by KK20
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# HT Date 1.0b: 1/11/2009
# HT Date 1.01b: 1/12/2009
# HT Date 1.02: 2/19/2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# #  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
# #
# # Note that if you share this file, even after editing it, you must still
# # give proper credit to shdwlink1993.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#                                ~= Function =~
#
# This script is designed to allow you to expand what poison does to your
# character. Poison now is able to affect HP or SP, and take off a fraction or
# a set amount of HP/SP.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#                               ~= Version History =~
#
# Version 1.0b ---------------------------------------------------- [1/11/2009]
# Version 1.01b --------------------------------------------------- [1/12/2009]
# Version 1.02 ---------------------------------------------------- [2/19/2012]
#  Fixed:
#  - Negative damage values damaged instead of healed and visa-versa
#  - Limit_Drain was bugged and has now been fixed
#  - HP and SP damage was being calculated twice (thus actual damage/healing
#    was twice the value the user configured)
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#                              ~= Customization =~
#
# Customization can be found right under where the Poison Database begins.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#                               ~= Compatability =~
#
# - Low probability of working with the SDK.
# - Will not work with other Poison-editing scripts.
# - Must be placed above Tons of Addons.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

module SL93
 
  def self.hotdot(id)
    case id
    #------------------------------------------------------------------------
    # Poison Database Begins
    #------------------------------------------------------------------------
    #  when STATE_NUMBER then return [TYPE, DAMAGE, VARIANCE, LIMIT_DRAIN]
    #  * STATE_NUMBER is the state you want to be affected by this.
    #  * TYPE refers to the thing sustaining damage.
    #      1 = HP, 2 = SP. If the type is positive, the amount is a literal
    #      number (eg. You lose about 50 HP). If the type is negative, then
    #      the amount is a fraction of the maximum (eg. You lose about 50% of
    #      your HP).
    #  * DAMAGE refers to how much damage is healed/taken.
    #      A Positive amount hurts you and a negative amount heals you.
    #  * VARIANCE refers to how much the damage varies. Positive only.
    #      This depends in part on if the type was positive (~5 HP difference)
    #      or negative (~5% HP difference).
    #  * LIMIT_DRAIN refers to if the poison can leave you with 0 HP/SP.
    #      If true, then it is limited, and stops at 1. If false, then it
    #      isn't.
    #------------------------------------------------------------------------
   when 3 then return [-1, 10, 15, false]  # Standard Poison
    #------------------------------------------------------------------------
    # Poison Database Ends
    #------------------------------------------------------------------------
    end
    return false
  end
 
end

class Game_Battler
 
  def slip_damage?
    return @states.any? {|i| SL93.hotdot(i) != false }
  end
 
  def slip_damage_effect
    ids = []
    for i in @states
      ids.push(i) if SL93.hotdot(i) != false
    end
    for i in ids
      self.damage = SL93.hotdot(i)[1] if SL93.hotdot(i)[0] > 0
      self.damage = self.maxhp / SL93.hotdot(i)[1] if SL93.hotdot(i)[0] == -1
      self.damage = self.maxsp / SL93.hotdot(i)[1] if SL93.hotdot(i)[0] == -2
      if self.damage.abs > 0 && SL93.hotdot(i)[2] > 0
        amp = [self.damage.abs - SL93.hotdot(i)[2], 1].max if SL93.hotdot(i)[0] > 0
        amp = [self.damage.abs * SL93.hotdot(i)[2] / 100, 1].max if SL93.hotdot(i)[0] < 0
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      self.damage = self.damage * -1 if SL93.hotdot(i)[0] < 0
      if SL93.hotdot(i)[0] == 1 || SL93.hotdot(i)[0] == -1
        hp = @hp
        # If limit_drain and actual damage being done (not healing)
        if SL93.hotdot(i)[3] and self.damage > 0
          self.hp = [hp - self.damage,1].max
        else
          self.hp -= self.damage
        end
      elsif SL93.hotdot(i)[0] == 2 || SL93.hotdot(i)[0] == -2
        sp = @sp
        if SL93.hotdot(i)[3] and self.damage > 0
          self.sp = [sp - self.damage,1].max
        else
          self.sp -= self.damage
        end
      end
    end
  end
 
end

class Game_Party
 
  def check_map_slip_damage
    @actors.each {|actor|
      if actor.hp > 0 && actor.slip_damage?
        actor.slip_damage_effect
        $game_screen.start_flash(Color.new(255, 0, 0, 128), 4)
        $game_temp.gameover = $game_party.all_dead?
      end
    }
  end
 
end
3264
Is there any reason why you need this as a script? You do know you can just use eventing to do this, calling a Common Event when the item bag is used.

Set a variable to a random number 1-100, then use a series of conditional branches. Granted, scripting it would probably be faster and easier on the eyes to set up.
3265
Odd. The demo works fine right? The bug only occurs in your game? Not sure what could be conflicting that then, unless somewhere in your scripts $game_player.move_speed is being set to the RUN_SPEED.

EDIT: Bothered to actually read more of this thread. Noticed that you were talking about a "flicker" when SP was drained and run key was held down and the player moves. Re-download my link above--I made a fix to that.
3266
Gravedigging because Taiine told me to.

Try this: http://dl.dropbox.com/u/58874459/BLIZZ%20ABS.rar
NOTE: I still used that 'unless $game_switches[id]' edit in the BABS script to make this work.

Thank you for explaining the issue fully in that other topic--everything works out so much nicer when people give criticism.
3267
But I have the fix. Why can't you just try it? Here, I even have a download link: http://dl.dropbox.com/u/58874459/BLIZZ%20ABS.rar

...I am persistent when it comes to proving a point.
3268
You went and editted your Blizz ABS Part 2 to exactly the way I wrote it, yes? And did you make sure you wrote $game_variables not $game_variable? I do that from time to time.

Also, changed the eventing a bit:
Spoiler: ShowHide
3269
What error? The "do not regen" error? I could even post a video of my method. It all works for me.

What do you mean by "it shouldn't contrain any running events"?
3270
Quote from: KK20 on February 16, 2012, 09:33:55 pm
Did you at least give mine a try? Because from what I can tell, you said yours checked if the MP > 0 first. Mine checks if the run key is being held down first.


Quote
if MP is over X > Enable sprinting key
if sprint key held, subtract Y MP a sec
If sprint key not held, add Y MP a sec
if MP is at X, disable sprint key

Note that you check first if your MP is greater than X. If it is, enable the run key. Also note that your regen only works IF your MP is greater than X as well. Thus, you are saying:
if actor.mp > X
  if Input.press?(Input::Run)
    actor.mp -= amount
  else
    actor.mp += amount
  end
else
  # Prevent player from running
end
Obviously, your bug makes sense because it's faulty logic order. Your event is NOT the same as mine.

I've tested MY version different ways, using spells while running, and it all works clean. I suggest you to do EXACTLY what I say. Also note that I did not download AJNR95's demo to borrow any of his ideas.
3271
Script Troubleshooting / Re: [XP]Need Help!
February 17, 2012, 06:05:45 pm
    # Dispose of windows
    @command_window.dispose

Change that line because, once again, @window is undefined.

Also, what is command_mgift? You don't have it defined here.
3272
Quote from: Taiine on February 16, 2012, 08:40:45 pm
That is actually the event system I tried using and is the one that gave me this bug. It works fine unless you let it fully drain, only then will the sp be 'locked' at that value unless you use a potion or something to up it.

ah well... guess sp will remain dull boring sp rather than 'energy' and players can run indef where ever they want! ;D

Did you at least give mine a try? Because from what I can tell, you said yours checked if the MP > 0 first. Mine checks if the run key is being held down first.
3273
Not sure how this edit worked, but it looked like it did its job.

In the Cooldown script, locate the class Hotkey_Assignment_Recharge and delete everything below that. Replace with this:
Hotkey_Assignment_Recharge: ShowHide
class Hotkey_Assignment_Recharge < Sprite
 
  attr_reader :skillrecharge
  attr_reader :itemrecharge
  attr_reader :chargebitmaps
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(x0, y0, z0, viewport = nil)
    # call superclass
    super(viewport)
    # create bitmap
    self.bitmap = Bitmap.new(48, 320)
    # set font name
    self.bitmap.font.name = 'Arial'
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set x and y position
    self.x, self.y, self.z = x0, y0, z0+100
    # update display
    @actor = $game_player.battler
    @skillrecharge = []
    @itemrecharge = []
    (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
    update
  end
  #----------------------------------------------------------------------------
  # draw
  #  Draws the recharge sectors over the hotkey display.
  #----------------------------------------------------------------------------
  def draw(index = nil)
    # iterate through all skills that need to be recharged
    (@skillrecharge).each {|i|
      # temporary var
      object = $data_skills[$game_player.skill_hotkeys[i%10]]
      ind = $game_player.skill_hotkeys[i%10]+1
      if $game_player.recharging?(ind)
        # remove old image
        self.bitmap.fill_rect(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(7, 32*(i-1), len, 4, Color.new(255, 255, 0))
        # Draws black square over the skill/item graphic
  #KK20#      self.bitmap.fill_rect(7, 32*(i-1)+4, 24, 24, Color.new(0, 0, 0, 127))
        # draw time left of cooldown
        self.bitmap.draw_text_full(7, 32*(i-1)+4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        end
        @skillrecharge.delete(i)
      end}
    # iterate through all items that need to be recharged
    (@itemrecharge).each {|i|
      # temporary var
      object = $data_items[$game_player.item_hotkeys[i%10]]
      ind = $game_player.item_hotkeys[i%10]+1
      if $game_player.recharging?(ind)
        # remove old image
        self.bitmap.fill_rect(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(7, 32*(i-1), len, 4, Color.new(255, 255, 0))
        # Draws black square over the skill/item graphic
#KK20#       self.bitmap.fill_rect(7, 32*(i-1)+4, 24, 24, Color.new(0, 0, 0, 127))
        # draw time left of cooldown
        self.bitmap.draw_text_full(7, 32*(i-1)+4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        end
        @itemrecharge.delete(i)
      end}
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def update
    if @actor != $game_player.battler
      # set new actor
      @actor = $game_player.battler
      @skillrecharge = []
      @itemrecharge = []
      self.bitmap.fill_rect(0, 0, 32, 320, Color.new(0, 0, 0, 0))
      (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
      draw
    end
    draw if test_recharge
  end
  #----------------------------------------------------------------------------
  # test_recharge
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def test_recharge
    BlizzABS::Cache::HotkeyRange.each {|i|
      if $game_player.skill_hotkeys[i%10] != 0 and !@skillrecharge.include?(i)
        ind = $game_player.skill_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @skillrecharge.push(i)
          return true
        end
      elsif $game_player.item_hotkeys[i%10] != 0 and !@itemrecharge.include?(i)
        ind = $game_player.item_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @itemrecharge.push(i)
          return true
        end
      end}
    return false if @skillrecharge.size < 1 and @itemrecharge.size < 1
    return true
  end
  #----------------------------------------------------------------------------
  # bitmap_square_sect
  #  w          - width
  #  rate       - fill rate
  #  color    - color
  #  Draws the HUD gradient bar.
  #  This was going to be used a recharge graphic, but it lagged.  I included
  #  the code in case someone ever wanted to use it or fixes the lag.
  #----------------------------------------------------------------------------
  def bitmap_square_sect(w, rate)
    b = Bitmap.new(w, w)
    return b if rate <= 0.0 or rate > 1.0
    color = Color.new(0, 0, 0, 127)
    (0...23).each {|x|
      (0...23).each {|y|
        angle = (Math.atan2(x-w/2, y-w/2) + 6*Math::PI/2)%(2*Math::PI)
        b.set_pixel(x, y, color) if angle <= 2*Math::PI*rate}}
    return b
  end
end

I also added my "darken the icon graphic when in cooldown" bit in there. CTRL+F for #KK20# and delete that bit if you want to use them.
3274
I'm going to need to know what HUD script that is. It's merely just a matter of changing the coordinates of where the graphics are drawn. But I need to know the hotkey's viewport's dimensions first.
3275
Script Troubleshooting / Re: [XP]Need Help!
February 16, 2012, 04:23:37 pm
Quote from: SBR* on February 15, 2012, 04:30:08 pm

@window.update

There is no defined @window variable.


Change that line to @command_window.update

Don't worry. Windows and scenes were difficult for me too. It took me about a good 3-6 months before I understood what everything did.
3276
RMXP Script Database / Re: [XP] Blizz-ABS
February 16, 2012, 01:53:10 am
Copypasta.

To throw things directly into your hotkeys, you can use the script call
$game_player.item_hotkeys[x] = y
where x is the hotkey number and y is the ID of the item. Same goes for skills
$game_player.skill_hotkeys[x] = y
3277
A copy-paste solution from another post.

1.) Open Part 2 of BlizzABS. Locate 'def update_control' (Line 3592). A few lines below, find 'player.move_speed = player.normal_speed' (Line 3596) and replace it with
player.move_speed = player.normal_speed unless $game_switches[id]
Replace 'id' with whatever switch you want to be on in order to run your parallel process event.
Go down a bit and find 'player.move_speed = Config::RUN_SPEED' (Line 3605) and replace it with
player.move_speed = Config::RUN_SPEED unless $game_switches[id]
Again, replacing 'id' with the switch you want.

2.) Do something like this:
Spoiler: ShowHide


Drains MP as long as the run key is held down. If MP is zero, the character will walk at normal speed even if the run key is held down. If the run key is not being pressed, regen MP. The above example was just bare-bones testing.

EDIT: Forgot a couple of lines in the picture. Fix'd.
EDIT 2: Changed the eventing a bit to allow all actors to use this feature, not just the first actor.
3278
Script Troubleshooting / Re: [XP]Need Help!
February 15, 2012, 05:17:08 pm
At the line "@command_window.index = @menu_index", the method "index=(index)" under the class Window_Selectable is called. Within this method, "update_cursor_rect" is called. And, if you look at Line 102, you'll find "if @index < 0".

You set @index to equal @menu_index, but as SBR said, @menu_index has no value. Thus, @index = nil.

The error is being thrown because...well, what does nil < 0 mean?

Solution: Remove "@command_window.index = @menu_index" from your scene.
3279
Welcome! / Been meaning to do this
February 11, 2012, 04:14:08 pm
As you can see from my post count, I have been here for a while, but I never really introduced myself. The username, KK20, is actually short for Kirbykid20, a name that I have used for years across the internet. My real name is Tyler, a tall and scrawny, half-white half-Japanese, 19-year-old. I live near the coast in Southern California. I am an INTJ according to the MBTI test. I'm getting my AA this semester and transferring over this fall. Computer Science is my major.

I've wanted to be in game design since the age of four or five. It wasn't until around my freshman year that I discovered RPG Maker and turned my dream into a reality. It also wasn't until my junior year that I took my first programming class. When I found out that I was pretty good at it (5 on the AP test), Computer Science was my "for-sure" major. However, I'm probably one of the most technology-illiterate computer majors out there.  :^_^':

Anyways, I have been working on RMXP for about 3 years now and am still learning how to write Ruby. Thanks to some of your scripts, I was able to teach myself a bit! My current project is to recreate Advance Wars into Ruby. It's been about half a year now, and I think I've done a pretty good job so far. You can find my current progress on it here: http://www.youtube.com/watch?v=saST5gPnE5k

I needed to find a community that I could fit in with, and I thought that this was a great first place. I didn't grow up with people that have the same interests as I do, so it has been pretty tough finding support. Nevertheless, I hope that I can be somewhat recognized by the community despite my almost hermit-like personality. So with that all said and done, hello people! :V:
3280
I tried looking into it, but I was going into it blind. There are a ton of variables and numbers to keep track of to understand what is the issue. I don't think I can figure it out anytime soon. :\