Choose your character setup

Hello again… I am back with another question about the racing game i am creating. I would like to create a system where the player can choose from a variety of different vehicles before actually playing the game. Once they choose there car the level should spawn in the car they chose. It would be ideal if the “choose character” and “level 1” sections could be different blend files. if not that’s fine to. Currently all the car physics are on an invisible separate object(called Character) and the car body is just parented to the object(Character).


Here is an image explaining what I generally want to happen. If I’m not clear tell me.

I’m sure a script could do this but maybe there is a simpler approach.

Idea away.
thanks!

Edit:
Thanks again for the amazing support I got on the last thread!

Have all three vehicles in a hidden layer and add only the one the player chose.
To separate the choosing from the level blend you can use messages, which survive the one frame transition (I think).

ok. But how do i send a message from one blend file and access the message in another?

Edit:
this is my first time working in multiple files for one game. If you have tutorials to link i would appreciate it.

Exist some tutorial about it ?
I never find one about …

How does working across blend files in the game engine work in general. Does anybody know?

How do i Send and receive things like messages, numbers, ect???

You use libload to load blends into blends ingame, you can find an example in my sig (loading screen)

thank you!

I will try this and see if i can get it to work.

here is a little demo of the libload feature.

  • lib.blend contains the assets, and needs to be saved with an empty layer only (to make addObject work).
  • gui.blend is the main menu and character select.
  • level.blend is the level

run Launch.blend to start the game. this can be packaged into an exe as well.

Attachments

demo.zip (379 KB)

Yes! thank you.
This is awesome. It is what i am trying to achieve. Very helpful.
I may be able to upload some game play demos once i get this setup working!

thanks again

I would use the global dictionary to save which selection is picked initially, then read the property value for when the car type needs to be set.

Such as when you select the car, it saves the property via python:

bge.logic.globalDict["CarSelection"]=1
bge.logic.saveGlobalDict()

Then after a level loads, python loads the variable from the global dict, and replaces a game property with that data:


cont = bge.logic.getCurrentController()
owner = cont.owner
bge.logic.loadGlobalDict()
owner['PropertyName']=bge.logic.globalDict["CarSelection"]

Finally, with either python or logic bricks you can set the model of the car based on the value of that property. The car choices can be stored in different layers, or in external blender files.

I can provide an example of how to do this with either logic bricks or python if you are having trouble.