How do I create an AIplayer using existing code in 1.1alpha?
by David Stoesz · in Torque 3D Professional · 12/04/2009 (1:47 am) · 7 replies
It looks like everything is in there to put an aiplayer into the map, but I am not sure how to get one to spawn. Does anyone know how to do this using the basic aiplayer code in 1.1?
I am not concerned with making him do anything yet, but I just want to get one in there..
I am not concerned with making him do anything yet, but I just want to get one in there..
About the author
#2
In gamecore::startgame() at the bottom add
And in gamecore::endgame() add
12/04/2009 (10:58 am)
It's still all controlled by the AImanager method in AIplayer.cs just like good old TGE, though that manager isn't exposed in script anymore.In gamecore::startgame() at the bottom add
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();And in gamecore::endgame() add
.....
// Stop the AIManager
AIManager.delete();// yorks add
// Stop any game timers
cancel($Game::Schedule);
.....
#3
So how do I use the AIManager to create the AI in the game then?
12/04/2009 (4:06 pm)
So Steve, I assume you mean in core/scripts/server/game.cs?So how do I use the AIManager to create the AI in the game then?
#4
Aiplayer.cs is set up to spawn an AI called "Shootme", on a path called "Path1" in a simset called "Paths".
12/04/2009 (4:12 pm)
game/scripts/server/gamecore.csAiplayer.cs is set up to spawn an AI called "Shootme", on a path called "Path1" in a simset called "Paths".
Quote:
%player = AIPlayer::spawnOnPath("Shootme", "MissionGroup/Paths/Path1");
#5
It doesn't exist in gamecore.cs, at least not in 1.1alpha
*edit, I thought I better edit this so I don't confuse people.
You were right, it is right where you said it was. I just missed it some how.
12/04/2009 (4:32 pm)
hmm, the only startgame() and endgame() functions I found were in core/scripts/server/game.csIt doesn't exist in gamecore.cs, at least not in 1.1alpha
*edit, I thought I better edit this so I don't confuse people.
You were right, it is right where you said it was. I just missed it some how.
#6
12/04/2009 (4:48 pm)
That's where it is in New Project - empty project/your mileage may vary.
#7
in gameCore.cs
this excist in server sripts GameCore::startGame
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();
this is for basic Aiplayers.
paths have some conflig in t3d ... use this in level
new SimGroup(Paths) {
canSaveDynamicFields = "1";
new Path(P_Sevildor) { // your pathname etc path1
isLooping = "1";
canSaveDynamicFields = "1";
new Marker() {
seqNum = "1";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
Position = "X Y Z"; //give yours x,y,z
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "2";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
Position = "X Y Z";
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
};
};
working properly and automaticaly spawn the Ai player in 1st marker, give yours x,y,z cordinates for the spawn in 1st marker position and to the 2nd for moving
and use that you say Steve
12/05/2009 (8:58 am)
hiin gameCore.cs
this excist in server sripts GameCore::startGame
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();
this is for basic Aiplayers.
paths have some conflig in t3d ... use this in level
new SimGroup(Paths) {
canSaveDynamicFields = "1";
new Path(P_Sevildor) { // your pathname etc path1
isLooping = "1";
canSaveDynamicFields = "1";
new Marker() {
seqNum = "1";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
Position = "X Y Z"; //give yours x,y,z
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "2";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
Position = "X Y Z";
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
};
};
working properly and automaticaly spawn the Ai player in 1st marker, give yours x,y,z cordinates for the spawn in 1st marker position and to the 2nd for moving
and use that you say Steve
Associate Konrad Kiss
Bitgap Games
%ai = new AIPlayer() { dataBlock = %playerdb; position = %spawnpos; };Make sure %playerdb and %spawnpos have valid values.