Author Topic: Why don't the default bots have AiConnections?  (Read 1014 times)

The default bots are not parented to AiConnections. If they were, it would be a lot easier to basically treat them as players. Unfortunately, the lack of a client means that I will have to rewrite most functions for bots.

To see what I mean, look at these class hierarchies:
AiConnection
AiPlayer

Would it cause any problems if I added an AiConnection to every bot that's spawned?

Bots in general are bad. I'd like to see someone write up some nice framework for them (if done right maybe badspot can add it to the default code). Also, i think some guy had problems with aiConnections which caused his server to crash.

Yeah, I bumped Xalos's topic and sent Badspot a link as well.

Anyway, I feel like the way bots should work is that every bot hole has a client and then that client is used for any bots that spawn there.



Edit: This is how I'm doing the clients:
Code: [Select]
package Slayer_Modules_Bots
{
function fxDtsBrick::onBotSpawn(%this)
{
parent::onBotSpawn(%this);
%bot = %this.hBot;
if(!isObject(%bot.client))
{
if(!isObject(%this.aiClient))
{
%this.aiClient = new AiConnection()
{
bl_id = getBL_IDFromObject(%this);
class = "HoleBotClient";
};
}
%bot.client = %this.aiClient;
%this.aiClient.player = %bot;
%this.aiClient.bot = %bot;
}
}

function fxDtsBrick::onRemove(%this)
{
if(isObject(%this.aiClient))
%this.aiClient.delete();
parent::onRemove(%this);
}
};
activatePackage(Slayer_Modules_Bots);

This seems to cause death messages to display when you kill a bot. Any suggestions?
« Last Edit: May 28, 2013, 11:47:56 PM by Greek2me »