Game Development Community

How do i change the model of my AI bot?

by Snaggz · in Torque Game Engine · 04/24/2006 (2:32 pm) · 9 replies

I ran through a tutorial on AI bots at http://www.codesampler.com/torque.htm ...
I have the standard blue player guy from the tutorial.base game in the examples folder and i was wondering how hard it would be to change the model to my turtle.dts file or a dsq file if i had to. If someone could tell me where to start or point me to a resource or thread that would be great. :)

#1
04/24/2006 (5:00 pm)
Look in "server/scripts/player.cs

It's all in there. :)
#2
04/24/2006 (5:18 pm)
More Specifically: when you open your player.cs file, you should see something like this:

datablock TSShapeConstructor(PlayerDts)
{
baseShape = "~/data/shapes/player/player.dts";
sequence0 = "~/data/shapes/player/player_root.dsq root";
sequence1 = "~/data/shapes/player/player_forward.dsq run";
sequence2 = "~/data/shapes/player/player_back.dsq back";
sequence3 = "~/data/shapes/player/player_side.dsq side";
sequence4 = "~/data/shapes/player/player_fall.dsq fall";
sequence5 = "~/data/shapes/player/player_land.dsq land";
sequence6 = "~/data/shapes/player/player_jump.dsq jump";
sequence7 = "~/data/shapes/player/player_standjump.dsq standjump";
sequence8 = "~/data/shapes/player/player_lookde.dsq look";
sequence9 = "~/data/shapes/player/player_head.dsq head";
sequence10 = "~/data/shapes/player/player_headside.dsq headside";
sequence11 = "~/data/shapes/player/player_celwave.dsq celwave";
};

datablock PlayerData(PlayerShape)
{
renderFirstPerson = false;
shapeFile = "~/data/shapes/player/player.dts";
};

All you should do to change it is change all of the file paths to the model that you want to change it to.

Hope that helps you get it to work!
#3
04/24/2006 (6:15 pm)
Hmm thanks a lot... I got it to work. Is there any way to inherit the player class with the bot but have a different image than the player for the bot? (say i wanted the player to be an orc and the bot to be a turtle)
#4
04/24/2006 (6:40 pm)
Right, that was the one problem i foresaw when i posted my reply - let me ask ben garney or matt langley, I will get back to you asap.
#5
04/24/2006 (6:42 pm)
Cool thanks :)
#6
04/24/2006 (9:06 pm)
The AIbot is subclassed from the player, so instead of changing the player datablock at all, go to your AI players datablock and change the shapefile there. Like in the source you are using:
datablock PlayerData( MyBot : PlayerShape )
{
       shapeFile = "~/data/shapes/turtle/turtle.dts"; //<-- Add this

	// TO DO: Add extra stuff here to manage new A.I. functionality...
	patrol = true;
	attack = false;
};
And I'm pretty sure that should work fine. I suppose you might have to do that TSShapeConstructor stuff for your .dts as well if you're using .dsq.
#7
04/24/2006 (11:35 pm)
Yeah thats what i was trying to do. I was just using the wrong syntax. Thanks everyone. LOL my turtle runs backwards though. You guys know any quick fixes for that? maybe put a rotation string in the bot.cs file?
#8
04/25/2006 (2:32 am)
The best idea would be to fix it in the 3d program you made it in by 180ing it's base transform... I can only tell you how to do that in MAX.
#9
04/25/2006 (11:18 am)
Yeah i just ended up doing a 180 x rotation in milkshape last night it worked out good :) thanks