# A way to create a variable that includes a modifier that should be checked every step [Gamemaker]

I can't tell if I am being stupid, but I am looking for a way in Gamemaker to have a variable include a modifier which has the potential to change every step.

This variable is called mTiredness, and I would like it to include the TimeOfDayModifier which needs to be checked frequently.

However, I obviously can't put

mTiredness = mTiredness + TimeOfDayModifier

in a Step event, as this would add the modifier, in my case, 60 times a second, which I do not want!

Instead, I want a consistent variable comprised of the base amount and the modifier, while allowing that modifier to change.

Can anybody help me? I cannot think of an easy way to do this.

Make a script. It's a function actually, so you can make it return the sum you desire. That way you don't affect the mTiredness value. You will only need to have global access to those variables or either pass them as arguments/parameters.
• Right, so I just use the return function in that script, and then place the script in a step event? I knew there was a simple way to do this, thanks! – Bonfire Dog Jul 4 '16 at 12:06