I want to make a property that lasts on multiple scenes

So, I’m making a game on Blender, a niche RPG game inspired of undertale, I’ve made the battle system, the overworld and stuff like that, I have planed to make the save system too, And everything’s fine.

But, here’s the scenario : When in the overworld, a battle is gonna start, the battle is situated on another scene. And when you win the battle, You go back to the overworld scene, and the battle event is no longer here. But how is it possible to add a property that is connected to the battle scene and overworld that is 0 or 1 depending if you win or lose ? I really need help on that, I cannot go further. Otherwise i won’t be able to make that game.

Thanks in advance,
Merrolin.

The way I do that kind of thing is to send a message from one scene and have an object in the other scene receive it. Then, when the message is received it can trigger an actuator to add a value to a property or change it to true or false. Then, another message can check what that value is, or if it’s true or false, and send a message back to confirm or deny an action, in your case a win or a lose.

I’m not sure if this is exactly what you’re asking. If there is a way to have a property transcend all scenes, or connect through scenes directly, I would also be interested to know :slight_smile:

It is very simple to do with Python. For example, in “scene1” on “Cube” you have a property called “prop”. To get this property you can do:

from bge import logic

scene1 = logic.getCurrentScene()    #Get the current scene
scene2 = logic.getSceneList()[logic.getSceneList().index("scene2")]    #Get the other scene

scene1Cube = scene1.objects["Cube"]    #Get an object called Cube in the current scene
prop = scene1Cube["prop"]    #Get its property called prop

scene2Cube  = scene2.objects["Cube"]    #Get Cube from other scene
scene2Cube["prop"] = prop    #Set its property



Hey ! thank you all for your answers !
But, I don’t really know how to import your script in my game Nicholas.
But in any case, i’ll try all your solutions you gave me, Thank you a lot !