Problem with random scene

Hello, my quiz game has a random set of scenes up to 15 random scenes and I want my game to be finished or stop after answering 15 questions and doesnt repeat the same question scene twice… How can I do that? :frowning: Please help… :frowning: Thanks

Somehow this sounds very familiar. I think such a question raised up two time within the last half a year. Nevertheless:

A good way is to use Python (controller).

Create a list with the names of the available scene names.
Shuffle the list (random module).

Before scene switch take the first scene name from the list and remove it from the list too.
Then switch to this scene.

When the list is empty all scenes where shown.

Make sure to store the list in game scope e.g. in globalDict (= can be saved/loaded) or a module.

sample code:

import bge
import random
from bge.logic import getCurrentController

#--- configuration
allSceneNames = [

#--- internal 
storage = bge.logic.globalDict

#--- BGE callable
def createRandomSequence():
    if not allSensorsPositive():
    availableSceneNames = allSceneNames.copy()
    storage[KEY_TO_AVALIABLE_SCENE_NAMES] = availableSceneNames
def setNextScene():
    if not allSensorsPositive():
    availableSceneNames = storage[KEY_TO_AVALIABLE_SCENE_NAMES]
    nextSceneName = availableSceneNames.pop()


def isDone():
    if not allSensorsPositive():
   if not len(storage.get(KEY_TO_AVALIABLE_SCENE_NAMES)):
#--- internal
def allSensorsPositive():
    for sensor in getCurrentController().sensors:
        if not sensor.positive:
            return False    
    return True

def setSceneAndActivateActuator(sceneName):
    for actuator in getCurrentController().actuators:
            actuator.scene = sceneName
            foundActuator = True
        except AttributeError:
def activateAllActuators():
    for actuator in getCurrentController().actuators:

Store this in a file called
On startup (and/or restart) trigger a Python controller in module mode

Always (no pulses) -> Python controller scene.createRandomSequence

on scene switch let the Python controller set up the scene actuator:
Sensor -> Python controller scene.setNextScene -> Scene Actuator (set scene mode)

to check if there is a scene left (before you get an error) you can trigger isDone:

Sensor -> Python controller scene.isDone -> Actuator

It will activate the actuators when there is no further scene left.