Count the pulses of a held spell correctly, even after a long hitch
A channelled beam pulses every half second, and walking away should end it. When the game stutters, pulses are skipped or doubled, and the pulse that happened just before the player moved gets lost. This entry gives exact counts however the frames fall.
Why this works
The truth is the clock, not the number of frames. Working out how many pulses are due from the start gives the same answer however the frames fall, so a stutter delays the pulses but never loses them.
When not to use it
Skip it when the effect is truly continuous, such as a beam that damages a little every frame, or when pulses should be lost on purpose to punish a weak computer. Then use damage per second directly.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 26 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Count the pulses of a held spell correctly, even after a long hitch" (read_entry channel-spell-ticks-after-lag-spike) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP