RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Display Issues

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
Menu & Battle System Guru
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 for:
Code: [Select]
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

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

Thanks

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
hmm...

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

***
Rep:
Level 88
Menu & Battle System Guru
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:
Code: [Select]
if $game_switches[55]==true and ($game_party.actors[@active_battler].armor4_id >=86

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

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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

Code: [Select]
@active_battler.armor4_id


instead of

Code: [Select]
$game_party.actors[@active_battler].armor4_id

***
Rep:
Level 88
Menu & Battle System Guru
I figured it out mate. I used
Code: [Select]
$game_actors[@actor.id].armor4_id >= 86
and it worked fine :)

Thanks MA!