How to generate a random scene? I have 10 scenes total

I would like to generate a random scene? I have 10 scenes total. How can I do this?

You can go for the easy way: Rename the scenes as RandomScene_1, RandomScene_2, … , RandomScene_10.
Then, as you know, when switching to another scene you need its name, generate it randomly this way:
“RandomScene_” + ToString( 1 + Random(9) )

I guess the easiest way is what Lizard said. But in case you want to preserve the scene names, maybe you can do this

If variable randomnumber = 1
Text of variable Randomname = scene1

If variable randomnumber = 2
Text of variable Randomname = scene2
Do =random(9) + 1 to variable randomnumber
Change scene variablestring(randomname)

Cool, that is what I ended up doing. A pain to make 10 separate scenes but at least it is set up to not get the same game two in a row :slight_smile:

Finished product :smiley:

thepapercomet.com.au/Games/E … index.html

hi lizard, i want to make random scene and following your instruction. but its not working…haha
can you please tell me where i did wrong.

Hi,

this is old post but still is needed.

This instruction is clear and works.
But later I don’t want to load again same scene.
In this random setup scene will be loaded couple times.

How to fix to load scenes only one times?

Thank you.

Hello!

Please don’t bump multi year old posts. Especially since the authors may no longer be on the forum, and this thread is actually for GDevelop 4.

As your request is different than the original post as well as any of the updates, please make a new thread including your current events for selecting a random scene, and what you’d like to attempt.

Thank you!