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

3241
Chat / Re: Post a picture of yourself
March 21, 2012, 01:20:29 am
Why? 'cuz I can and I feel like it. Without glasses and with "I don't like my hair this long" hair.
Spoiler: ShowHide
3242
RMXP Script Database / Re: [XP] HoT DoT
March 21, 2012, 12:59:01 am
Hah, didn't see that edit until now. Changes listed in log.
Version 1.3: ShowHide
#==============================================================================
# HoT DoT
# Author: Shdwlink1993
# Version: 1.03
# 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
# HT Date 1.03: 3/20/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]
# Version 1.03 ---------------------------------------------------- [3/20/2012]
#
#  V 1.03 Changes:
#  - Percentage-based DoT healed when damage values were positive and visa-versa
#  - Modified how variance was calculated (added explanation in config)
#  - Organized script to be easier on the eyes and added comment lines
#
#  V 1.02 Changes:
#  - 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 TYPE was positive or negative.
    #
    #      Example A: TYPE is positive. VARIANCE is 15.
    #                 Damage/Heal amount can do up to 15 more or 15 less.
    # [** NOTE **]
    #   If VARIANCE > DAMAGE, the script will change VARIANCE to 1.
    #
    #      Example B: TYPE is negative. VARIANCE is 15.
    #                 Damage/Heal amount can do up to 15% more or 15% less.
    #
    #  * 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 = []
    # Get the HoT/DoT states applied to the character
    for i in @states
      ids.push(i) if SL93.hotdot(i) != false
    end
   
    for i in ids
      # If the state damages/heals by a literal number
      if SL93.hotdot(i)[0] > 0
        self.damage = SL93.hotdot(i)[1]
      # If the state damages/heals HP by a percent
      elsif SL93.hotdot(i)[0] == -1
        self.damage = self.maxhp / SL93.hotdot(i)[1]
      # If the state damages/heals SP by a percent
      elsif SL93.hotdot(i)[0] == -2
        self.damage = self.maxsp / SL93.hotdot(i)[1]
      end
     
      # If damage/heal amount is not zero and variance exists
      if self.damage != 0 && SL93.hotdot(i)[2] > 0
        # Variance based on literal numbers
        amp = (self.damage.abs < SL93.hotdot(i)[2] ? 1 : SL93.hotdot(i)[2]) if SL93.hotdot(i)[0] > 0
        # Variance based on percentages
        amp = [self.damage.abs * SL93.hotdot(i)[2] / 100, 1].max if SL93.hotdot(i)[0] < 0
        # Apply variance amounts to damage/heal amount
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
     
      # If HP damage/heal
      if SL93.hotdot(i)[0].abs == 1
        hp = @hp
        # If limit_drain and actual HP damage being done (not healing)
        if SL93.hotdot(i)[3] and self.damage > 0
          self.hp = [hp - self.damage,1].max # Leave 1 HP
        else
          self.hp -= self.damage
        end
      # If SP damage/heal
      elsif SL93.hotdot(i)[0].abs == 2
        sp = @sp
        # If limit_drain and actual SP damage being done (not healing)
        if SL93.hotdot(i)[3] and self.damage > 0
          self.sp = [sp - self.damage,1].max # Leave 1 SP
        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
3243
Took me a while to understand the request, but I get it now. Essentially you want a DoT system that works like Maplestory's (yes, I had to go there...)

There are a number of things to keep in mind for this:
1) Can different DoT states stack?
2) How about in such an instance where Actor A and Actor B both use a "burn" skill on an enemy? Do both of their burns take effect? Or will the stronger one of the two only do DoT? Or is it based off of "whoever put DoT on the monster last takes priority"?
3) Is there such thing as SP DoT in your game? How about regen HP and/or SP?

Since Actor A's "burn" and Actor B's "burn" should do different DoT, the enemy will have to know which actor burned it. Not to mention, the method 'slip_damage_effect' will have to follow the same damage formula as the method 'skill_effect'.
3244
RPG Maker Scripts / Re: [XP] critical rate
March 06, 2012, 03:55:39 pm
Depends on where you want it posted and how critical rate is calculated. RMXP default critical rate requires the attacked monster's agility.

You can also use the method .to_s
3245
Script Troubleshooting / Re: [xp] command window
March 01, 2012, 10:43:46 pm
Forgot that your window exteneds Window_Base, not Window_Selectable. You need to get the method 'def index=' from the class Window_Selectable and paste it into your Window_MapMenu class.
3246
Script Troubleshooting / Re: [xp] command window
March 01, 2012, 10:01:42 pm
For the "place the cursor index to some value instead of 0 at start-up", you need to add a parameter to your scene.
class Scene_MapMenu
def initialize(index = 0) 
  @index = index
end
def main
  @mapmenu_window = Window_MapMenu.new
  @mapmenu_window.index = @index
  # Continue on with your scene code...
And inside an event, you can use the following script call:
$scene = Scene_MapMenu.new(i)
where "i" is where you want the cursor to be located at on the window.

I think the window cursor's z-value is less than the window's bitmap z-value. No matter how many times you try to change the order of when things are drawn, your cursor will always be behind that picture. I don't know what the fix for that is as I have never needed to do that before.
3247
Script Troubleshooting / Re: [xp] command window
March 01, 2012, 07:20:02 pm
Spoiler: ShowHide
#==============================================================================
# ** Window_Map
#------------------------------------------------------------------------------
class Window_MapMenu < Window_Base
  MAP_TABLE =
[
    "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17",
    "18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34",
    "35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51",
    "52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68",
    "69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85",
    "86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102",
    "103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119",
    "120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136",
    "137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153",
    "154","155","156","157","158","159","160","161","162","163","164","165","166","167","168","189","170",
    "171","172","173","174","175","176","177","178","179","180","181","182","183","184","185","186","187",
    "188","189","190","191","192","193","194","195","196","197","198","199","200","201","202","203","204",
    "205","206","207","208","209","210","211","212","213","214","215","216","217","218","219","220","221",
    "222","223","224","225","226","227","228","229","230","231","232","233","234","235","236","237","238",
    ] 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @index = 0
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Text Character Acquisition
  #--------------------------------------------------------------------------
  def grid
    return MAP_TABLE[@index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0..237
      x = 32 + i % 17 * 32
      y = 0 + i / 17 % 14 * 32
      self.contents.draw_text(x, y, 32, 32, MAP_TABLE[i], 1)
    end
    @bitmap = RPG::Cache.picture("kantomap.png")
    self.contents.blt(32, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
      x = 32 + @index % 17 * 32
      y = 0 + @index / 17 % 14 * 32
      self.cursor_rect.set(x, y, 32, 32)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # if enter is being pressed
    if Input.trigger?(Input::C)
      if @index == 0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      end
       if @index == 1
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Skill.new
      end
    end
      # If right directional button is pushed
      if Input.repeat?(Input::RIGHT)
        # If directional button pressed down is not a repeat, or
        # cursor is not positioned on the right edge
        if Input.trigger?(Input::RIGHT) or
           @index % 17 < 16
          # Move cursor to right
          $game_system.se_play($data_system.cursor_se)
          if @index % 17 < 16
            @index += 1
          end
        end
      end
      # If left directional button is pushed
      if Input.repeat?(Input::LEFT)
        # If directional button pressed down is not a repeat, or
        # cursor is not positioned on the left edge
        if Input.trigger?(Input::LEFT) or
           @index % 17 > 0
          # Move cursor to left
          $game_system.se_play($data_system.cursor_se)
          if @index % 17 > 0
            @index -= 1
          end
        end
      end
      # If down directional button is pushed
      if Input.repeat?(Input::DOWN)
        # Move cursor down
        if @index / 17 < 13
          @index += 17
          $game_system.se_play($data_system.cursor_se)
        end
      end
      # If up directional button is pushed
      if Input.repeat?(Input::UP)
        # Move cursor up
        if @index / 17 > 0
          @index -= 17
          $game_system.se_play($data_system.cursor_se)
        end 
      end
    update_cursor_rect
  end
end


Was that what you needed? I'm still not sure what you're saying. (No offense but it's really broken grammar :D )
3248
Script Troubleshooting / Re: [xp] command window
March 01, 2012, 12:45:21 am
So what you want is when the player presses "C" it will do something? You'll have to create a scene then. Look at Scene_Name for a reference.
3249
Script Troubleshooting / Re: [xp] command window
February 29, 2012, 11:24:13 pm
I'm confused in what you're saying. Analyzing this equation:
x = 0 + i / 10 / 9 * 160 + i % 10 * 32
The '0 +' is not needed at all. Delete that.

When you say 'for i in 0...90', the highest value 'i' will be is 89. Plug that back in the equation:
x = 89 / 10 / 9 * 160 + 89 % 10 * 32
Focus only on the part in red.

89 / 10 / 9 * 160 = 8 / 9 * 160 = 0 * 160 = 0
You will get 0 as an answer for this small part for all values 0 to 89.

In other words, your x-value is really:
x = i % 10 * 32
which is what it should be.

So when you said that you don't need that part, you turned your equation into x = 0, thus the "one-column" issue.
3250
Honestly, I didn't really think about that. I just only came in, noticed that the equations were written for 2 column windows, changed it to draw 1 a column window, and posted. I figured that, from my answer, you would be able to figure out what numbers worked best for x and y.

Now since you said your resolution is half the standard RMXP, your y-coordinate would probably be written as y = index * 16. But I don't know what works best for you since I can't test it (I don't have your game :I ).

I don't get why RMXP didn't write the equations like this:
x = 4 + index % @column_max * (self.width / @column_max)
y = index / @column_max * 32
3251
Script Requests / Re: movements like old 2d beat'em up
February 29, 2012, 09:28:01 pm
So I'm completely unsure if this is what was requested...
class Game_Character
  def turn_up
  end
  def turn_down
  end
end


Yay 100 posts!
3252
Biggest thing I can see wrong are your coordinates for drawing the items. This part located in 'draw_item':
    x = 4 + index % 2 * (288 + 32)
  y = index / 2 * 32
The twos in these two equations were meant for 2 column windows. But you have indicated that you want only 1 column. So your fix is most likely:
    x = 4
  y = index * 32


I thought it had something to do with the bitmap's height (because I ran into that issue recently), but that wasn't the problem.
3253
Script Requests / Re: [Help!] Leon's crafting system.
February 26, 2012, 11:50:04 pm
Was just about to suggest FZer0's Blacksmith script until I noticed your edit while typing this. Oh well.
http://forum.chaos-project.com/index.php/topic,6171.0.html

lol thanks. Andy is too cool :P
3254
Script Requests / Re: [Help!] Leon's crafting system.
February 26, 2012, 11:37:15 pm
  #---------------------------------------------
  #  Recipes for Weapons
  #  Craft_Weapon_Comp = {weapon_id => [[item.id, item.type, # needed], etc...]
  #---------------------------------------------
  Craft_Weapon_Comp = {
  1 => [[1, 0, 1], [2, 0, 1]],
  4 => [[13, 0, 1]]
  }
Just add commas after each line.

I hate it when people use hashes for configurations, especially for a number-heavy script like this. They always look so messy.  :<_<:
3255
Script Troubleshooting / Re: Unable to Save in RMXP
February 26, 2012, 07:50:08 pm
Have you tried Shift + CTRL + F to find 'def on_decision' and 'def make_filename' ?

Also curious as to why this
  def make_weaponfile(file_index)
    return "Weapons#{file_index + 1}.rxdata"
  end
  def make_classfile(file_index)
    return "Classes#{file_index + 1}.rxdata"
  end
exists and why it is located outside of the class 'Scene_File'.
3256
Script Requests / Re: Simple Item menu EDIT
February 26, 2012, 04:28:34 pm
So...all I did was copy 'Window_Help' a bit and made a new type of Window class designed specifically for item descriptions. I only went ahead and changed 'Scene_Item' to incorporate this new window. You can just change the values of how the window is set up to fit your needs.
Spoiler: ShowHide
#==============================================================================
# ** Window_Item_Desc
#------------------------------------------------------------------------------
#  This window shows an item's description.
#==============================================================================

class Window_Item_Desc < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    #(x, y, width, height)
    super(100, 300, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : text string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    # If at least one part of text and alignment differ from last time
    if text != @text or align != @align
      # Redraw text
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#==============================================================================

class Scene_Item
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window, item window
    @item_window = Window_Item.new
    @help_window = Window_Item_Desc.new
    # Associate help window
    @item_window.help_window = @help_window
    # Make target window (set to invisible / inactive)
    @target_window = Window_Target.new
    @target_window.visible = false
    @target_window.active = false
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
  end
end
I am curious to know what you meant in 'editting the default', saying how the windowskin gets weird.
3257
Script Requests / Re: Simple Item menu EDIT
February 26, 2012, 03:43:38 pm
Think you can explain that a bit more for me? From what I'm understanding, you're saying that the default 'Window_Help' is not working out for you. What more do you need other than the item's description? Obviously you'll have to create a new type of window, but because I don't know what you want, I don't know where I'd begin.  :hm:
3258
Script Requests / Re: Simple Item menu EDIT
February 26, 2012, 02:48:55 pm
The default item menu can be found by locating 'Window_Item' in your list of scripts. Scroll down until you find 'def refresh'. The key part that you want to look at is this:
Spoiler: ShowHide
    @data = []
    # Add item
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
The game will first check for items (potions, antidotes, etc), then weapons, then armors. Because 'Window_Item' is used in battles as well, the line
unless $game_temp.in_battle
is needed. This way, it won't draw your weapons and armors when in battle--only your potions and key-items.

Accessories, shields, clothes, and helms are all considered as Armor. By using '$data_armors[index].kind', you can change the order of what is drawn first. So in your example, it would look like this:
Spoiler: ShowHide
    @data = []
    #Adds weapons to the list
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
    end
    # Adds items to the list
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # Adds accessories to the list
    unless $game_temp.in_battle
      for i in 1...$data_armors.size
        # 0 = shield, 1 = helm, 2 = body, 3 = accessories
        if $game_party.armor_number(i) > 0 and $data_armors[i].kind == 3
          @data.push($data_armors[i])
        end
      end
    end
    # Continue on with the list...
3259
Quote from: Skwig on February 25, 2012, 02:37:01 pm
@KK20 - for slower people such as me you should add these notes somewhere:
- The number that defines T can't be in [ ]s
- When using this edit, remove the line in script call that defines L
- In the final line, t should be in the beginning ( $scene = Scene_Blacksmith.new(t, w, a, i) )

That's probably all.. would speed up the process of setting it up


I stated that 'type' is an integer, not an array.
[0] (an array) is not the same as 0 (an integer).

You don't have to remove "L". That's an optional parameter. It's unrelated to my edit.
I also said that the configuration has been changed to:
$scene = Scene_Blacksmith.new(type, weapon, armor, items, level)
In the world of programming, you can't change the order of the arguments and expect the system to understand what parameter each value satisfies.

But as long as you got it working, I am content.  :)
3260
Quote from: Taiine on February 25, 2012, 12:25:54 pm
Thanks muchly *HUG*, though I forgot this had enchanting to. Can that also be split off?

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 or (!Blacksmith::USE_ENCHANTMENTS and type == 3)
      @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])
    @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.
        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
      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
Replace my old edit with these. Go into the configuration, set USE_ENCHANTMENTS equal to false. When calling up the blacksmith scene, set 'type' to 3. That will allow you to make an Enchantment-only shop. Leaving USE_ENCHANTMENTS equal to true will always push the enchantment as an available option, regardless of what value you set 'type' to.

Quote from: Skwig on February 25, 2012, 03:25:14 am
@KK20 - could you do a more retard noob friendly explanation how to set up your edit of script? i have it all copied and wondering if i should replace the parts that you edited or something...
Thanks

The edits I made were by request from Taiine, but if you would like the edit too, then do this.

1.)Obviously, copy and paste my edits into your game. They should be placed before 'Main' but after the original Blacksmith script(s).
2.) The NPC script call setup is still mostly the same. However, it should look a little like this:
Spoiler: ShowHide
where the letter 'T' can be any value from 0 to 3. As I posted before, the type of shop that opens up depends on what value you set 'T' to.