Game Development Community

Getting AI Players to Stay in a Mission

by Heather Leebert · in Torque Game Engine · 02/22/2010 (2:53 am) · 3 replies

I was working on a mission on TGE and had AI players spawn on paths and make them follow them but they disappear and I have to put them back in again every time I load my mission. It can get really annoying at times. How can I make sure the AI players stay in the mission every time I load it?

Also, my mission always seems to load as "New Mission" every time I open it. Does this have to do with the AA characters not staying on the map?

EDIT: I even tried using the information given here: http://www.torquepowered.com/community/resources/view/15320 but to no avail.

About the author

I'm currently in my last year as a student at DeVry University online for my degree in GSP (Game and Simulation Programming). However, my scripting/coding/programming skills aren't as good as I want them to be...


#1
02/22/2010 (1:26 pm)
I am not sure what you mean by "New Mission." That might have something to do with your problem, but I believe the main problem is that AI players are not included in the MissionGroup, and thus are not saved as part of the mission. The appropriate way to go about what you desire would be to develop an "onMissionReady" method (or whatever you desire to call it) that is called when the mission is loaded and ready to be played. Then, just put your AI spawning code in this function so that the AI will be dynamically spawned every time you load the level.

Still, if you truly do load a "New Mission" every time, this might not work.
#2
02/22/2010 (10:24 pm)
Or, you can jump through the few easy hoops to create AIPlayers just like other entities you add through the world editor:
www.torquepowered.com/community/forums/viewthread/110893
#3
02/23/2010 (10:18 am)
or use persistence/ sqlite to load entities and their stats - such as current location and spawnpoint (if that is important). you only need paths setup in each mission.