Game Development Community

Game crashes when i add a playerdata datablock

by Snaggz · in Torque Game Engine Advanced · 05/22/2009 (11:35 am) · 4 replies

datablock PlayerData( GuardPlayer : PlayerBody )
{
maxForwardSpeed = 8;
maxBackwardSpeed = 6;
maxSideSpeed = 8;
};

Every time I add that to my bot.cs file my game crashes. I also made sure i loaded bot.cs after player.cs in my game.cs file.

Any insight on this would be appreciated.

#1
05/22/2009 (1:04 pm)
Is "PlayerBody" a valid datablock?

Does AIPlayer::spawn() know that it is looking for the "GuardPlayer" datablock instead of "DemoPlayer"?
#2
05/22/2009 (3:42 pm)
Now that i look at it i dont see "PlayerBody" defined anywhere. (i used an old resource) Is there a playerdata datablock that i should inherit from when making a simple AI bot guy?
#3
05/22/2009 (10:05 pm)
In the stock scripts, the AI bot "Korc" derives from the player datablock which in the Stronghold/Demo examples is called "PlayerBody", in the T3D/Template projects it is called DefaultPlayerData, in the Forge project it is called LightMaleHumanArmor... so depending on which project you are using will determine the name of the "parent" datablock that the AI will derive/inherit from.

You can inherit from any playerData datablock so long as the "names" match and the "parent" does exist.
#4
05/24/2009 (2:54 pm)
Damn, you know alot. :D

Plugged in DefaultPlayerData in there for the template project and it works fine! Now to get this bot working and stuff.

Thanks