Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Bob423

Some problems with a couple scripts

Recommended Posts

So problem #1 is...

I've made a shop system, with the help of black mage, that allows the player to press a button that displays a window with detailed information about the weapon or armor including elements and status effects.

After finishing it, I tried to do the same with the equipment menu, but can't get anything except the stats (ATK, DEF, etc) to display.

(I can PM you the relevant scripts)

 

2.

I'm using an edited (by polraudio) version of Leon's Crafting System and neither of us can get the menu to scroll. This seems to have been a problem with the original script as well.\

Here's the script.

And if someone knows how I can have 2 crafting types that can make the same items, so there can be an upgraded anvil or something with more crafting choices, that would be awesome

 

#========================================
#  Leon's Crafting System
#  v1.03
#-------------------------------------------------------
#
#  Features:
#    By default, if the player has the items for a recipe, they will learn it.
#    You can set some to be triggered by events.
#
#  Instructions:
#    Put below all default scripts, but above Main.
#    Follow the examples in the module, and put in the numbers where needed.
#     it is the easiest way to make it usable without too much coding.
#
#  To make an item so an event must be triggered:
#     Add the ID number to the right area.  The right area for:
#       Items:  Item_Event_Triggered = []
#       Weapons:  Weapon_Event_Triggered = []
#       Armors:  Armor_Event_Triggered = []
#
#  If the item is evented, and needs to be added to the list, use this in call script
#  (without the 'For Items', 'For Weapons', and 'For Armors'):
#    For items:
#      $game_party.event_item.push(item_id)
#      $game_party.compile
#
#    For weapons:
#      $game_party.event_weapon.push(weapon_id)
#      $game_party.compile
#
#    For armors:
#      $game_party.event_armor.push(armor_id)
#      $game_party.compile
#
#  If you want each item to be added via 'recipe':
#    Set each item to be 'evented'.
#    To add them, use this in call script (without the 'For Items', 'For Weapons', and 'For Armors'):
#      For Items:
#        $game_party.item_recipe_availible.push(item_id)
#        $game_party.item_recipes_made[item_id] = 0
#      For Weapons:
#        $game_party.weapon_recipe_availible.push(weapon_id)
#        $game_party.weapon_recipes_made[weapon_id] = 0
#      For Armors:
#        $game_party.armor_recipe_availible.push(armor_id)
#        $game_party.armor_recipes_made[armor_id] = 0
#      
#
#
#  Additional Information:
#    If you are having troubles with the Craft_Item_Comp, Craft_Weapon_Comp, and
#    Craft_Armor_Comp:
#      The way it is set up is:
#        Craft_Item_Comp = {
#        item.id => [[item_id, item_type, number_needed], [item_id, item_type, number_needed]]
#        }
#      Make sure you have it set up like that, and you can have many more than that.  Also, as stated
#      below, the item_types are: 0-item, 1-weapon, 2-armor
#
#========================================

#========================================
#  module Craft_Items
#    Notes:
#      item.types are:  0-item, 1-weapon, 2-armor
#========================================
module Craft_Items
 
 
  #---------------------------------------------
  #  Recipes for Items
  #  Craft_Item_Comp = {item_id => [[item.id, item.type, # needed], etc...]
  #---------------------------------------------
    Craft_Item_Comp = {
    #---------------#
    # Potion Maker Items
    #---------------#
    # HP and MP items
    4 => [[21,0,1],[3, 0,10],[57,0, 1]],                  # Full Potion
    7 => [[21,0,1],[6, 0,10],[58,0, 1]],                  # Full Ether
    8 => [[21,0,1],[4, 0, 1],[7, 0, 1],[57,0,1], # Elixir
    [58,0,1]],
    9 => [[21,0,1],[4, 0, 3],[7, 0, 3],[57,0,3], # Elixir-All
    [58,0,3],[78,0,1]],
    11=> [[21,0,1],[10,0, 3],[57,0, 1],[78,0,1]],# Revive All
    12=> [[21,0,1],[10,0, 2],[57,0, 2],[78,0,1]],# Full Revive
    # Special Potions
    22=> [[21,0,1],[59,0,10],[56,0,10]],             # Warrior's Potion
    23=> [[21,0,1],[60,0,10],[55,0,10]],             # Wizard's Potion
    24=> [[21,0,1],[56,0,10],[55,0,10]],             # Guardian's Potion
    25=> [[21,0,1],[61,0,10],[62,0,10]],             # Hunter's Potion
    26=> [[21,0,1],[61,0,15],[62,0, 5]],             # Speed Potion
    # Crystals and stuff
    63=> [[37,0,1],[13,0,30]],                   # Poison Stone
    
    #-------------#
    # Blacksmith Items
    #-------------#
    28 => [[27,0,1], [40,0,1]], # Steel
    
    }

  #---------------------------------------------
  #  Recipes for Weapons
  #  Craft_Weapon_Comp = {weapon_id => [[item.id, item.type, # needed], etc...]
  #---------------------------------------------
  Craft_Weapon_Comp = {
  # Weapons - Iron, Steel, Titanium, Iridium
   3 => [[27, 0, 2],[44, 0, 1]],  # Iron Sword
  16 => [[28, 0, 2],[44, 0, 1]],  # Steel Sword
  17 => [[16, 1, 1],[28, 0, 1]],  # Steel Sword +
  18 => [[16, 1, 1],[46, 0, 1]],  # Steel Sword F
 
  # Weapons - Diamond, Mythril, Adamantite, Orichalcum
    
    }
  #---------------------------------------------
  #  Recipes for Armors
  #  Craft_Armor_Comp = {Armor_id => [[item.id, item.type, # needed], etc...]
  #---------------------------------------------
  Craft_Armor_Comp = {
    # Armor - Leather+
    3 => [[44, 0, 6]],  # Leather Armor
 
  # Armor - Diamond+
 
  # Accessories
 
  }
  #---------------------------------------------
  # Item_Craft_Type = { item_id => 'craft_area'
  # types: 'alchemy', 'anvil', 'oven'
  #---------------------------------------------
  Item_Craft_Type = {
  # Potions
  4 => 'potion', 7 => 'potion', 8 => 'potion', 9 => 'potion',11 => 'potion',
  12=> 'potion',22 => 'potion',23 => 'potion',24 => 'potion',25 => 'potion',
  26=> 'potion',54 => 'potion',55 => 'potion',56 => 'potion',57 => 'potion',
  58=> 'potion',59 => 'potion',60 => 'potion',61 => 'potion',62 => 'potion',
  63=> 'potion',64 => 'potion',65 => 'potion',66 => 'potion',67 => 'potion',
  68=> 'potion',69 => 'potion',70 => 'potion',71 => 'potion',72 => 'potion',
  73=> 'potion',74 => 'potion',75 => 'potion',76 => 'potion',77 => 'potion',
  78=> 'potion',79 => 'potion',80 => 'potion',81 => 'potion',82 => 'potion',
  83=> 'potion',84 => 'potion',85 => 'potion',
  # Blacksmith
  28 => 'smith',
  }
  #---------------------------------------------
  Weapon_Craft_Type = { 2 => 'lion',3 => 'smith',16 => 'smith', 17 => 'smith',
  18 => 'smith',19 => 'smith',20 => 'smith',21 => 'smith',22 => 'smith',
  23 => 'smith',24 => 'smith',25 => 'smith',26 => 'smith',27 => 'smith',
  28 => 'smith',29 => 'smith',30 => 'smith',31 => 'smith',32 => 'smith',
  33 => 'smith',34 => 'smith',35 => 'smith',36 => 'smith',37 => 'smith',
 
  }
  #---------------------------------------------
  # Blacksmith
  Armor_Craft_Type = { 3 => 'smith',
  }
  #---------------------------------------------
  # Blacksmith
 
  #---------------------------------------------
  #  Tells which item recipes are evented.
  #  Item_Event_Triggered = [id1, id2...etc]
  #---------------------------------------------
  Item_Event_Triggered = []
  #---------------------------------------------
  #  Tells which weapon recipes are evented.
  #  Weapon_Event_Triggered = [id1, id2...etc]
  #---------------------------------------------
  Weapon_Event_Triggered = []
  #---------------------------------------------
  #  Tells which armor recipes are evented.
  #  Armor_Event_Triggered = [id1, id2...etc]
  #---------------------------------------------
  Armor_Event_Triggered = []
end
#========================================
#  END module Craft_Items
#========================================

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Party
 
  alias leon_cs_gameparty_initialize initialize
  alias leon_cs_gameparty_gainitem gain_item
  alias leon_cs_gameparty_gainweapon gain_weapon
  alias leon_cs_gameparty_gainarmor gain_armor
 
  attr_accessor :item_recipes_made
  attr_accessor :item_recipe_availible
  attr_accessor :weapon_recipes_made
  attr_accessor :weapon_recipe_availible
  attr_accessor :armor_recipes_made
  attr_accessor :armor_recipe_availible
  attr_accessor :event_item
  attr_accessor :event_weapon
  attr_accessor :event_armor
 
  def initialize
    #------------------------------------------------
    # Used to record what items have been made.
    #------------------------------------------------
    @item_recipes_made = {}
    #------------------------------------------------
    # Used to show availible item recipes.
    #------------------------------------------------
    @item_recipe_availible = []
    #------------------------------------------------
    # Used to record what items have been made.
    #------------------------------------------------
    @weapon_recipes_made = {}
    #------------------------------------------------
    # Used to show availible item recipes.
    #------------------------------------------------
    @weapon_recipe_availible = []
    #------------------------------------------------
    # Used to record what items have been made.
    #------------------------------------------------
    @armor_recipes_made = {}
    #------------------------------------------------
    # Used to show availible item recipes.
    #------------------------------------------------
    @armor_recipe_availible = []
    #------------------------------------------------
    #  Shows which ones need triggered events
    #------------------------------------------------
    @event_item = []
    @event_weapon = []
    @event_armor = []
    leon_cs_gameparty_initialize
  end
 
  def gain_item(item_id, n)
    leon_cs_gameparty_gainitem(item_id, n)
    compile
  end
 
  def gain_weapon(weapon_id, n)
    leon_cs_gameparty_gainweapon(weapon_id, n)
    compile
  end
 
  def gain_armor(armor_id, n)
    leon_cs_gameparty_gainarmor (armor_id, n)
    compile
  end
 
  def compile
    ci = Craft_Items
    for i in 0...ci::Craft_Item_Comp.keys.size
      @counter = 0
      for j in 0...ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]].size
        case ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][1]
        when 0
          item = ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][0]
          if @items.keys.include?(item) and @items[item] >= ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 1
          item = ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][0]
          if @weapons.keys.include?(item) and @weapons[item] >= ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 2
          item = ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][0]
          if @armors.keys.include?(item) and @armors[item] >= ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]][j][2]
            @counter += 1
          end
        end
        if @counter == ci::Craft_Item_Comp[ci::Craft_Item_Comp.keys[i]].size
          unless @item_recipe_availible.include?(ci::Craft_Item_Comp.keys[i])
            if ci::Item_Event_Triggered.include?(ci::Craft_Item_Comp.keys[i])
              if @event_item.include?(ci::Craft_Item_Comp.keys[i])
                @item_recipe_availible.push(ci::Craft_Item_Comp.keys[i])
                @item_recipes_made[ci::Craft_Item_Comp.keys[i]] = 0
                return
              end
            else
              @item_recipe_availible.push(ci::Craft_Item_Comp.keys[i])
              @item_recipes_made[ci::Craft_Item_Comp.keys[i]] = 0
            end
          end
        end
      end
    end
    
    for i in 0...ci::Craft_Weapon_Comp.keys.size
      @counter = 0
      for j in 0...ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]].size
        case ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][1]
        when 0
          item = ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][0]
          if @items.keys.include?(item) and @items[item] >= ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 1
          item = ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][0]
          if @weapons.keys.include?(item) and @weapons[item] >= ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 2
          item = ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][0]
          if @armors.keys.include?(item) and @armors[item] >= ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]][j][2]
            @counter += 1
          end
        end
        if @counter == ci::Craft_Weapon_Comp[ci::Craft_Weapon_Comp.keys[i]].size
          unless @weapon_recipe_availible.include?(ci::Craft_Weapon_Comp.keys[i])
            if ci::Weapon_Event_Triggered.include?(ci::Craft_Weapon_Comp.keys[i])
              if @event_weapon.include?(ci::Craft_Weapon_Comp.keys[i])
                @weapon_recipe_availible.push(ci::Craft_Weapon_Comp.keys[i])
                @weapon_recipes_made[ci::Craft_Weapon_Comp.keys[i]] = 0
                return
              end
            else
              @weapon_recipe_availible.push(ci::Craft_Weapon_Comp.keys[i])
              @weapon_recipes_made[ci::Craft_Weapon_Comp.keys[i]] = 0
            end
          end
        end
      end
    end
    
    for i in 0...ci::Craft_Armor_Comp.keys.size
      @counter = 0
      for j in 0...ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]].size
        case ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][1]
        when 0
          item = ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][0]
          if @items.keys.include?(item) and @items[item] >= ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 1
          item = ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][0]
          if @weapons.keys.include?(item) and @weapons[item] >= ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][2]
            @counter += 1
          end
        when 2
          item = ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][0]
          if @armors.keys.include?(item) and @armors[item] >= ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]][j][2]
            @counter += 1
          end
        end
        if @counter == ci::Craft_Armor_Comp[ci::Craft_Armor_Comp.keys[i]].size
          unless @armor_recipe_availible.include?(ci::Craft_Armor_Comp.keys[i])
            if ci::Armor_Event_Triggered.include?(ci::Craft_Armor_Comp.keys[i])
              if @event_armor.include?(ci::Craft_Armor_Comp.keys[i])
                @armor_recipe_availible.push(ci::Craft_Armor_Comp.keys[i])
                @armor_recipes_made[ci::Craft_Armor_Comp.keys[i]] = 0
                return
              end
            else
              @armor_recipe_availible.push(ci::Craft_Armor_Comp.keys[i])
              @armor_recipes_made[ci::Craft_Armor_Comp.keys[i]] = 0
            end
          end
        end
      end
    end
  end
 
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  END Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#=============================================
#  Window_Craft_Info
#=============================================
class Window_Craft_Info < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    
    
    self.opacity = 255
  end

  def update(help_text)
    self.contents.clear
    self.contents.draw_text(0, 0, 640, 32, help_text)
  end
end
#=============================================
#  END Window_Craft_Info
#=============================================


#=============================================
#  Window_Craft_List
#=============================================
class Window_Craft_List < Window_Selectable
  def initialize
    super(0, 64, 256, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    
    
    self.index = 0
    self.opacity = 255
  end
 
  def list
    if @data[index] != nil
      return @data[index]
    end
  end
 
  def refresh(type)
    ci = Craft_Items
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.item_recipe_availible.size
      if ci::Item_Craft_Type.keys.include?($game_party.item_recipe_availible[i])
        if ci::Item_Craft_Type[$game_party.item_recipe_availible[i]] == type
      @data.push($data_items[$game_party.item_recipe_availible[i]])
    end
  end
end
    for i in 0...$game_party.weapon_recipe_availible.size
      if ci::Weapon_Craft_Type.keys.include?($game_party.weapon_recipe_availible[i])
        if ci::Weapon_Craft_Type[$game_party.weapon_recipe_availible[i]] == type
      @data.push($data_weapons[$game_party.weapon_recipe_availible[i]])
    end
  end
end
    for i in 0...$game_party.armor_recipe_availible.size
      if ci::Armor_Craft_Type.keys.include?($game_party.armor_recipe_availible[i])
        if ci::Armor_Craft_Type[$game_party.armor_recipe_availible[i]] == type
      @data.push($data_armors[$game_party.armor_recipe_availible[i]])
    end
  end
end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32 + 32)
        # "Items" window font
      
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    item = @data[index]
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 120, 32, "Name:")
    self.contents.draw_text(0, 0, 224, 32, "Made:", 2)
    self.contents.font.color = normal_color
    x = 4
    y = index * 32
    case item
    when RPG::Item
      if $game_party.item_recipes_made[item.id] > 0
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.item_recipes_made[item.id].to_s, 2)
      else
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.item_recipes_made[item.id].to_s, 2)
      end
    when RPG::Weapon
      if $game_party.weapon_recipes_made[item.id] > 0
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.weapon_recipes_made[item.id].to_s, 2)
      else
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.weapon_recipes_made[item.id].to_s, 2)
      end
    when RPG::Armor
      if $game_party.armor_recipes_made[item.id] > 0
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.armor_recipes_made[item.id].to_s, 2)
      else
        self.contents.draw_text(x, y + 32, 224, 32, item.name)
        self.contents.draw_text(x - 8, y + 32, 224, 32, $game_party.armor_recipes_made[item.id].to_s, 2)
      end
    end
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      x = 0
      y = index * 32 + 32
      self.cursor_rect.set(x, y, (self.width - 32), 32)
    end
  end
end
#=============================================
#  END Window_Craft_List
#=============================================

    
#=============================================
#  Window_Craft_Desc
#=============================================
class Window_Craft_Desc < Window_Base
  def initialize(item)
    super(256, 64, 384, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    
    
    self.opacity = 255
    refresh(item)
  end
 
  def refresh(item)
    self.contents.clear
    ci = Craft_Items
    if item != nil
      self.contents.font.color = system_color
      self.contents.draw_text(0, 64, 352, 32, "Materials:", 1)
      self.contents.draw_text(0, 96, 150, 32, "Name:")
      self.contents.draw_text(190, 96, 120, 32, "Needed:")
      self.contents.draw_text(280, 96, 120, 32, "Own:")
      self.contents.font.color = normal_color
      @items = []
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      case item
      when RPG::Item
        if $game_party.item_recipes_made[item.id] > 0
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        else
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        end
      when RPG::Weapon
        if $game_party.weapon_recipes_made[item.id] > 0
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        else
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        end
      when RPG::Armor
        if $game_party.armor_recipes_made[item.id] > 0
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        else
          self.contents.draw_text(28, 0, 200, 32, item.name)
          self.contents.draw_text(10, 32, 352, 32, item.description)
        end
      end
      case item
      when RPG::Item
        #p ci::Craft_Item_Comp[item.id]
        for i in 0...ci::Craft_Item_Comp[item.id].size
          item2 = ci::Craft_Item_Comp[item.id][i][0]
          case ci::Craft_Item_Comp[item.id][i][1]
          when 0
            @items.push([$data_items[ci::Craft_Item_Comp[item.id][i][0]], ci::Craft_Item_Comp[item.id][i][2]])
          when 1
            @items.push([$data_weapons[ci::Craft_Item_Comp[item.id][i][0]], ci::Craft_Item_Comp[item.id][i][2]])
          when 2
            @items.push([$data_armors[ci::Craft_Item_Comp[item.id][i][0]], ci::Craft_Item_Comp[item.id][i][2]])
          end
        end
      when RPG::Weapon
        for i in 0...ci::Craft_Weapon_Comp[item.id].size
          item2 = ci::Craft_Weapon_Comp[item.id][i][0]
          case ci::Craft_Weapon_Comp[item.id][i][1]
          when 0
            @items.push([$data_items[ci::Craft_Weapon_Comp[item.id][i][0]], ci::Craft_Weapon_Comp[item.id][i][2]])
          when 1
           @items.push([$data_weapons[ci::Craft_Weapon_Comp[item.id][i][0]], ci::Craft_Weapon_Comp[item.id][i][2]])
          when 2
            @items.push([$data_armors[ci::Craft_Weapon_Comp[item.id][i][0]], ci::Craft_Weapon_Comp[item.id][i][2]])
          end
        end
      when RPG::Armor
        for i in 0...ci::Craft_Armor_Comp[item.id].size
          item2 = ci::Craft_Armor_Comp[item.id][i][0]
          case ci::Craft_Armor_Comp[item.id][i][1]
          when 0
            @items.push([$data_items[ci::Craft_Armor_Comp[item.id][i][0]], ci::Craft_Armor_Comp[item.id][i][2]])
          when 1
            @items.push([$data_weapons[ci::Craft_Armor_Comp[item.id][i][0]], ci::Craft_Armor_Comp[item.id][i][2]])
          when 2
            @items.push([$data_armors[ci::Craft_Armor_Comp[item.id][i][0]], ci::Craft_Armor_Comp[item.id][i][2]])
          end
        end
      end
      for i in 0...@items.size
        x = 5
        y = i * 32 + 128
        case @items[i][0]
        when RPG::Item
          if $game_party.item_number(@items[i][0].id) >= @items[i][1]
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          bitmap = RPG::Cache.icon(@items[i][0].icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 200, 32, @items[i][0].name)
          self.contents.draw_text(x + 210, y, 50, 32, @items[i][1].to_s)
          self.contents.draw_text(x + 290, y, 50, 32, $game_party.item_number(@items[i][0].id).to_s)
        when RPG::Weapon
          if $game_party.weapon_number(@items[i][0].id) >= @items[i][1]
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          bitmap = RPG::Cache.icon(@items[i][0].icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 200, 32, @items[i][0].name)
          self.contents.draw_text(x + 210, y, 50, 32, @items[i][1].to_s)
          self.contents.draw_text(x + 290, y, 50, 32, $game_party.weapon_number(@items[i][0].id).to_s)
        when RPG::Armor
          if $game_party.armor_number(@items[i][0].id) >= @items[i][1]
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          bitmap = RPG::Cache.icon(@items[i][0].icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 200, 32, @items[i][0].name)
          self.contents.draw_text(x + 210, y, 50, 32, @items[i][1].to_s)
          self.contents.draw_text(x + 290, y, 50, 32, $game_party.armor_number(@items[i][0].id).to_s)
        end
      end
    end
  end
end
#=============================================
#  END Window_Craft_Desc
#=============================================


#=============================================
#  Scene_Craft
#=============================================
class Scene_Craft
 
  def initialize(type)
    @type = type
  end
 
  def main
    @info_window = Window_Craft_Info.new
    @list_window = Window_Craft_List.new
    @list_window.refresh(@type)
    @desc_window = Window_Craft_Desc.new(@list_window.list)
    @list_window.height = 416
    @background = Sprite.new
    @background.bitmap = RPG::Cache.picture("background")
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    
    @info_window.dispose
    @list_window.dispose
    @desc_window.dispose
    @background.dispose
  end
 
  def update
    ci = Craft_Items
    @info_window.update("Select an item to create.")
    @list_window.update
    @desc_window.update
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      @desc_window.refresh(@list_window.list)
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      @counter = 0
      case @list_window.list
      when RPG::Item
        for i in 0...ci::Craft_Item_Comp[@list_window.list.id].size
          case ci::Craft_Item_Comp[@list_window.list.id][i][1]
          when 0
            if $game_party.item_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 1
            if $game_party.weapon_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 2
            if $game_party.armor_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          end
        end
        if @counter == ci::Craft_Item_Comp[@list_window.list.id].size
          for i in 0...ci::Craft_Item_Comp[@list_window.list.id].size
            case ci::Craft_Item_Comp[@list_window.list.id][i][1]
            when 0
              if $game_party.item_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
                $game_party.lose_item(ci::Craft_Item_Comp[@list_window.list.id][i][0], ci::Craft_Item_Comp[@list_window.list.id][i][2])
              end
            when 1
              if $game_party.weapon_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
                $game_party.lose_weapon(ci::Craft_Item_Comp[@list_window.list.id][i][0], ci::Craft_Item_Comp[@list_window.list.id][i][2])
              end
            when 2
              if $game_party.armor_number(ci::Craft_Item_Comp[@list_window.list.id][i][0]) >= ci::Craft_Item_Comp[@list_window.list.id][i][2]
                $game_party.lose_armor(ci::Craft_Item_Comp[@list_window.list.id][i][0], ci::Craft_Item_Comp[@list_window.list.id][i][2])
              end
            end
          end
          $game_system.se_play($data_system.decision_se)
          $game_party.gain_item(@list_window.list.id, 1)
          $game_party.item_recipes_made[@list_window.list.id] += 1
          @list_window.refresh(@type)
          @desc_window.refresh(@list_window.list)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      when RPG::Weapon
        for i in 0...ci::Craft_Weapon_Comp[@list_window.list.id].size
          case ci::Craft_Weapon_Comp[@list_window.list.id][i][1]
          when 0
            if $game_party.item_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 1
            if $game_party.weapon_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 2
            if $game_party.armor_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          end
        end
        if @counter == ci::Craft_Weapon_Comp[@list_window.list.id].size
          for i in 0...ci::Craft_Weapon_Comp[@list_window.list.id].size
            case ci::Craft_Weapon_Comp[@list_window.list.id][i][1]
            when 0
              if $game_party.item_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
                $game_party.lose_item(ci::Craft_Weapon_Comp[@list_window.list.id][i][0], ci::Craft_Weapon_Comp[@list_window.list.id][i][2])
              end
            when 1
              if $game_party.weapon_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
                $game_party.lose_weapon(ci::Craft_Weapon_Comp[@list_window.list.id][i][0], ci::Craft_Weapon_Comp[@list_window.list.id][i][2])
              end
            when 2
              if $game_party.armor_number(ci::Craft_Weapon_Comp[@list_window.list.id][i][0]) >= ci::Craft_Weapon_Comp[@list_window.list.id][i][2]
                $game_party.lose_armor(ci::Craft_Weapon_Comp[@list_window.list.id][i][0], ci::Craft_Weapon_Comp[@list_window.list.id][i][2])
              end
            end
          end
        $game_system.se_play($data_system.decision_se)
        $game_party.gain_weapon(@list_window.list.id, 1)
        $game_party.weapon_recipes_made[@list_window.list.id] += 1
        @list_window.refresh(@type)
        @desc_window.refresh(@list_window.list)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      when RPG::Armor
        for i in 0...ci::Craft_Armor_Comp[@list_window.list.id].size
          case ci::Craft_Armor_Comp[@list_window.list.id][i][1]
          when 0
            if $game_party.item_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 1
            if $game_party.weapon_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          when 2
            if $game_party.armor_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
              @counter += 1
            end
          end
        end
        if @counter == ci::Craft_Armor_Comp[@list_window.list.id].size
          for i in 0...ci::Craft_Armor_Comp[@list_window.list.id].size
            case ci::Craft_Armor_Comp[@list_window.list.id][i][1]
            when 0
              if $game_party.item_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
                $game_party.lose_item(ci::Craft_Armor_Comp[@list_window.list.id][i][0], ci::Craft_Armor_Comp[@list_window.list.id][i][2])
              end
            when 1
              if $game_party.weapon_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
                $game_party.lose_weapon(ci::Craft_Armor_Comp[@list_window.list.id][i][0], ci::Craft_Armor_Comp[@list_window.list.id][i][2])
              end
            when 2
              if $game_party.armor_number(ci::Craft_Armor_Comp[@list_window.list.id][i][0]) >= ci::Craft_Armor_Comp[@list_window.list.id][i][2]
                $game_party.lose_armor(ci::Craft_Armor_Comp[@list_window.list.id][i][0], ci::Craft_Armor_Comp[@list_window.list.id][i][2])
              end
            end
          end
        $game_system.se_play($data_system.decision_se)
        $game_party.gain_armor(@list_window.list.id, 1)
        $game_party.armor_recipes_made[@list_window.list.id] += 1
        @list_window.refresh(@type)
        @desc_window.refresh(@list_window.list)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      end
    end
    return
  end
end

Share this post


Link to post
Share on other sites

I don't really understand your first problem, there shouldn't be anything preventing you from displaying that information.

As far as the second...
I don't know what you have been doing to the script, but I couldn't even make it show me a single recipe, let alone test it
After checking out the original, I also think it would be a better idea to look for a script that better fits your needs, this one uses enumerations so you can't have multiple recipes for the same item.
And for the scrolling issure, replace her update_cursor_rect with this one.
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 2)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 2)
    end
    # Calculate cursor width
    cursor_width = self.width / @column_max - 32
    # Calculate cursor coordinates
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    # Update cursor rectangle
    self.cursor_rect.set(x, y+32, cursor_width, 32)
  end
Unfortunately this means that the name and made words scroll along with the page, but that's just a side effect of rpg viewports.
 

Share this post


Link to post
Share on other sites

Thanks, that worked :D I'll probably have to make a separate window for Made and Name though.

 

And for the first problem, there apparently is something preventing me from doing that, so if you could maybe give me a way to do it that would be great.

I've tried this:

 

#===============================================================================
# Show equipment elements
    @item = $data_weapons[$item10.id]
    @item = $data_weapons[@actor.weapon_id]
    if @item.is_a?(RPG::Weapon)
      # Check elements for dummy IDs
        for elementa in 0...@item.element_set.size
            elementcheck = @item.element_set[elementa]
          if elementcheck < 17
            # Draw Element List
            elementx = 300 + elementa % 2 * 80
            elementy = 16 + elementa / 3 * 20
            self.contents.draw_text(elementx, elementy, 120, 32,
            $data_system.elements[@item.element_set[elementa]])
          end
        end
        # List Weapon states
        for statei in 0...@item.plus_state_set.size
          statex = 240 + statei % 3 * 130
          statey = 300 + statei / 3 * 20
          self.contents.draw_text(statex, statey, 120, 32,
          $data_states[@item.plus_state_set[statei]].name)
        end
      end
      # List Armor elements and states
      if @item.is_a?(RPG::Armor)
      # Check elements for dummy IDs
        for elementa in 0...@item.guard_element_set.size
            elementcheck = @item.guard_element_set[elementa]
          if elementcheck < 15
            # Draw Element List
            elementx = 0 + elementa % 3 * 80
            elementy = 300 + elementa / 3 * 20
            self.contents.draw_text(elementx, elementy, 120, 32,
            $data_system.elements[@item.guard_element_set[elementa]])
          end
        end
        # List Weapon states
        for statei in 0...@item.guard_state_set.size
          statex = 240 + statei % 3 * 130
          statey = 300 + statei / 3 * 20
          self.contents.draw_text(statex, statey, 120, 32,
          $data_states[@item.guard_state_set[statei]].name)
        end
      end

but it doesn't work.

 

And I probably should've mentioned that you can test the crafting system the way I have it by using:

$scene = Scene_Craft.new('potion') or $scene = Scene_Craft.new('smith')

 

The recipes might not appear right away though. If that happens, use an event or something to give you an item and it should reset or something.

Share this post


Link to post
Share on other sites

WIthout a functional script I can only take guesses.

But I'm already seeing some problems.

The first and second lines overwrite each other.

@item = $data_weapons[$item10.id]
@item = $data_weapons[@actor.weapon_id]

Error 2 you are setting @item to the value of $data_weapons, which only happens to contain RPG::Weapon class objects that means it always executes the code for weapons, even when the id you pass is not for a weapon. 

 

What you need do for starters is to pass the item whose information you want to show, not just it's id. It's stored in the @data array of the Window_Equip classes.

If I understand your code correctly you should be able to do that by replacing those lines with

@item=$item10

There is also a minus_state_set array you might want to loop trough, for weapons.

And an auto state for armors. And character stat increases.

Share this post


Link to post
Share on other sites

Not sure what you just said, but the reason I have it only doing it for weapons is it will display a bit differently depending on whether it's a weapon or armor. I was just doing weapons first. Once I get weapons working, the armor should be easy.

Share this post


Link to post
Share on other sites

Long story short, you take an item, use it's id to convert it to a weapon, then check the item class, then you use that weapon to display information.

Change this:

@item = $data_weapons[$item10.id]
@item = $data_weapons[@actor.weapon_id]t

To that:

@item=$item10

That should help.

Edited by Saltome

Share this post


Link to post
Share on other sites

That worked, thanks :D

 

Edit: Well...sorta. It will display, but only after the Window_EquipItem has been activated at least once...does that make sense?

 

edit2: Maybe this will make more sense. It works, but it only updates in the Window_EquipItem menu. I got it to work once before, but it only showed the current equipment. Now I have the opposite problem.

Share this post


Link to post
Share on other sites

Yeah, it makes sense. If you need to activate Window_EquipItem, that means your $item10 is set to the currently selected item in the list of equipable items, and you can't do that unless the window is active. If you set $item10 to the Window_EquipRight.item you will get the currently selected slot of the already equipped items.

 

There are a couple of different things that could be causing the problem, so I can't solve it without seeing the code.

You are either not setting $item10 in the right place, at the right time, or to the right variable.

Or you are overwriting it before the proper information is displayed.

I need to see the equip scene and windows, so I can track the variable and pinpoint the exact problem.

Share this post


Link to post
Share on other sites

Ahh, now I see.

You have two problems:

Firstly, about line 110 in *Scene_Equip:

if @right_window.active

You need to change it to:

if @right_window.active
      item2=@right_window.item
      $item10=@right_window.item

This tells equip_stats window that it needs to display a new item, when you are in the equip_right window.

Secondly, window_equip_stat line 264:

The problem here is that you only call the refresh method when you pass arguments to set_new_parameters. So when you pass nil arguments to the method from equip_state window it skips the refresh method preventing it from drawing the elements.

Either improve set_new_parameters to check for elements and stats, or place the refresh method outside the IF statement.

This:

      refresh
    end

To that:

    end

    refresh

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...