A JumpIfInventory

From ECWolf Wiki
Revision as of 18:51, 4 January 2018 by Sigma64 (talk | contribs) (Added an example of how this function can be used.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A_JumpIfInventory (string item, int amount, state frame)

The calling actor jumps to the specified state if the actor is carrying at least amount of the given item.

Example

actor ReloadingPistol : Pistol //A pistol that reloads every 8 shots. uses the "LoadPistol" actor.
{
	states
	{
		Fire:
			PISG A 0 A_JumpIfInventory("PistolFired", 8, "LoadPistol")
			PISG B 3
			PISG C 3 Bright
			PISG D 3 A_GunAttack
			PISG E 3 A_GiveInventory("PistolFired", 1)
			goto ready
		LoadPistol:
			PISG F 3 //Reloading frames
			PISG G 3
			PISG H 3 A_TakeInventory("PistolFired", 8)
			goto ready
	}
}