Game Development Community

Adding a second player

by Jason Pfaff · in Technical Issues · 01/08/2007 (9:55 am) · 2 replies

I have two different characters both with their respected player folders with animations. So I am trying to make it when someone joins the game it will alternate player characters, or make it random, so there are not 10 of the same character running around in the game. I have tried many things none seem to work, any help would be great. Thanks!!

In the folder: "server/game.cs" I've got this code:
// Create the player object
   %player = new Player() {
      dataBlock = PlayerBodyYellow;
      client = %this;
   };

and in "server/player.cs" I've added the new class PlayerBodyYellow:
datablock TSShapeConstructor(PlayerYellowDts)
{
   baseShape = "~/data/shapes/playerYellow/playerYellow.dts";
   sequence0 = "~/data/shapes/playerYellow/playerYellow_root.dsq root";
   ...
   sequence11 = "~/data/shapes/playerYellow/playerYellow_celwave.dsq celwave";
};

datablock PlayerData(PlayerBodyYellow : PlayerBody)
{
   shapeFile = "~/data/shapes/playerYellow/playerYellow.dts";
};

All the new player files are located in the "data/shapes/playerYellow" folder with everything labled correctly in that folder.

EDIT: Here is the error i'm seeing in the console, searching for this doesn't seem to help at all:
Object 'PlayerBodyYellow' is not a member of the 'GameBaseData' data block class
fire/server/game.cs (112): Register object failed for object (null) of class Player.

#1
01/08/2007 (10:14 am)
I think you mean how to switch between player models.

If you search for multiple characters you should find something.
#2
01/08/2007 (10:32 am)
As far as switching player models, I'm going to have (at least for now) the game randomly pick a player model. I just need to figure out how to get this 2nd player model datablock "PlayerBodyYellow" working.