Change the scene with shop

Hey all,

I use this string to choose a new random scene :
“scene_” + ToString( 1 + Random(16) )

But i want to add a shop to my game, where you can buy a couple of new scenes.
How can i add these scenes to this string?

Thanks in advance!

I think you need to replace “16” by a HowManyAvailableScenes variable.

Will try that.

But let’s say i offer 10 new scenes in the shop. With this code you could only buy it in order it’s placed in, right? Instead of buying only scene 3 from the 10. That would’nt work, because then it would load the 17th (16+1) scene. Instead of 19 (17+3).

So this would be the string, right?
“scene_” + ToString( 1 + Random(GlobalVariable(HowManyAvailableScenes)) )

Thanks for your answer!

I tried it, in the shop i added +1 to global variable HowManyAvailableScenes.
Changed the string in all the change the scenes. Didn’t work as i wanted it.

So i removed the globalvariable HowManyAvailableScenes, changed the shop events and change to the original string “scene_” + ToString( 1 + Random(16) ) . But now the scene doesn’t change.
Even on a new clean scene i only place the action change the scene with the Original string. But its not working anymore.

What am i doing wrong?

Is this a bug? I have 3 scenes with this string. First nothing was working.
But now the string on the home screen works after i tried to show a hidden object, to be sure it was the string. But it didnt show the object, but the scene does change now on the home screen. And after deleting the action show object it still works. (so it was the same as before)

But the same method doesn’t work in the other 2 scenes.

EDIT 2 :
I copied the action (only the change the scene) to the other 2 scenes and then it worked again. While the string was the exact same. So is this a bug then or?

“scene_” + ToString( 1 + Random(16) ) (from the home scene)
“scene_” + ToString( 1 + Random(16) ) (from the other 2 scenes before i pasted the string from the home scene)

Probably a mistake somewhere in your events. :man_shrugging: