Spawnshere a bit deeper (for me!)
by Chris Sargent · in Torque 3D Professional · 03/06/2010 (2:04 pm) · 2 replies
I was trying to determin how the spawnsphere knows to spawn Gideon when I bring up the empty terrain. I started digging and eventually wound up in game/core/scripts/server/spawn.cs
I saw this part of the code:
I am assuming that player.cs in game/art/datablocks is the player datablock. How does DefaultPlayerData know to load Gideon? Where is this set at?
Thanks
I saw this part of the code:
//----------------------------------------------------------------------------- // What kind of "player" is spawned is either controlled directly by the // SpawnSphere or it defaults back to the values set here. This also controls // which SimGroups to attempt to select the spawn sphere's from by walking down // the list of SpawnGroups till it finds a valid spawn object. //----------------------------------------------------------------------------- $Game::DefaultPlayerClass = "Player"; $Game::DefaultPlayerDataBlock = "DefaultPlayerData"; $Game::DefaultPlayerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints";
I am assuming that player.cs in game/art/datablocks is the player datablock. How does DefaultPlayerData know to load Gideon? Where is this set at?
Thanks
About the author
Associate Steve Acaster
[YorkshireRifles.com]
datablock PlayerData(DefaultPlayerData)
- and it nominates the shapefile.
The idea being that if you want add a new player type or model, you use the primary player datablock (here DefaultPlayerData) as a template so you only input the sections you want to be different from the original.
eg:
datablock PlayerData(CustomPlayer1Data:DefaultPlayerData) { shapeFile = "art/shapes/actors/Gideon/my_new_model.dts"; maxForwardSpeed = 16;//previously 8 }Would give you a new player type that is exactly the same as Gideon except it uses a different model and is twice as fast going forwards ... all unmentioned attributes default to the original "DefaultPlayerData" which is derived from in the second part of the PlayerData datablock name.
Then to spawn as this new playertype, you'd make the change to $Game::DefaultPlayerDataBlock = "customPlayer1Data";