Help me get rid of my Event Tick Addiction!

As far as checks inside the tick function, use them as sparingly as possible. As the gentleman above pointed out only perform checks when you need to check them.

In the stamina example, you have a variable that is constantly changing over the lifetime of the character. This leads to the idea that it’s best to perform routine checks on it as its being adjusted at regular intervals. And so is a good candidate for the tick function. You’re only other option would be setting a timer and calling an event or function at regular intervals. This has no advantage, as you’re just implementing your own tick method using a timer, so you’re complicating your code unnecessarily. A simple check is very low cost in the long run.

A good candidate for something outside the tick function might be a check to see of your character should die. This only happens whenever damage is applied and not at regular intervals. When damage is applied, perform the check, and respond accordingly. This is a good situation for ‘event’ checks that only occur when a specific ‘event’ has happened.

Basically if you have a variable that is updating at regular intervals then that is the reason for the tick function and it is generally best to handle it there. If you have checks that only need to be done when a certain kind of ‘event’ happens then perform your check during the ‘event’ and not during the tick event.