Game Development Community

Swapping Players Mid-Game????

by Michael Welch · in Technical Issues · 04/03/2008 (2:51 pm) · 2 replies

I am trying to switch the player.dts (and subsequent info and control) to another mid-game. This is what I've done so far....

I have set up an object so that when you pick it up and use it a pop-up dialog asks you if you would like to change into a disguise (switch player.dts). I have used the health kit for the disguise item to be picked up.

Someone recommended that there are two ways to go about this.

The first - detach the camera, remove the old player, create the new player, and then reattach the client to the player.

The second - is to reassign the player to a new datablock.

I am struggling to understand how to go about changing the player datablock in mid-game. This was the method I had originally thought to use(or something similar). I am using the orc folder (~/data/shapes/player/player.dts) for the initial player, and have moved the tge_elf folder from the demo over to the starter.fps folder that I am using to test with.

Is there a way to have two playerdata datablocks within the same player.cs file? If there is, how would I switch between the two?

Any ideas you have would be very helpful....
Thanks in advance for all the help!!

Mike

#1
04/03/2008 (5:51 pm)
You want to make a default player datablock and have the different objects inherit everything from the default except for the shape. Each child datablock can have different properties for movement, allowed items, etc.

datablock PlayerData(DefaultBody)
{
    renderFirstPerson = true;
    emap = true;
    className = Armor;
    shapeFile = "~/data/shapes/player/blue/player.dts";
    ...( omitted datablock properties )...
}

datablock PlayerData(OrcPlayer : DefaultBody)
{
	shapeFile = "~/data/shapes/player/orc/player.dts";
};

datablock PlayerData(ElfPlayer : DefaultBody)
{
	shapeFile = "~/data/shapes/player/elf/elf.dts";
};

These are just examples, actual shapeFiles and nomenclature would be project dependent.
#2
04/04/2008 (5:25 am)
Thanks for the reply.

This is the direction I am heading. I have two seperate datablocks for the unique players. What I can't seem to figure out now is how to get the switch to execute from the command line of a GUI Button. I need help figuring out how to tell the game to switch the datablocks and where to put the code (if needed) so that I can call it from the command line of the button.