Game Development Community

Different enemy models?

by Snowhill06 · in Torque Game Engine Advanced · 06/11/2007 (7:46 pm) · 3 replies

How do you make it so that you can have more than one type of player model for enemys. I have found tutorials on this site on how to do enemy AI but they do not say how to have it so that the ai characters are a different model than the players model. I also know how to change the player model but not the enemy model.For instance I made an AI character in my game for the player to fight.But the AI character is the same model as the player so its like your fighting yourself! Does anyone know how to do this or tell me were some tutorials are on how to?

#1
06/11/2007 (8:27 pm)
You're going to need to create datablocks for these new enemy characters. If you make a copy of player.cs and change all the references of "Player" to "enemy" or something similar, you should have another player object you can make your AI bots take over.

For instance, the PlayerData datablock is the datablock you would change to point to your new model.
#2
06/11/2007 (8:45 pm)
So do I add another datablock under the default one in the player cs? Here is an example of what I am asking about.

{
baseShape = "./player.dts";
baseShape = "./player.dts";
};

{
baseShape = "./enemy.dts";
};

or do i just make a different player cs and name it something like enemy cs and in the enemy.cs file do I leave /player.dts as player.dts or do I change it to enemymodel.dts?

Could someone maby post a quick example file or code? I would really appreciate it so I can use it as a template to help make my enemy characters.
#3
08/31/2007 (5:11 pm)
Open aiPlayer.cs. In the DemoPlayer datablock, add the line

shapeFile = "~/data/shapes/player/enemy.dts";

In the /data/shapes/player folder, you will have to make a copy of player.cs called enemy.cs, and change the baseShape in enemy.cs to ./enemy.dts. This will make sure all the animations are loaded properly for both models.


The DemoPlayer datablock is used (by default) for AI players. If you want to have several enemies that look different, then make a copy of the DemoPlayer datablock, but change the name to DemoPlayer2 or something. Set shapeFile to the name of the other dts. You might want to look at my ai spawning resource.