Adding AI Players
by Germain Bataille · in Torque Game Engine · 05/23/2005 (3:48 pm) · 9 replies
Hi,
I would like to add some other AI players (with the same AI but starting elsewhere). I thought about adding :
%player2 = AIPlayer::spawnOnPath("Martin","MissionGroup/Paths/Path2");
%player2.followPath("MissionGroup/Paths/Path2",-1);
in aiplayer.cs but that's not working... Is there a simple way to do this....? Where I should declare the %player2 variable?
Thanks
I would like to add some other AI players (with the same AI but starting elsewhere). I thought about adding :
%player2 = AIPlayer::spawnOnPath("Martin","MissionGroup/Paths/Path2");
%player2.followPath("MissionGroup/Paths/Path2",-1);
in aiplayer.cs but that's not working... Is there a simple way to do this....? Where I should declare the %player2 variable?
Thanks
About the author
#2
Do you tried this resource?
05/23/2005 (6:10 pm)
Thanks for the resource but I folowed all instruction, I add the AIGuard unit and save the mission but when it loads back the guard is not there :( Do you tried this resource?
#3
What exactly is not working ? the bot doesn't appear ? it doesn't follow the path ?
Has the %player2 variable any value other than 0 ?
05/23/2005 (7:28 pm)
@GermainWhat exactly is not working ? the bot doesn't appear ? it doesn't follow the path ?
Has the %player2 variable any value other than 0 ?
#4
05/24/2005 (11:13 am)
The bot doesn't appear at all... :(
#5
Are there console errors? Did the script not compile? Did you delete the .dso files from server/scripts ?
05/24/2005 (11:17 am)
The AIGuard resourfce worked great for me. Are you calling loadentities() ?Are there console errors? Did the script not compile? Did you delete the .dso files from server/scripts ?
#6
Compiling starter.fps/server/scripts/aiGuard.cs...
Loading compiled script starter.fps/server/scripts/aiGuard.cs.
Validation required for shape: starter.fps/data/shapes/player/player.dts
*** LOADING MISSION: starter.fps/data/missions/stronghold.mis
...
*** Mission loaded
starter.fps/server/scripts/aiPlayer.cs (248): Unknown command followPath.
Object CrossbowSubExplosion1(50) CrossbowSubExplosion1->explosionData-> GameBaseData->SimDataBloc->SimObject
------------------------------------------------AIGuard LoadEntities
Guard entities disabled...
Hiding Guard markers..
So I can add a AIGuardMarker and I see it in the editor... I save the mission and when it loads back there is no guard at all...
Germ
05/24/2005 (12:10 pm)
Yes I call loadEntities... Here the error I get in the log :Compiling starter.fps/server/scripts/aiGuard.cs...
Loading compiled script starter.fps/server/scripts/aiGuard.cs.
Validation required for shape: starter.fps/data/shapes/player/player.dts
*** LOADING MISSION: starter.fps/data/missions/stronghold.mis
...
*** Mission loaded
starter.fps/server/scripts/aiPlayer.cs (248): Unknown command followPath.
Object CrossbowSubExplosion1(50) CrossbowSubExplosion1->explosionData-> GameBaseData->SimDataBloc->SimObject
------------------------------------------------AIGuard LoadEntities
Guard entities disabled...
Hiding Guard markers..
So I can add a AIGuardMarker and I see it in the editor... I save the mission and when it loads back there is no guard at all...
Germ
#7
you dont have them enabled... there is a flag in AIGuard.cs that sets them to be enabled. By default it is turned off. Enable the guards...
05/25/2005 (3:59 am)
Guard entities disabled...you dont have them enabled... there is a flag in AIGuard.cs that sets them to be enabled. By default it is turned off. Enable the guards...
#8
But they just follow the player they don't attack and when I shoot them they don't loose energy...
Is it normal?
Germ
05/25/2005 (5:47 am)
Thanks! That was it! Now it's full of guard everywhere lol...But they just follow the player they don't attack and when I shoot them they don't loose energy...
Is it normal?
Germ
#9
05/25/2005 (5:54 am)
They should die when you shoot them enough... Trace teh code, and make sure they are settiung the imagetrigger ... place some echos to see what is going on.
Torque 3D Owner Stephen Zepp