A_CheckAmmo

From DoomWiki.org

A_CheckAmmo(state, amount) is a generic weapon function that is part of the MBF21 specification. It checks the current ammo count of the selected weapon and transitions to a specific state if the count is below a specified amount. It has two parameters, using the values in the "Args1" and "Args2" fields as arguments.

The first argument determines the state to jump to if the current ammo count falls below the value specified in the second argument. If the second argument is set to 0, the function will use the value in the weapon's "ammopershot" field instead.

Example[edit]

The following is an example of how to set the A_CheckAmmo code pointer in a DeHackEd file using BEX syntax:

Frame 1234
Next frame = 1235
Args1 = 1236
Args2 = 10

[CODEPTR]
FRAME 1234 = CheckAmmo

Or using DECOHack syntax:

state 1234
{
TNT1 A 0 A_CheckAmmo(1236, 10)
goto 1235
}

In the example above, A_CheckAmmo transitions to state 1236 if the ammo count for the selected weapon is lower than 10; otherwise it does nothing and the game logic continues on to state 1235, the next regular state in the sequence.

External links[edit]