Difference between revisions of "A JumpIfInventory"
From ECWolf Wiki
(Created page with "'''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 ...") |
(Added an example of how this function can be used.) |
||
| Line 2: | Line 2: | ||
The calling actor jumps to the specified state if the actor is carrying at least ''amount'' of the given item. | The calling actor jumps to the specified state if the actor is carrying at least ''amount'' of the given item. | ||
| + | |||
| + | ==Example== | ||
| + | <pre> | ||
| + | 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 | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
Latest revision as of 18:51, 4 January 2018
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
}
}