GetArmorType

From ZDoom Wiki

Jump to: navigation, search

int GetArmorType (string armortype, int playernum)

Returns true if the player's armor type matches the first parameter.

Parameters

This function targets only players. It concerns only BasicArmor and therefore does not cover HexenArmor.

Return value

The return value is the number of armor points if the player wears the designated armor, 0 otherwise.

Examples

This script constantly informs the first player which kind of Doom armor he is wearing.

script 1 ENTER
{
  while (1)
  {
    delay(35);
    if (GetArmorType("None", 0))
      HudMessage(s:"You are unarmored.";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
    else if (GetArmorType("ArmorBonus", 0))
      HudMessage(s:"You are unarmored but have found armor bonuses";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
    else if (GetArmorType("GreenArmor", 0))
      HudMessage(s:"You have a security armor";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
    else if (GetArmorType("BlueArmor", 0))
      HudMessage(s:"You have a combat armor";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
    else if (GetArmorType("BlueArmorForMegasphere", 0))
      HudMessage(s:"You have a megasphere";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
    else HudMessage(s:"What the hell are you wearing?";
      HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
  }
}
Personal tools
Namespaces
Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox