Why is my AI model the same as my player model?
by Logan Strunk · in Torque Game Engine · 08/14/2006 (4:35 pm) · 2 replies
I'm using the AIguard from one of the tutorials here on this site.
It works great, but when trying to use a different model for the AI than from the player, it won't work.
Its always the model defined in player.cs, not in aiguard.cs
Below is the code from the aiguard.cs file:
datablock StaticShapeData(AIGuardMarker)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "AIMarker";
// Basic Item properties
shapeFile = "~/data/shapes/Zulu/player.dts"; //I changed this from /player/player.dts
};
....
The rest of it was too large to post.
As you can see, I'm telling it to use /shapes/Zulu/player.dts
But....its not.
What gives?
I don't see anything linking it to the player or something.
I've been messing with this for a few hours, and can't seem to figure it out.
I would really appreciate some help.
Its also not respawning like it should. Any clues on that as well would be great.
It works great, but when trying to use a different model for the AI than from the player, it won't work.
Its always the model defined in player.cs, not in aiguard.cs
Below is the code from the aiguard.cs file:
datablock StaticShapeData(AIGuardMarker)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "AIMarker";
// Basic Item properties
shapeFile = "~/data/shapes/Zulu/player.dts"; //I changed this from /player/player.dts
};
....
The rest of it was too large to post.
As you can see, I'm telling it to use /shapes/Zulu/player.dts
But....its not.
What gives?
I don't see anything linking it to the player or something.
I've been messing with this for a few hours, and can't seem to figure it out.
I would really appreciate some help.
Its also not respawning like it should. Any clues on that as well would be great.
#2
I haven't done inheritance in a few years, since I took OOP programming in class.
I just overlooked it accepting the player data.
Thanks so much.
08/14/2006 (5:04 pm)
I'm an idiot.I haven't done inheritance in a few years, since I took OOP programming in class.
I just overlooked it accepting the player data.
Thanks so much.
Torque Owner Gavin Bunney
The part of the file you are changing is the marker for the guards - their spawn points (i believe). You need to change the PlayerData datablock:
currently it looks somthing like this:
datablock PlayerData(GuardPlayer : PlayerBody) { //The next three variables control the bot's movement speed. //These are set slightly lower than the stock AIPlayer values. //Since I wanted the guards to be more lumbering. maxForwardSpeed = 8; maxBackwardSpeed = 6; maxSideSpeed = 8; shootingDelay = 100; };which doesn't define what shape to use for the guard, it is inherited from the PlayerBody datablock. Simply add a new line the this datablock with the shapeFile you want to use... change it to look something like this:
datablock PlayerData(GuardPlayer : PlayerBody) { //The next three variables control the bot's movement speed. //These are set slightly lower than the stock AIPlayer values. //Since I wanted the guards to be more lumbering. maxForwardSpeed = 8; maxBackwardSpeed = 6; maxSideSpeed = 8; shootingDelay = 100; [b]shapeFile = "~/data/shapes/Zulu/player.dts";[/b] };