Legacy GM How to make a random ui ?



In my game there are some different phase each day like this :
- build phase : can build building, repair, etc
- event phase : many event
- result phase : got ressource and see what was done this day

The event phase could trigger somes differents things, i use irandom_range at the moment
0 : nothing happen
1 : fire in the town !
2 : flood in the town, no food this day !
3 : ennemy atk !
4 : boss atk !
and so on ... (i assume you understood)

at the moment i show nothing at the player but i could show something like "oh because the random you are under ennemy atk !" , but it's after the irandom_range.

Id like, if possible and if you already made it to code a wheel of choice witch is turning and selecting one of the event... a dice is another cool idea, something like a "machine à sous" is fine too.

But how can i do this ? Do you have any idea ?
My idea so far : Create an sprite with 1 frame per event and simply draw it. Then randomly stop it and then the current frame become the irandom_range value ? (to stop it i will irandom_range a number of step and when step = 0 i stop the animation).


i've been curious on doing this too ever seince i started playing Trivia Crack and it's a great idea. I like your idea of setting a timer to count down to see when it should stop and this will work but abruptly because and might not look natural. If you go this rout I suggest making something like this:
/// Event Stage
if Mtime == 0 {
     Mtime = irandom_range(100,110) // Just example numbers
     time = Mtime;
if time > 0 {
     image_speed = (time/Mtime); // This is the important part
(Sorry if i did the code on the Forums wrong still not best at it)

the image_speed par will make a gradient speed going slowly from 1 to 0 as the time descends. You may need to tweek this to your liking but its just a suggestion that will make the game more pleasing to look at.

This is only a suggestion but I hope it helps, another thing you might want to try is instead if just skipping frame to frame try making it slide upward so it looks a bit nicer but that will require a lot more code and effort.

Hope this helps you can always reply if you need more help! o_O


Well you could store these events in ini file then trigger them back.
And I assumed you meant a gameplay replay?
For example this is what would I do:

0: nothing happens --> Let's assume time for enemies to attack is 5 mins.
Store everything you did to bring it back.
array[0, 0]=frstBuilding;
array[0, 1]=x;

array[1, 0]=secBuilding;
array[1, 1]=y;

and etc....

Store them in ini
for(i=0; i<2; i++) {
ini_write_real('loadBack', 'BuildingStage', array[i, i])
Do this for every action I don't know any easier way :D
Last edited:


Your idea should work great, go for it!
You pretty much answered your own question imo.
make sure to use randomize() though!