so far, the only way I can think of to load levels stored on different blend files is to use the “game actuator, start new game” and the fairly major problem I see with this is, it would also delete everything in the level you were playing, including the player. so all the levels would have to have a different player object, which means anything you gained in one level would be lost in the next. so basically, what I need is a way to append something into the game, real time. any ideas?
I don’t know much about using multiple .blend files in a game. But you could just try using different scenes for levels and link the player to all of the scenes.
ok, I willl try that.
Another way to do it is to have your separate game files, and when one level is ‘ended’ save all the propertys like health, money, weapon ammo etc, and save it all into some file.
Then when the new level has loaded get that level to load all the propertys and data from the file, and assign it to the character etc.
Thats the best way to do it the way u want.
Theres also a very good (and much more simple) Save-Load demo around somewhere. Cant find it at the moment.
The new blender has a Portal function but i’m not sure how it works:(
Blender now has a globalDict that can be used. As the name suggests, it is a global dictionary. You’ll need to use python to use it though. If all the player stats were properties of the player object, and this script was attached to the player object:
own = GameLogic.getCurrentController().getOwner() d = GameLogic.globalDict d[health] = own.health d[money] = own.money d[level] = own.level #--You could also store a list as the value... d[items] = [own.item1, own.item2, own.item3]
That should write stuff to the globalDict.
Now, if you notice in the Game Actuator, there are two new options: “Load GameLogic.globalDict” and “Save GameLogic.globalDict”.
If you use “Save GameLogic.globalDict” and then load a new blend file through the Game Actuator, the next blend file can use “Load GameLogic.globalDict”. Now, you have all of your stats. Setting the stats on the player object can now be done in a very similar fashion to the earlier script:
own = GameLogic.getCurrentController().getOwner() d = GameLogic.globalDict own.health = d[health] own.money = d[money] own.level = d[level] #--And the list again own.item1, own.item2, own.item3 = d[items]
Now, I haven’t tested any of this, but I think it should work.