Finding an objects property from another scene???

I’ll start with the code I tried.

cont = GameLogic.getCurrentController()
Font1 = cont.actuators['Font']
Font2 = cont.actuators['Font.001']
player1 = GameLogic.getCurrentScene().objects['OBCube']
player2 = GameLogic.getCurrentScene().objects['OBCube.003']

if player1['health1'] == 0:
elif player2['health2'] == 0:

This did not work because objects Cube and Cube.003 are not in the current scene. They are in a different scene. How do I find them? With getSceneList() prehaps? And when I do find them, will properties health1 and health2 still be the same?

All input’s appreciated. Hopefully someone knows what to do.
Might help. Something like:


This may be closer to what I’m looking for but now I kind of realize that a scene is sort of reset each time it is opened, and so the properties of objects in one scene can not be accessed from another, I think? I think the because when I return to the first scene, both players health are automatically reset to 100.

So how can I trigger an actuator based on which player wins?

Also, when I tried your code, I was faced with the error message:
“list indices must be integers, not str”

So I put in:
player1 = GameLogic.getSceneList()[0].objects[‘OBCube’]
and was faced with:
“CList[key]: “OBCube” key not in list”
Which I think it should be.

You are right, you can only access “living” scenes. If you use “set scene” you kill all active scenes and start a new instance of the choosen scene. That means you can never return to a scene as it is killed, you return to a copy of the scene, which is at it s initial state.

If you use “add background scene” or “add overlay scene” you start a new instance of the choosen scene parallel to the already existing scenes.

From your description I guess you want to “jump” from one scene to another.
If you do that you need to save the scene state before changing to the next one. You can do that by writting all data you want to keep (positions, properties etc.) to another (remaining) object. That would be for example module GameLogic or the dictionary GameLogic.globalDict.
You can access this data from any other running scene.

See the Demo of the SaveLoader.

Thanks. This looks like the answer to my problem, but I need more time to try and understand it. It looks fairly complicated.

I can’t figure out how to use this code at all.