A CheckForReload: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
m (Italicized "counter" to indicate its variableness.)
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''[[Classes:StateProvider|StateProvider]]'''
'''A_CheckForReload''' (int ''counter'', str ''state''[, bool ''dontincrement''])


{{c|action state '''A_CheckForReload'''(int ''count'', statelabel ''jump'', bool ''dontincrement'' {{=}} false)}}
Jumps to the specified state if the function has not been called ''counter'' times. If ''dontincrement'' is true (default is false), then the reload counter isn't increased by a call to this function. This action is part of a generalized version of Skulltag's [[A_CheckRailReload]] and may not be particularly useful for creating complex reloading systems in weapons. Here's an example from the rail guns fire state using the function.

== Usage ==
Jumps to the specified state if the function has not been called ''counter'' times. This action is part of a generalized version of Skulltag's [[A_CheckRailReload]] and may not be particularly useful for creating complex reloading systems in weapons.

=== Parameters ===
*{{c|int '''count'''}}
:How many times this function should be called for the jump to happen.
*{{c|statelabel '''jump'''}}
:[[StateLabel|Name of the state sequence]] to jump to.
*{{c|bool '''dontincrement'''}}
:If <code>true</code> (default is false), then the reload counter isn't increased by a call to this function.


== Examples ==
== Examples ==
Here's an example from the railgun's Fire state sequence using the function:

Fire:
Fire:
RLGG E 12 [[A_FireRailgun]]
RLGG E 12 [[A_FireRailgun]];
RLGG F 6 A_CheckForReload(4, "Reloaded")
RLGG F 6 A_CheckForReload(4, "Reloaded");
RLGG GHIJK 6
RLGG GHIJK 6;
RLGG L 6 [[A_ResetReloadCounter]]
RLGG L 6 [[A_ResetReloadCounter]];


== See also ==
== See also ==
* [[A_ResetReloadCounter]]
* [[A_ResetReloadCounter]]


[[Category:StateProvider]]
[[category:Decorate Weapon functions]]{{DEFAULTSORT:CheckForReload}}

Latest revision as of 11:12, 19 November 2024

StateProvider

action state A_CheckForReload(int count, statelabel jump, bool dontincrement = false)

Usage

Jumps to the specified state if the function has not been called counter times. This action is part of a generalized version of Skulltag's A_CheckRailReload and may not be particularly useful for creating complex reloading systems in weapons.

Parameters

  • int count
How many times this function should be called for the jump to happen.
  • statelabel jump
Name of the state sequence to jump to.
  • bool dontincrement
If true (default is false), then the reload counter isn't increased by a call to this function.

Examples

Here's an example from the railgun's Fire state sequence using the function:

 Fire:
   RLGG E 12 A_FireRailgun;
   RLGG F 6 A_CheckForReload(4, "Reloaded");
   RLGG GHIJK 6;
   RLGG L 6 A_ResetReloadCounter;

See also