Hello,
I think that you should look the Timer behavior https://www.scirra.com/manual/167/timer
Use a timer to trigger regeneration and stop the timer when you consume stamina.
Tell us if you need help with timers <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">