Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: blazinhandle on January 21, 2008, 04:05:33 am

Title: [RESOLVED] Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 21, 2008, 04:05:33 am
I apologize if my asking for help seems to be quite the trend lately, but I've literally been working with this all day and am still stuck. I have two problems that correspond with eachother:

Problem A:

I'm creating a system that boosts an actor's INT based on an equipped fifth armor called formation (think of it as a rank). The three armors are "Captain", "Corporal", and "Armour".

Each armour holds an additional attribute (Captain= captain_int, Corporal= corporal_int, Armor=armour_int) that boosts the actor's INT.

However, when equipped, the armor also changes the actor's party position (Captain delegates the actor to $game_party.actor[0], Corporal delegates the actor to $game_party.actor[1], and Armour delegates the actor to $game_party.actor[2]).

I'm having trouble actually creating a fifth armor slot, creating a new attribute that will actually add to an actor's INT, and finding a way to get an armor to actually set an actor's party position.

I apologize if it's a bit sloppy, I've run through this several times and this is what I've figured thus far:

Spoiler: ShowHide
class Game_Actor
 
 if @stack.nil?
   alias a5_int int
   @stack = true
 end
 
 def int
   n = a5_int
   armor = $data_weapons[@armor5_id]
   n += weapon != nil ? armor5.a5_int : 0
   n = [[n, 1].max, 9999].min
   return n
 end
end

module RPG
 class Armor
   attr_writer :captain_int
   attr_writer :corporal_int
   attr_writer :armour_int
   def captain_int
     return 0    if @captain_int.nil?
     return @captain_int
   end
   def corporal_int
     return 0    if @corporal_int.nil?
     return @corporal_int
   end
   def armour_int
     return 0    if @armour_int.nil?
     return @armour_int
   end
 end
end

class Additional_Attributes
 def self.run
   $data_armors[96].captain_int = 0
   $data_armors[97].corporal_int = 0
   $data_armors[98].armour_int = 0
 end
end


Problem B:

NOTE: I have this set up to affect armor4 rather than armor5 so that I could test it out without actually having an armor5 additional slot set up.

I've made a scene to properly equip the armor5 armor. The way it is setup is that you simply can equip/unequip armor5 armors and switches between actors with L and R.

However, I need it to HAVE to have an armor5 equipped for every character in the party. I also can't cyle left and right with a cursor and have the windows move to the appropriate index rather than remain stationary so that the player knows who is equipping what.

This is mostly parallel's $Scene_Equip and it's windows:

Scene_Formation
Spoiler: ShowHide

class Scene_Formation
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     actor_index : actor index
 #     equip_index : formation index
 #--------------------------------------------------------------------------
 def initialize(actor_index = 0)
   @actor_index = actor_index
 end
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Get actor
   @actor = $game_party.actors[@actor_index]
   # Make windows
   @help_window = Window_Equip_Help.new
   @help_window.x-=12
   @help_window.y=330
   @formationstats_window = Window_FormationStats.new(@actor)
   @formation_window = Window_Formation.new
   @item_windowf = Window_FormationInventory.new(@actor)
   # Associate help window
   @formation_window.help_window = @help_window
   @item_windowf.help_window = @help_window
   # Set cursor position
   @formation_window.index = 0
   refresh
   # 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
   @formationstats_window.dispose
   @formation_window.dispose
   @item_windowf.dispose
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   # Set item window to visible
   @item_windowf.visible = (@formation_window.index == 0)
   # Get currently equipped item
   item1 = @formation_window.item
   # Set current item window to @item_window
   case @formation_window.index
   when 0
     @item_window = @item_windowf
   end
   # If right window is active
   if @formation_window.active
     # Erase parameters for after formation change
     @formationstats_window.set_new_parameters(nil)
   end
   # If item window is active
   if @item_window.active
     # Get currently selected item
     item2 = @item_window.item
     # Change formation
     last_hp = @actor.hp
     last_sp = @actor.sp
     @actor.equip(4, item2 == nil ? 0 : item2.id)
     # Get parameters for after formation change
     new_atk = @actor.atk
     new_pdef = @actor.pdef
     new_mdef = @actor.mdef
     new_str = @actor.str
     new_dex = @actor.dex
     new_agi = @actor.agi
     new_int = @actor.int
     # Return formation
     @actor.equip(0, item1 == nil ? 0 : item1.id)
     @actor.hp = last_hp
     @actor.sp = last_sp
     # Draw in left window
     @formationstats_window.set_new_parameters(new_int)
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @formationstats_window.update
   @formation_window.update
   @item_window.update
   @help_window.update
   refresh
   # If right window is active: call update_right
   if @formation_window.active
     update_formation
     return
   end
   # If item window is active: call update_item
   if @item_window.active
     update_item
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when right window is active)
 #--------------------------------------------------------------------------
 def update_formation
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to menu screen
     $scene = Scene_Menu.new(8)
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Activate item window
     @formation_window.active = false
     @item_window.active = true
     @item_window.index = 0
     return
   end
   # If R button was pressed
   if Input.trigger?(Input::R)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # To next actor
     @actor_index += 1
     @actor_index %= $game_party.actors.size
     # Switch to different equipment screen
     $scene = Scene_Formation.new(@actor_index)
     return
   end
   # If L button was pressed
   if Input.trigger?(Input::L)
     # Play cursor SE
     $game_system.se_play($data_system.cursor_se)
     # To previous actor
     @actor_index += $game_party.actors.size - 1
     @actor_index %= $game_party.actors.size
     # Switch to different equipment screen
     $scene = Scene_Formation.new(@actor_index)
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when item window is active)
 #--------------------------------------------------------------------------
 def update_item
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Activate right window
     @formation_window.active = true
     @item_window.active = false
     @item_window.index = -1
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Play equip SE
     $game_system.se_play($data_system.equip_se)
     # Get currently selected data on the item window
     item = @item_window.item
     # Change formation
     @actor.equip(0, item == nil ? 0 : item.id)
     # Activate right window
     @formation_window.active = true
     @item_window.active = false
     @item_window.index = -1
     # Remake right window and item window contents
     @formation_window.refresh
     @item_window.refresh
     return
   end
 end
end


Scene_Formation's Windows
Spoiler: ShowHide

class Window_FormationStats < Window_Base
 def initialize(actor)
   super(95, 210, 390, 180)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Arial"
   self.contents.font.bold = true
   self.contents.font.size = 14
   self.opacity=0
   @actor = actor
   refresh
 end
   $desired_arrow_style = "ยป"
   $color_coded_bonuses = true
   $stat_goes_up_color = Color.new(0, 255, 0, 255)
   $stat_goes_down_color = Color.new(255, 20, 20, 255)
   $stat_stays_the_same_color = Color.new(255, 255, 255)
   $display_atk =  [true, 0] # Attack Power
   $display_pdef = [true, 0] # Vigor
   $display_int =  [true, 1] # Judgment
   $display_mdef = [true, 0] # Savvy
   $display_str =  [true, 0] # Strength
   $display_dex =  [true, 0] # Execution
   $display_agi =  [true, 0] # Parry
   $list_start_y_pos = -20
   $seperation_distance = 15
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   if  $display_int[0] == true
     draw_actor_parameter(@actor, 8,  $list_start_y_pos+($seperation_distance*$display_int[1]), 2)
   end
   
   if @new_int != nil
     if $color_coded_bonuses == true
       if @new_int > @actor.int
         self.contents.font.color = $stat_goes_up_color
         self.contents.draw_text(152, $list_start_y_pos+($seperation_distance*$display_int[1]), 40, 32, $desired_arrow_style, 1)
         self.contents.draw_text(165, $list_start_y_pos+($seperation_distance*$display_int[1]), 36, 32, @new_int.to_s, 2)
       elsif @new_int == @actor.int
         self.contents.font.color = $stat_stays_the_same_color
         self.contents.draw_text(152, $list_start_y_pos+($seperation_distance*$display_int[1]), 40, 32, $desired_arrow_style, 1)
         self.contents.draw_text(165, $list_start_y_pos+($seperation_distance*$display_int[1]), 36, 32, @new_int.to_s, 2)
       elsif @new_int < @actor.int
         self.contents.font.color = $stat_goes_down_color
         self.contents.draw_text(152, $list_start_y_pos+($seperation_distance*$display_int[1]), 40, 32, $desired_arrow_style, 1)
         self.contents.draw_text(165, $list_start_y_pos+($seperation_distance*$display_int[1]), 36, 32, @new_int.to_s, 2)
       end
     elsif
     self.contents.font.color = system_color
     self.contents.draw_text(152, $list_start_y_pos+($seperation_distance*$display_int[1]), 40, 32, $desired_arrow_style, 1)
     self.contents.font.color = normal_color
     self.contents.draw_text(165, $list_start_y_pos+($seperation_distance*$display_int[1]), 36, 32, @new_int.to_s, 2)
     end
   end

 end
 def set_new_parameters(new_int)
   if @new_int != new_int

      @new_int = new_int
      refresh
   end
 end

end

Spoiler: ShowHide

class Window_Formation < Window_Selectable
 def initialize
   super(0, 0, 640, 180)
   self.contents = Bitmap.new(width - 32, height - 25)
   @cursor = Sprite.new
   @cursor.bitmap = RPG::Cache.picture("Cursor")
   @cursor.z = z + 10
   refresh
   self.index = 0
   self.opacity=0
 end
 #--------------------------------------------------------------------------
 # * New Cursor BEGIN
 #--------------------------------------------------------------------------
 def top_row
   return self.oy / 25
 end
 
 def top_row=(row)
   row = 0 if row < 0
   row = row_max - 1 if row > row_max - 1
   self.oy = row * 25
 end
 
 def page_row_max
   return (self.height - 25) / 25
 end
 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
     return
   end
   row = @index / @column_max
   self.top_row = row if row < self.top_row
   if row > self.top_row + (self.page_row_max - 1)
     self.top_row = row - (self.page_row_max - 1)
   end
   cursor_width = self.width / @column_max - 32
   @cursor.x = 113
   @cursor.y = (self.y+16) + @index / @column_max * 25 - self.oy
 end
 def dispose
   @cursor.dispose
   super
 end
 def visible=(visible)
   if visible == false
     @cursor.visible = false
   end
   if visible == true
     @cursor.visible = true
   end
   super
 end
 #--------------------------------------------------------------------------
 # * New Cursor END
 #--------------------------------------------------------------------------
 #--------------------------------------------------------------------------
 # * Item Acquisition
 #--------------------------------------------------------------------------
 def item
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     x = i * 185
     y = 105
     actor = $game_party.actors[i]
     draw_actor_battlestance(actor, x + 140, 100)
     @data = []
     @data.push($data_armors[actor.armor4_id])
     @item_max = @data.size
     self.contents.font.color = darkyellow_color
     self.contents.draw_text(7, 0, 92, 32, $data_system.words.armor4)
     draw_item_name(@data[0], x + 100, 25*0)
   end
 end
 #--------------------------------------------------------------------------
 # * Help Text Update
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
 end
end

Spoiler: ShowHide

class Window_FormationInventory < Window_Selectable
 def initialize(actor)
   super(95, 105, 300, 250)
   @actor = actor
   @cursor = Sprite.new
   @cursor.bitmap = RPG::Cache.picture("Cursor")
   @cursor.z = z + 10
   refresh
   self.active = false
   self.index = 0
   self.opacity=0
 end
 #--------------------------------------------------------------------------
 # * New Cursor BEGIN
 #--------------------------------------------------------------------------
 def dispose
   @cursor.dispose
   super
 end
 def visible=(visible)
   if visible == false
     @cursor.visible = false
   end
   if visible == true
     @cursor.visible = true
   end
   super
 end
 def top_row
   return self.oy / 32
 end
 def top_row=(row)
   row = 0 if row < 0
   row = row_max - 1 if row > row_max - 1
   self.oy = row * 32
 end
 def page_row_max
   return (self.height - 32) / 32
 end
 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
     return
   end
   row = @index / @column_max
   self.top_row = row if row < self.top_row
   if row > self.top_row + (self.page_row_max - 1)
     self.top_row = row - (self.page_row_max - 1)
   end
   cursor_width = self.width / @column_max - 32
   @cursor.x = 16
   @cursor.y = (self.y+16) + @index / @column_max * 32 - self.oy
 end
 #--------------------------------------------------------------------------
 # * New Cursor END
 #--------------------------------------------------------------------------
 #--------------------------------------------------------------------------
 # * Item Acquisition
 #--------------------------------------------------------------------------
 def item
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.index = 0
     self.contents = nil
   end
   @data = []
   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].kind == 3
         @data.push($data_armors[i])
       end
     end
   end
   # Add blank page
   @data.push(nil)
   # Make a bit map and draw all items
   @item_max = @data.size
   self.contents = Bitmap.new(width - 32, row_max * 32)
   for i in 0...@item_max-1
     draw_item(i)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   item = @data[index]
   x = 4
   y = index * 32
   bitmap = RPG::Cache.icon(item.icon_name)
   draw_skillsdisplay(index, 0, y)
   self.contents.font.name = "Arial"
   self.contents.font.bold = true
   self.contents.font.size = 14
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
   self.contents.draw_text(x + 130, y, 24, 32, "Icon", 2)
 end
 #--------------------------------------------------------------------------
 # * Help Text Update
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
 end
end


I understand this may seem like a lot, but I've put a ton of work into it today (literally 8+ hours) trying to set this up the way I want it with my pride preventing me from asking for help. Well, after much frustration, I've given in and would appreciate the help that anyone would attempt to delve in to.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Fantasist on January 21, 2008, 04:36:01 am
This is not my place of expertise, so I can't be of much help. I'll try though.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 21, 2008, 05:53:42 am
It's $data_armors and not $data_weapons. (1st code, 10th line)

Edit the party's order upon scene exit. Copy the actors array and simply change the order. A problem though would be that two can equip the same armor. >_> I suggest you leave it with the armor and make it a virtual variable that can be 0, 1 or 2 and according to that it changes the variables of the others and prints out the appropriate rank.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 21, 2008, 08:49:41 pm
What if I just made three classes which could only equip the appropriate armor:

Spoiler: ShowHide
Class:

Captain

Equippable Armor:
Rank - Captain

Position: Rear

Skills:

Rank - Captain Skill1 LVLX
Rank - Captain Skill2 LVLX
Rank - Captain Skill3 LVLX


Corporal

Equippable Armor:
Rank - Corporal

Position: Middle

Skills:

Rank - Corporal Skill1 LVLX
Rank - Corporal Skill2 LVLX
Rank - Corporal Skill3 LVLX


Armour

Equippable Armor:
Rank - Armour

Positon: Front

Skills:

Rank - Armour Skill1 LVLX
Rank - Armour Skill2 LVLX
Rank - Armour Skill3 LVLX


I'm using your CSGS, Blizz, and I could just base regular EXP (because your system does not use that type of growth) as Rank EXP and use another system (Kill Count [which I have set up for something else as well]) for adding EXP, right?

However, how would I force an equip & unequip (saying that another actor already has the armor equipped and class set to him/her) and party rearrangment using RGSS? 
Thanks.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 22, 2008, 05:57:16 am
actors = $game_party.actors
$game_party.actors.clear

And then mess around with the actors array and put them in the right places into $game_party.actors.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 01:31:32 pm
Now I'm trying to add an additional armor slot, but keep getting an "implicit conversion from nil to integer" error. What I've simply done is gone through Game_Actor and added a armor5_id (and whatever/wherever else it was appropriate) and also drawn up this (with help from Zeriab's Armor Max HP/SP script ;)):

module RPG

  class Armor
attr_writer :armor5_id
  end

  class Actor
def initialize
  @armor5_id = 0
  @armor5_fix = false
end
attr_accessor :armor5_id
attr_accessor :armor5_fix
  end

end

class Additional_Attributes
  def self.run
$data_armors[96].kind = 5
$data_armors[97].kind = 5
$data_armors[98].kind = 5
  end
end



Is there something else I am supposed to be doing?

Thanks!
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 26, 2008, 01:54:05 pm
I suggest that you never use module definition and then include the modules in the classes. Try this instead:

class Game_Actor < Game_Battler
 
  attr_accessor :armor5_id
  attr_accessor :armor5_fix
 
  alias setup_armor5_later setup
  def setup(id)
    setup_armor5_later(id)
    @armor5_id = 0
    @armor5_fix = false
  end
 
end

module Additional_Attributes
  def self.run
    $data_armors[96].kind = 5
    $data_armors[97].kind = 5
    $data_armors[98].kind = 5
  end
end
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 02:14:15 pm
It was giving me an "undefined method for class 'Actor' " error so I figured you just forgot to make it "class Game_Actor" but then it gave me a "undefine method armor5_id" error  ???
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 26, 2008, 02:17:37 pm
Try now. And yeah, it WAS Game_Actor.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 02:24:46 pm
Darn, it's giving me the same "undefined method armor5_id" error.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 26, 2008, 02:29:23 pm
I have no idea. In that code above it was defined that @armor5_id can be accessed publicly. It should work. How are you trying to call it?
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 02:36:56 pm
I have the new armor code placed below the Game_Actor script. I'm sorry Blizz, this is just really frustrating. Here's the Game_Actor script:

Spoiler: ShowHide
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :name                     # name
  attr_reader   :character_name           # character file name
  attr_reader   :character_hue            # character hue
  attr_reader   :class_id                 # class ID
  attr_reader   :weapon_id                # weapon ID
  attr_reader   :armor1_id                # shield ID
  attr_reader   :armor2_id                # helmet ID
  attr_reader   :armor3_id                # body armor ID
  attr_reader   :armor4_id                # accessory ID
  attr_reader   :armor5_id                # Rank ID
  attr_reader   :level                    # level
  attr_reader   :exp                      # EXP
  attr_reader   :skills                   # skills
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    super()
    setup(actor_id)
  end
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    actor = $data_actors[actor_id]
    @actor_id = actor_id
    @name = actor.name
    @character_name = actor.character_name
    @character_hue = actor.character_hue
    @battler_name = actor.battler_name
    @battler_hue = actor.battler_hue
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id
    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @armor5_id = actor.armor5_id  #### THIS IS WHERE THE ERROR LEADS TO
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = @exp_list[@level]
    @skills = []
    @hp = maxhp
    @sp = maxsp
    @states = []
    @states_turn = {}
    @maxhp_plus = 0
    @maxsp_plus = 0
    @str_plus = 0
    @dex_plus = 0
    @agi_plus = 0
    @int_plus = 0
    # Learn skill
    for i in 1..@level
      for j in $data_classes[@class_id].learnings
        if j.level == i
          learn_skill(j.skill_id)
        end
      end
    end
    # Update auto state
    update_auto_state(nil, $data_armors[@armor1_id])
    update_auto_state(nil, $data_armors[@armor2_id])
    update_auto_state(nil, $data_armors[@armor3_id])
    update_auto_state(nil, $data_armors[@armor4_id])
    #update_auto_state(nil, $data_armors[@armor5_id])
  end
  #--------------------------------------------------------------------------
  # * Get Actor ID
  #--------------------------------------------------------------------------
  def id
    return @actor_id
  end
  #--------------------------------------------------------------------------
  # * Get Index
  #--------------------------------------------------------------------------
  def index
    return $game_party.actors.index(self)
  end
  #--------------------------------------------------------------------------
  # * Calculate EXP
  #--------------------------------------------------------------------------
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    pow_i = 2.4 + actor.exp_inflation / 100.0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
        @exp_list[i] = @exp_list[i-1] + Integer(n)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #     element_id : element ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # Get values corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_classes[@class_id].element_ranks[element_id]]
    # If this element is protected by armor, then it's reduced by half
    for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id]
      armor = $data_armors[i]
      if armor != nil and armor.guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # If this element is protected by states, then it's reduced by half
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # End Method
    return result
  end
  #--------------------------------------------------------------------------
  # * Get State Effectiveness
  #--------------------------------------------------------------------------
  def state_ranks
    return $data_classes[@class_id].state_ranks
  end
  #--------------------------------------------------------------------------
  # * Determine State Guard
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id]
      armor = $data_armors[i]
      if armor != nil
        if armor.guard_state_set.include?(state_id)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack Element
  #--------------------------------------------------------------------------
  def element_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.element_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (+)
  #--------------------------------------------------------------------------
  def plus_state_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.plus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #--------------------------------------------------------------------------
  def minus_state_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.minus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  def maxhp
    n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    end
    n = [[Integer(n), 1].max, 9999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def base_maxhp
    return $data_actors[@actor_id].parameters[0, @level]
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum SP
  #--------------------------------------------------------------------------
  def base_maxsp
    return $data_actors[@actor_id].parameters[1, @level]
  end
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  def base_str
    n = $data_actors[@actor_id].parameters[2, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    n += armor5 != nil ? armor5.str_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Dexterity
  #--------------------------------------------------------------------------
  def base_dex
    n = $data_actors[@actor_id].parameters[3, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    n += armor5 != nil ? armor5.dex_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  def base_agi
    n = $data_actors[@actor_id].parameters[4, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    n += weapon != nil ? weapon.agi_plus : 0
    n += armor1 != nil ? armor1.agi_plus : 0
    n += armor2 != nil ? armor2.agi_plus : 0
    n += armor3 != nil ? armor3.agi_plus : 0
    n += armor4 != nil ? armor4.agi_plus : 0
    n += armor5 != nil ? armor5.agi_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  def base_int
    n = $data_actors[@actor_id].parameters[5, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    n += weapon != nil ? weapon.int_plus : 0
    n += armor1 != nil ? armor1.int_plus : 0
    n += armor2 != nil ? armor2.int_plus : 0
    n += armor3 != nil ? armor3.int_plus : 0
    n += armor4 != nil ? armor4.int_plus : 0
    n += armor5 != nil ? armor5.int_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #--------------------------------------------------------------------------
  def base_atk
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.atk : 0
  end
  #--------------------------------------------------------------------------
  # * Get Basic Physical Defense
  #--------------------------------------------------------------------------
  def base_pdef
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    pdef1 = weapon != nil ? weapon.pdef : 0
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    pdef6 = armor5 != nil ? armor5.pdef : 0
    return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 +pdef6
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic Defense
  #--------------------------------------------------------------------------
  def base_mdef
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    mdef1 = weapon != nil ? weapon.mdef : 0
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
    mdef6 = armor5 != nil ? armor5.mdef : 0
    return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6
  end
  #--------------------------------------------------------------------------
  # * Get Basic Evasion Correction
  #--------------------------------------------------------------------------
  def base_eva
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    armor5 = $data_armors[@armor5_id]
    eva1 = armor1 != nil ? armor1.eva : 0
    eva2 = armor2 != nil ? armor2.eva : 0
    eva3 = armor3 != nil ? armor3.eva : 0
    eva4 = armor4 != nil ? armor4.eva : 0
    eva5 = armor5 != nil ? armor5.eva : 0
    return eva1 + eva2 + eva3 + eva4 + eva5
  end
  #--------------------------------------------------------------------------
  # * Get Offensive Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation1_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation1_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Target Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation2_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation2_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Class Name
  #--------------------------------------------------------------------------
  def class_name
    return $data_classes[@class_id].name
  end
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  def exp_s
    return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Get Next Level EXP String
  #--------------------------------------------------------------------------
  def next_exp_s
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Get Until Next Level EXP String
  #--------------------------------------------------------------------------
  def next_rest_exp_s
    return @exp_list[@level+1] > 0 ?
      (@exp_list[@level+1] - @exp).to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Update Auto State
  #     old_armor : unequipped armor
  #     new_armor : equipped armor
  #--------------------------------------------------------------------------
  def update_auto_state(old_armor, new_armor)
    # Forcefully remove unequipped armor's auto state
    if old_armor != nil and old_armor.auto_state_id != 0
      remove_state(old_armor.auto_state_id, true)
    end
    # Forcefully add unequipped armor's auto state
    if new_armor != nil and new_armor.auto_state_id != 0
      add_state(new_armor.auto_state_id, true)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Fixed Equipment
  #     equip_type : type of equipment
  #--------------------------------------------------------------------------
  def equip_fix?(equip_type)
    case equip_type
    when 0  # Weapon
      return $data_actors[@actor_id].weapon_fix
    when 1  # Shield
      return $data_actors[@actor_id].armor1_fix
    when 2  # Head
      return $data_actors[@actor_id].armor2_fix
    when 3  # Body
      return $data_actors[@actor_id].armor3_fix
    when 4  # Accessory
      return $data_actors[@actor_id].armor4_fix
    when 5  # Accessory
      return $data_actors[@actor_id].armor5_fix
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Change Equipment
  #     equip_type : type of equipment
  #     id    : weapon or armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  def equip(equip_type, id)
    case equip_type
    when 0  # Weapon
      if id == 0 or $game_party.weapon_number(id) > 0
        $game_party.gain_weapon(@weapon_id, 1)
        @weapon_id = id
        $game_party.lose_weapon(id, 1)
      end
    when 1  # Shield
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor1_id], $data_armors[id])
        $game_party.gain_armor(@armor1_id, 1)
        @armor1_id = id
        $game_party.lose_armor(id, 1)
      end
    when 2  # Head
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor2_id], $data_armors[id])
        $game_party.gain_armor(@armor2_id, 1)
        @armor2_id = id
        $game_party.lose_armor(id, 1)
      end
    when 3  # Body
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor3_id], $data_armors[id])
        $game_party.gain_armor(@armor3_id, 1)
        @armor3_id = id
        $game_party.lose_armor(id, 1)
      end
    when 4  # Accessory
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor4_id], $data_armors[id])
        $game_party.gain_armor(@armor4_id, 1)
        @armor4_id = id
        $game_party.lose_armor(id, 1)
      end
    when 5  # Accessory
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor5_id], $data_armors[id])
        $game_party.gain_armor(@armor5_id, 1)
        @armor5_id = id
        $game_party.lose_armor(id, 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if Equippable
  #     item : item
  #--------------------------------------------------------------------------
  def equippable?(item)
    # If weapon
    if item.is_a?(RPG::Weapon)
      # If included among equippable weapons in current class
      if $data_classes[@class_id].weapon_set.include?(item.id)
        return true
      end
    end
    # If armor
    if item.is_a?(RPG::Armor)
      # If included among equippable armor in current class
      if $data_classes[@class_id].armor_set.include?(item.id)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  #--------------------------------------------------------------------------
  # * Change Level
  #     level : new level
  #--------------------------------------------------------------------------
  def level=(level)
    # Check up and down limits
    level = [[level, $data_actors[@actor_id].final_level].min, 1].max
    # Change EXP
    self.exp = @exp_list[level]
  end
  #--------------------------------------------------------------------------
  # * Learn Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end
  #--------------------------------------------------------------------------
  # * Forget Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def forget_skill(skill_id)
    @skills.delete(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Determine if Finished Learning Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_learn?(skill_id)
    return @skills.include?(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    if not skill_learn?(skill_id)
      return false
    end
    return super
  end
  #--------------------------------------------------------------------------
  # * Change Name
  #     name : new name
  #--------------------------------------------------------------------------
  def name=(name)
    @name = name
  end
  #--------------------------------------------------------------------------
  # * Change Class ID
  #     class_id : new class ID
  #--------------------------------------------------------------------------
  def class_id=(class_id)
    if $data_classes[class_id] != nil
      @class_id = class_id
      # Remove items that are no longer equippable
      unless equippable?($data_weapons[@weapon_id])
        equip(0, 0)
      end
      unless equippable?($data_armors[@armor1_id])
        equip(1, 0)
      end
      unless equippable?($data_armors[@armor2_id])
        equip(2, 0)
      end
      unless equippable?($data_armors[@armor3_id])
        equip(3, 0)
      end
      unless equippable?($data_armors[@armor4_id])
        equip(4, 0)
      end
      unless equippable?($data_armors[@armor4_id])
        equip(5, 0)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Change Graphics
  #     character_name : new character file name
  #     character_hue  : new character hue
  #     battler_name   : new battler file name
  #     battler_hue    : new battler hue
  #--------------------------------------------------------------------------
  def set_graphic(character_name, character_hue, battler_name, battler_hue)
    @character_name = character_name
    @character_hue = character_hue
    @battler_name = battler_name
    @battler_hue = battler_hue
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Return after calculating x-coordinate by order of members in party
    if self.index != nil
      return self.index * 160 + 80
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return 464
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Z-Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    # Return after calculating z-coordinate by order of members in party
    if self.index != nil
      return 4 - self.index
    else
      return 0
    end
  end
 
end



EDIT:

I got it to move past that error but now it is not recognizing that the armor kind is now 5 (meaning that it still believes that those armors are accessories rather than the new kind).

This is what it looks like now:

Spoiler: ShowHide
module RPG
  class RPG::Actor
    attr_accessor :armor5_id
  end
end

class Game_Actor < Game_Battler
  attr_accessor :armor5_id
  attr_accessor :armor5_fix
 
  alias setup_armor5_later setup
  def setup(id)
    setup_armor5_later(id)
    @armor5_id = 0
    @armor5_fix = false
  end
end


class Additional_Attributes
  def self.run
    $data_armors[96].kind = 5
    $data_armors[97].kind = 5
    $data_armors[98].kind = 5
  end
end

Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 26, 2008, 03:29:08 pm
Remove the error giving line. The class RGP::Actor doesn't have the armor5_id attribute at all. Even if you add it, it's value is nil. Set it to 0 insteadwhich would mean no rank intiallly. And use the code I gave you above again. It's not RPG::Actor, but RPG::Armor what you need.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 03:54:15 pm
Alright, it worked! But it's still no realizing that armor5_id's kind should be 5 rather than what the database dictates.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: Blizzard on January 26, 2008, 04:03:55 pm
class RPG::Armor
 
  def kind
    return ([96, 97, 98].include?(@id) ? 5 : @kind)
  end
 
end


And remove class Additional_Attributes completely.
Title: Re: Adding an Additional Armor Slot + Additional Stats
Post by: blazinhandle on January 26, 2008, 04:15:22 pm
YOU'RE THE MAN, BLIZZ!!!