Main Menu
  • Welcome to The RPG Maker Resource Kit.

Display Issues

Started by blazinhandle, December 05, 2007, 11:29:09 PM

0 Members and 1 Guest are viewing this topic.

blazinhandle

I'm trying to perform a check that confirms if a player has an armor equipped and if they do, then a text is displayed. However, no matter how I go about it, I cannot quite get it to work.

This is a modified version of Blizz's SR/SL
[spoiler]class Window_Battle_Command < Window_Selectable
 
  attr_accessor :commands
  attr_accessor :actor

  alias initialize_oss_later initialize
  def initialize(width, commands)
    initialize_oss_later(width, commands)
    @AOcommand = "AuroraOre"
  end
 
  def swap_commands_3
    if $game_switches[55]==true & (@actor.armor4_id >= 86)
      temp = @commands[2]
      @commands[2] = @AOcommand
      @AOcommand = temp
      refresh
    end
  end

  alias refresh_oss_later refresh
  def refresh
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 20
    if ALLOW_AURA and @commands[2] == "AuroraOre"
      for j in 0...6
        self.contents.clear
        self.contents.font.color = AURA_COLOR
        rect = Rect.new(29, 31*index, 120, 30)
        self.contents.draw_text(rect, @commands[2])
        self.contents.font.color = normal_color
        for i in 0...@item_max
          unless @commands[i] == "AuroraOre"
            draw_item(i, normal_color)
          end
        end
        Graphics.update
      end
    else
      refresh_oss_later
      if $scene.is_a?(Scene_Battle)
        if ALLOW_AURA
          if $game_switches[55]==true and ($game_party.actors[@active_battler].armor4_id >=86 # <---- PROBLEM
            self.contents.font.size += 4
            self.contents.font.color = normal_color
            self.contents.draw_text(45, 60, 128, 28, "›› ", 2)
            self.contents.font.size -= 4
          end
        end
      end
    end
  end
end
[/spoiler]

I've tried using $game_actor[id] and a ton of other variations but constantly get NoMethodErrors for "armor4_id" and actor, etc.

Thanks

modern algebra

hmm...

$game_actors[id].armor1_id ought to work. Can I see where the error is appearing?

blazinhandle

The problem is in this line (when it does the check to see if both the switch is on AND the current battler has an armor4_id of 86 or higher equipped: if $game_switches[55]==true and ($game_party.actors[@active_battler].armor4_id >=86

And I tried $game_actors[id].armor4_id only to get the NoMethodError undefined method for armor4_id

modern algebra

what's the ID that you put into $game_actors ? The first line doesn't work because @active_battler is not an integer.

I'm not sure if Blizz changes this in SR, but try


@active_battler.armor4_id


instead of


$game_party.actors[@active_battler].armor4_id

blazinhandle

I figured it out mate. I used $game_actors[@actor.id].armor4_id >= 86 and it worked fine :)

Thanks MA!