1. Never copypaste another person's code into a main project until you understand every line of code you are pasting.
1.1. If you ever see an A_Jump/Check with a number instead of a named state, never
take anything for granted that it would work as planned, without double-checking where everything jumps to.
2. Do a string search for A_Jump and A_Check and check all
3A. If you set an A_Jump/Check call on a non-zero length frame and it does in fact jump, the jump occurs before
the length of the frame such that you do not see the calling frame at all.
3B. Always, always check jumps to and from "ready", "spawn", "see" or other frequently defaulted-to states to make sure that you never end up in a zero-length loop.
Greenmarine's suggestion crashes because of 3A and 3B.
Here's my version, which moves the A_Jump/Ready call to after
the AB frames have finished playing:
- Code: Select all • Expand view
TNT1 A 0 A_JumpIfInventory("grenadepickup", 1, "GrenadeReallyThrow")
GRWU AB 3 //play these frames and cancel attack, if there are no more grenades left
TNT1 A 0 A_TakeInventory("GrenadeThrowFlagOrWhateverYouNamedIt",999999) //EDIT: gotta remove this or you're stuck in a loop, zero or otherwise
TNT1 A 0 A_Jump(256,"Ready")
GREN ABC 3 // continue attack