Common Event - Check for Armor "type" currently wearing

● ARCHIVED · READ-ONLY
Started by SaintKrol 5 posts View original ↗
  1. Using RPG VX Ace

    Hey folks!

    I can successfully create a "Common Event" with a Conditional branch, to see if an actor is wearing a certain armor item, such as Common Clothes, or Leather Armor.

    However, I would like to take that a step further, and instead, I'd like to check if the actor is wearing a "type" of armor, such as Heavy Armor, or Light Armor.  I don't see an option in the Conditional Branch for the type of armor, and I would guess I would have to use tab 4, and enter a script command instead.

    Unfortunately, I don't know how to call up a simple script in the branch, to see if the actor is wearing armor that is "Heavy Armor" type.

    Thoughts???

    Thanks in advance.
  2. etype_id tells you whether it's body, head, shield or accessory (the Equip Types listed in the Terms tab, which you can't change unless you use a script).


    atype_id tells you what type of armor it is, from the Armor Types list in the System tab.


    So you'd use something like this:

    Code:
    $game_actors[5].armors[0].atype_id
    to get the armor type (General/Magic/Light/Heavy/etc) of the first piece of armor (the shield) for Actor 5.
  3. Thank you Shaz!  This shall work splendidly. 

    Have a Nintendo cake, on me, as your reward.

    http://imgur.com/M3rcq
  4. Shaz, that method is slightly unpredictable due to it using select; it might result in an error if the armor list is empty and, Game_Actor#armors doesn't return all armor slots, so armors[0] could be the accessory if nothing else is equipped.

    I would recommend using:

    # Get any actor ever:$game_actors[0].equips[slot_id].atype_id rescue -1# Any of the 4 active party members:$game_party.battle_members[index].equips[slot_id].atype_id rescue -1# or all members of the entire party:$game_party.members[index].equips[slot_id].etype_id rescue -1Where slot_id is:0 - Weapon

    1 - Shield or Weapon (Dual Wield)

    2 - Helmet

    3 - Body

    4 - Accessory

    This will ensure no errors, and will also return -1 for any non-existing item, or item that is not an armor.

    $game_actors[0].equips[3].atype_id rescue -1 will return the bodyarmor's atype_id or -1 if there isn't one equipped.

    $game_actors[0].equips[2].atype_id rescue -1 will return the helmet's atype_id or -1 if not equipped.
  5. Thank you :) I'm a bit light-on when it comes to equips.