Okay, I’ll see what I can do to answer your questions.
You didn’t give all of the information needed in your question about the scenes. Most people will not realize that each “Try Again” scene only links to one level (for example, the “try again” button in “TryAgain1” only restarts level 1, and not level 2 or 3 or etc.).
To answer your question, anyway, you need to find a way of letting the “Try Again” scene know which level the player is on, then dynamically change the scene pointed to with the “Scene >> Add Scene” or whichever Actuator your using. The easiest way to do this is with Python. I’m going to assume that you’ve never used a Python script with in the Blender Game Engine before (though I know that may not be the case), so I will explain all of the steps.
First, you need to set a global variable to keep track of what level the player is currently on. Global vairiables are values that are accessible to any object from any point in the game. They are created by assigning variables to the GameLogic module with a Python script. I like to put the Logic Bricks to trigger this sort of script on the main camera, but you can put it where ever you like.
Select the object where you’ll be putting the logic, and press F4 over the buttons window to bring up the Logic buttons panel. Click the “Add Property” button and add a new “String” type property named “levelName”. Type the name of the scene that the level is in into the value field (the scene name is case sensitive, so make sure you type it exactly as it appears in the scene selection menu). Now add the following logic bricks:
Always --> Python
The script does not need to run every frame (which is what an Always sensor does by default), so turn off the “TRUE level triggering (pulse mode)” button. This will stop the pulsing behavior of the Always, causing it to run once and never again (I call this a “Once” sensor, and I usually name a sensor like that “Initialize,” since it is good for triggering all of the settings that must be initialized when a game or level begins). Now all that’s left is to copy the value of the object’s “levelName” property to the global variable “GameLogic.currentLevel.” You’ll need to write a quick script to do this.
Open a Text Editor window in Blender. (If you don’t know about Blender’s window system, I highly suggest you read the manual, especially the sections about the window system and window types.) In the Text Editor, click the arrows between the “AB” button and the “Screen 12” drop-down list. Choose “ADD NEW” from the menu that pops up to add a new text buffer (you’ll type your Python script here). Click the new bar that will say something like “Text.001” in it to rename your script. Name it something like “SetLevel.py” Type this script in the Text Editor:
cont = GameLogic.getCurrentController()
own = cont.getOwner()
GameLogic.currentLevel = own.levelName
That’s all the code you need to copy the value. Now go back to the object’s Logic Bricks and type the name “SetLevel.py” in the “Script:” field of the Python controller. In case you’re wondering what the script means, “GameLogic.getCurrentController()” is referring to the Python controller Logic Brick that called the script. We’re calling that “cont” in our script. “cont.getOwner()” is referring to the object that owns the Python controller, and “own.levelName” is referring to the “levelName” property assigned to that object. Variables do not need to be declared ahead of time in Python, so even if “GameLogic.currentLevel” does not yet exist, it will be created the first time we assign a value to it.
Now go to each level and add in the same Logic Bricks and the “levelName” property, set to the correct scene. The only task remaining is to set the “TryAgain” scene to read the “GameLogic.currentLevel” variable and set the scene accordingly.
There are a few different ways to go about making the scene transitions in this case, but I’m going to assume that when the player fails to accomplish the level’s goal, you use “Scene >> Add Overlay” to add the “TryAgain” scene, and then you use “Scene >> Remove” to remove the level. Also, I will assume that you are using a plane with the text “Try Again” as a button that triggers the level’s reloading when it is clicked. Based on those assumptions, set up the Logic on the button like this:
Mouse: Left Click —
Mouse: Over ---------------> Python: TryAgain.py -----> Scene: Add Overlay
----- Scene: Remove
Name the two Mouse Sensors “LeftClick” and “OverMe” respectively, and name the Scene Actuators “AddLevel” and “RemoveMe”. You won’t be able to type a Script value into the Python controller until you’ve created a new text buffer with the same name. The “TryAgain.py” script should look like this:
cont = GameLogic.getCurrentController()
leftClick = cont.getSensor("LeftClick")
mouseOver = cont.getSensor("OverMe")
levelAdder = cont.getActuator("AddLevel")
removeMe = cont.getActuator("RemoveMe")
if leftClick.isPositive() and mouseOver.isPositive():
If all is well, your “TryAgain” scene should now work for restarting the current level.
A couple of Python pointers: Python is case sensitive, so “removeMe” is not the same as “ReMoVeMe” or “removeme”. Whitespace matters in Python, so make sure you indent every line that is part of an “if” block, just as I did in the script above.
(This is a long post, so instead of accidentally exceeding the max length, I’m going to post a second time with the answers to your other, much simpler questions.)