I have a few question what is the logic in getting 2 ,3 or 4 times. is it random or is it based on condition of the result of your game.
And right you you can do function such as on end of layout do function
and then repeat (callback variable)
do what you want to do.
Or you can use Timer here
on end of layout. choose 2,3,4 for a global variable
Start timer
and do during timer do the action
When timer expire substract one
if compare two value
First value is global variable is equal 2nd value (0) end the game
else start timer.
This should work if it doesnt then i do not know how you are running your game.