Game Development Community

Skins relative to player names

by Jonny · in Torque Game Engine · 06/02/2006 (10:39 am) · 0 replies

Hi, im just getting in to c++ and its my first experience of programming so im probably doing somtething very basically wrong here. What i want is for players of certain names to have a certain skin set to their player as they enter the server. Ive looked at lots of different resources including these ones:



Help with setSkinName

Change Items Skin

setSkinName problems

and many others which didnt help me.

and I am using the following code in my rw/server/gametypes/basegame.cs:

//creates a player without a team, always an orc!
function GameConnection::createSinglePlayer(%this, %spawnPoint)
{
   if (%this.player > 0)  {
      // The client should not have a player currently
      // assigned.  Assigning a new one could result in 
      // a player ghost.
      error( "Attempting to create an angus ghost!" );
   }

   // Create the player object
   %player = new Player() 
{
      dataBlock = orc;
      client = %this;
};
  [b]  if(strcmp(%client.nameBase, "Jonny" ))
                                                                   
   %skin = "red";                                        
                                                                   
   else                                                         
     %skin = "base";                               
                                                               
  %player.setSkinName(%skin);   [/b]          


   };
   // default ammo/weapon gift.
   %player.setInventory(Crossbow,1); 
   %player.setInventory(CrossbowAmmo,20);
   %player.use(Crossbow); 

   commandToClient(%this,'SetWeaponMappings',"orc");




   //spawnTestPlayers(%spawnPoint);
   
   MissionCleanup.add(%player);

   // Player setup...
   %player.setTransform(%spawnPoint);
   %player.setEnergyLevel(60);
   //%player.setShapeName(%this.name);
   //%player.setShapeTeam("none");
   

   // Update the camera to start with the player
   %this.camera.setTransform(%player.getEyeTransform());

   // Give the client control of the player
   %this.player = %player;
   %this.setControlObject(%player);
   commandToClient(%this,'SetTeam',"1");




}

Ive put the new added code in Bold so its easy to see.


I know the skin files are named correctly because theres another server that uses them fine. Sorry for posting another topic on this subject but i cant find any that have worked for me and i though it would be better to bring up a new one than to raise up old ones.

Hope some one can help!


Jon