How to save properties from a scene to another?

Hi there! I recently started to work agin on my experimental RPG
( http://blenderartists.org/forum/showthread.php?t=161079&highlight=stelligrid )

And i’ve come to be stuck with a quite complex thing. Here’s a statement of the situation:

The game is splitted in two with successives phases of exploration and battle. When a battle occurs, it happens in a different screen, then, once the battle is over, the player comes back to the field exploration.

What I’ve done:
When the surrounding box of my character is in collision with an ennemy, I set the battle scene, using an overlay scene for “hiding” the change.
In so doing, I’ve also manage to save the position/orientation of the player thanks to a script I found on the internet.
With properties and logic bricks, I’ve managed to accomplish the cycle Fiel->transition(white fade)-> battle scene-> victory screen(another transition with an overlay scene)-> return to field.

When “Character” is in collision with “Enemy”, it:

  • saves Character’sposition
    -add a background scene: Battle Scene
    -add an overlay scene: White Fade
  • this overlay scene “remove the Field Scene”
    and the same goes forth for the end of battle, victory screen and return to Field.

And now, here’s my problem:
For now, once the cycle is done, and I have come back to my Field scene. Then I load the Character’s position (with a simple keyboard command for debug). It works fine, but it loads the character at the same position where it was when saved (logical :slight_smile: ) . But this position is already in collision with the enemy object.
So, as soon as I have loaded, it opens a new battle.

I guess I need some hint on how I could resolve such a problem. I tried to relocate the enemy object beyond collision possibilites, or add an actuator “End object” on it when it collides with the Character object. It didn’t work, since when the scene is added, it begins with all its properties by default.

I’m thining about it a lot, but I don’t even have an idea on how I could resolve my problem…
Sorry for the big post, and thanks in advance for those that have been courageous enough for reading it all :slight_smile:

i dont understand your problem . do you want the enemy to disapear from the first scene when you kill him in the battle scene?

Hi! sorry if I have difficulties to clearly expose my problem.
Yes, you perfectly resumed in a short sentence what I tried to explain with an ultra big post.

hehe , I write shot sentences because i dont know english. I will try to make a simple blend to show you a way to do that.

OK thanks i’ll wait your answer.
Is python needed for these kind of thing?

Yes I think python is needed. You can save your properties to the global dictionary. Altho I have not used it yet, i’m pretty sure thats what it is used for. Heres a link:

http://www.blender.org/documentation/249PythonDoc/GE/index.html

The global dictionary is GameLogic.globalDict, its at the very bottom of the page.

Imogia , i am still trying to figure out the simplest way to do this. I will upload a blend tonight.

Sure, no problem. I’ll check the boards tomorrow anyway :slight_smile:

this is what i made http://www.pasteall.org/blend/993
let me know if there are any problems

Hi Josip, thanks a lot for the .blend. it works well and this is exactly what I wanted, thanks, thanks.

I tried by myself starting from zero, and it works :smiley:
Now that I’m thinking of doing it “for real” in my game, I wonder if it is possible to make an animation play with python?

I am now thinking of going further in my battle system with python. I’ll try to find myself how to play animations with python. If you don’t mind, i’ll post my result here so you may help?

np , post your blend here or send it to me by email if you want to keep it private. i will try to help

Hi^^ istarted messing around with the script :smiley:
Well I just added different battle scenes, playing with properties, and I’ve come to be stuck:

There are five scenes:
1 FIELD and 4 BATTLES

    When an ennemy is killed, it turns his iwn prop DEATH to TRUE
            When all the props DEATH are TRUE, this switch the property VICTORY (on empty) to TRUE
            
            Prop VICTORY is TRUE + Keyboard Enter switch back to field.
            
            When starting the game from BATTLE04, it works.
            When starting the game from FIELD, it dont work... 
            
            ?_? How come ?_?

This is very strange. I tried with different configuration of puls triggering (although I really don’t know how these things works), but no result…
My purpose is to define victory conditions that allow to switch back to scene Field only if the victory prop is True…

Here’s the blend, some textures may be missing, it doesn’t matter:
http://www.pasteall.org/blend/1002

do you mind if I change a lot of things in your blend file ?
Edit:
here is what i made http://www.pasteall.org/blend/1016 . I deleted the character mesh and unpacked a few textures to make the file smaller.

Oh man, that’s totally awesome! This works perfectly well.
Thank you so much!
Wow I figure that I have a lot to improve in order to optimize my game making.
Sorry for the extra work you had to do, removing stuff in the scene for keeping it light. I’ll try to keep my scenes light from now on.

I’ll start integrate these things in my game in the week to come, so I should be able to publish a first release before the end of the week, I’ll keep you informed!

Thanks again, stay tuned!