A_JumpIfArmorType

From ZDoom Wiki
Jump to navigation Jump to search

state A_JumpIfArmorType (string "armortype", str "state"[, int minimum])

Note: Jump functions perform differently inside of anonymous functions.

Checks whether the equipped armor in the actor's inventory is of armortype. If so, the jump is performed. Optionally, a minimum value can be given, the jump will then be performed only if the armor is of that type and with at least that amount of points.

Examples

This custom armor bonus can only be picked up if the player has the blue armor equipped.

ACTOR CustomArmorBonus1 : CustomInventory
{
  Inventory.PickupMessage "$GOTARMBONUS"
  States
  {
  Spawn:
    BON2 ABCDCB 6
    Loop
  Pickup:
    TNT1 A 0 A_JumpIfArmorType("BlueArmor", "GiveArmorBonus")
    Fail
  GiveArmorBonus:
    TNT1 A 0 A_GiveInventory("ArmorBonus", 1)
    Stop
  }
}

This armor shard item can only be picked up if the player has the green armor equipped and less than 100 points of armor at the same time.

ACTOR ArmorShard : CustomInventory
{
  Inventory.PickupMessage "Picked up an armor shard."
  States
  {
  Spawn:
    BON2 A 6
    BON2 D 6 Bright
    Loop
  Pickup:
    TNT1 A 0 A_JumpIfArmorType("GreenArmor", "NoPickup", 100)
    TNT1 A 0 A_JumpIfArmorType("GreenArmor", "GiveArmorBonus")
    Fail
  NoPickup:
    TNT1 A 0
    Fail
  GiveArmorBonus:
    TNT1 A 0 A_GiveInventory("ArmorBonus", 1)
    Stop
  }
}