Save-Point
Equipment Upgrade System by Charlie Fleed, Version 1.2 - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Equipment Upgrade System by Charlie Fleed, Version 1.2 (/thread-2299.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - Charlie Fleed - 11-18-2009

You got the script's behavior right. That's exactly how it works.
When generating a new enhanced equipment all the original equipment's elements are copied, therefore if the script worked with elements it would recognize the 2 hands weapon.
For the scripts that work with ids there is the possibility to check out the id of the original equipment a new equipment has been generated from, that is the ref_id attribute. This is what the patch for MNK_STATIONARY_WEAPONS in the first page does. You just have to find the line(s) where the script checks if the equipment id is included in the 2 hands ids array and separate the two cases RPG::Weapon and Enhanced_Weapon (the same goes with armors of course), where the standard behavior has to be used with standard weapons, while for Enhanced Weapons the script must refer to the ref_id attribute instead of id. Take a look at the patch, it's a very simple change.


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - mageone - 11-18-2009

thanks a lot for your prompt reply Charlie.
should i look for the lines in Enhanced Equipment script or in AAS script ?


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - Charlie Fleed - 11-18-2009

That's something you need to do in the script that manages the 2 hands weapon detection.


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - mageone - 11-18-2009

thank you for your patience Charlie, and sorry i didn't succeed.

i think i have to change things here :

Code:
def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add equippable weapons
     if @equip_type == 0 or (@equip_type == 1 and @actor.two_swords_style)
      weapon_set = $data_classes[@actor.class_id].weapon_set
      for i in 1...$data_weapons.size
        next if Two_Hands_Weapons.include?(i) and @equip_type == 1
        next if Right_Hand_Weapons.include?(i) and @equip_type == 1
        next if Left_Hand_Weapons.include?(i) and @equip_type == 0
        if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
          @data.push($data_weapons[i])
        end
        # CHARLIE: add new weapons which cannot be part of the weapon set
        if i > $game_party.max_database_weapon_id
          if $game_party.weapon_number(i) > 0 and weapon_set.include?($data_weapons[i].ref_id)
            @data.push($data_weapons[i])
          end
        end
      end
    end
# Add equippable armor
if @equip_type > 1 or (@equip_type == 1 and not @actor.two_swords_style)
      armor_set = $data_classes[@actor.class_id].armor_set
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and armor_set.include?(i)
          if $data_armors[i].type_id == @equip_type
            @data.push($data_armors[i])
          end
        end
        # CHARLIE: add new armors which cannot be part of the armor set
        if i > $game_party.max_database_armor_id
          if $game_party.armor_number(i) > 0 and armor_set.include?($data_armors[i].ref_id)
            if $data_armors[i].kind == @equip_type-1
              @data.push($data_armors[i])
            end
          end
        end
      end
    end
    # Add blank page
    @data.push(nil)unless @actor.lock_equip(@equip_type)
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, [row_max, 1].max * 32)
    self.opacity = Equip_Window_Opacity
    for i in 0...(@actor.lock_equip(@equip_type) ? @item_max : @item_max - 1)
      draw_item(i)
       end

or in the attached part that is too big for the post.

but i fail to find how to type it. can you advise anything please,
it is really important for me

sorry for inconveniences and thank you


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - Charlie Fleed - 11-19-2009

I have thought a little about this and I think that the most simple and effective way to solve the two-hands weapons problem is the following.

Add the following snippet of code at the beginning of the script page "Enhanced Equipment" (EDIT: updated)

Code:
class Game_System
  attr_accessor :two_hands_enhanced_weapons
  attr_accessor :left_hand_enhanced_weapons
  attr_accessor :right_hand_enhanced_weapons
  
  alias ee_initialize initialize
  def initialize
    ee_initialize
    @two_hands_enhanced_weapons=[]
    @left_hand_enhanced_weapons=[]
    @right_hand_enhanced_weapons=[]
  end
end

Modify the beginning of the initialize method for the class Enhanced_Weapon making it look like this:

Code:
def initialize(ref_id)
    @ref_id=ref_id
    @id = $game_party.max_used_weapon_id + 1
    $game_system.two_hands_enhanced_weapons.push(@id) if Two_Hands_Weapons.include?(ref_id)
    $game_system.right_hand_enhanced_weapons.push(@id) if Right_Hand_Weapons.include?(ref_id)
    $game_system.left_hand_enhanced_weapons.push(@id) if Left_Hand_Weapons.include?(ref_id)
    ...


Wherever the arrays Two_Hands_Weapons, Right_Hand_Weapons and Left_Hand_Weapons are used in the AAS script, apply these changes (updated):

Code:
Two_Hands_Weapons => (Two_Hands_Weapons|$game_system.two_hands_enhanced_weapons)
Left_Hand_Weapons => (Left_Hand_Weapons|$game_system.left_hand_enhanced_weapons)
Right_Hand_Weapons => (Right_Hand_Weapons|$game_system.right_hand_enhanced_weapons)

For example, in order for the script variation you posted on Nov 15 to work, it must be changed like this:
Code:
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  This window displays choices when opting to change equipment on the
#  equipment screen.
#==============================================================================

class Window_EquipItem < Window_Selectable
  

  #--------------------------------------------------------------------------
  attr_accessor :data
  #--------------------------------------------------------------------------
  def initialize(actor, equip_type)
    case Equip_Menu_Syle
    when 0,2
      super(0, 256, 640, 224)
      @column_max = 2
    when 1
      super(0, 288, 640, 192)
      @column_max = 2
    when 3
      super(272, 256, 368, 224)
      @column_max = 1
    when 4
      super(0, 256, 368, 224)
      @column_max = 1
    end
    @actor = actor
    @equip_type = equip_type
    refresh
    self.active = false
    self.index = -1
  end


  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add equippable weapons
     if @equip_type == 0 or (@equip_type == 1 and @actor.two_swords_style)
      weapon_set = $data_classes[@actor.class_id].weapon_set
      for i in 1...$data_weapons.size
        next if (Two_Hands_Weapons|$game_system.two_hands_enhanced_weapons).include?(i) and @equip_type == 1
        next if (Right_Hand_Weapons|$game_system.right_hand_enhanced_weapons).include?(i) and @equip_type == 1
        next if (Left_Hand_Weapons|$game_system.left_hand_enhanced_weapons).include?(i) and @equip_type == 0
        if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
          @data.push($data_weapons[i])
        end
        # CHARLIE: add new weapons which cannot be part of the weapon set
        if i > $game_party.max_database_weapon_id
          if $game_party.weapon_number(i) > 0 and weapon_set.include?($data_weapons[i].ref_id)
            @data.push($data_weapons[i])
          end
        end
      end
    end



Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - mageone - 11-19-2009

thank you so much for your hard work Charlie.

atm i m testing the script bcz i can't get it work.

i got error message uninitialized constant Window_Equip_Item::Two_Hands_Weapons

will look deeper in it..
thanks again so much !


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - Charlie Fleed - 11-19-2009

That's strange. You had Two_Hands_Weapons before.

EDIT: I spotted an error in the first block of code. Copy and use the updated one.


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - mageone - 11-19-2009

sorry Charlie, i don't get it.
i have made a demo and have sent it to you.



EDIT : Charlie your script is working. got it finally working, thank you again and again.
just for info, at first i did :

Code:
def initialize(ref_id)
    @ref_id=ref_id
    @id = $game_party.max_used_weapon_id + 1
    $game_system.two_hands_enhanced_weapons.push(@id) if Two_Hands_Weapons.include?(ref_id)
    $game_system.right_hand_enhanced_weapons.push(@id) if Right_Hand_Weapons.include?(ref_id)
    $game_system.left_hand_enhanced_weapons.push(@id) if Left_Hand_Weapons.include?(ref_id)

def initialize(ref_id)
    @ref_id=ref_id
    @id = $game_party.max_used_weapon_id + 1
    # print("creazione nuova arma\nref_id=" + @ref_id.to_s + "\nid=" + @id.to_s)
    $game_party.max_used_weapon_id += 1
    if DEBUG_EW
      @name = $data_weapons[@ref_id].name + " #" + @id.to_s
    else
      @name = $data_weapons[@ref_id].name
    end

instead of :

Code:
def initialize(ref_id)
    @ref_id=ref_id
    @id = $game_party.max_used_weapon_id + 1
    $game_system.two_hands_enhanced_weapons.push(@id) if Two_Hands_Weapons.include?(ref_id)
    $game_system.right_hand_enhanced_weapons.push(@id) if Right_Hand_Weapons.include?(ref_id)
    $game_system.left_hand_enhanced_weapons.push(@id) if Left_Hand_Weapons.include?(ref_id)


    # print("creazione nuova arma\nref_id=" + @ref_id.to_s + "\nid=" + @id.to_s)
    $game_party.max_used_weapon_id += 1
    if DEBUG_EW
      @name = $data_weapons[@ref_id].name + " #" + @id.to_s
    else
      @name = $data_weapons[@ref_id].name
    end


btw, it is working without the MNK patch. is it bcz of your new codes ?


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - Charlie Fleed - 11-19-2009

Maybe you got the two version switched...as the second one is correct.
Anyway I saw a typo in my previous post, as in the changes I had written $game_system.two_hands_weapons instead of $game_system.two_hands_enhanced_weapons. Now it has been fixed. I'm sending you back the demo with my corrections (there was also a missing "Two_Hands_Weapons => (Two_Hands_Weapons|$game_system.two_hands_enhanced_weapons)" substitution).
I only made changes in "AAS" and "Enhanced Equipment".


Customizable (Enhanced) Equipment by Charlie Fleed, Version 1.0 - mageone - 11-19-2009

Charlie you did a perfect job. thank you.

what does it mean :

for i in 0...@slots
@accessories[i] = nil


this mess with the crafting weapons script.
i cannot create enhanced weapons with blacksmith