Author Topic: How do i add a bot to a minigame  (Read 922 times)

Hey,im working on 2 mods that need a script to put a bot in a minigame. i need to know the code to place a bot in a minigame. please help

You probably need to edit "getMiniGameFromObject(%obj)" so that it returns the proper minigame for a bot.

For instance, if you had an AIPlayer with the property "owner", you would need it to do something like..

Code: [Select]
function getMiniGameFromObject(%obj)
{
if(isObject(%obj.parent))
return %obj.parent.minigame;
else
return parent::getMiniGameFromObject(%obj);
}

That's only pseudo-code. You'll need to edit it yourself to fit your needs.

Make some sort of client object for the bot (in most cases, you can actually use the bot as its client, like %bot.client = %bot;) then set the bot's client minigame to the minigame of a player in the minigame or the name of the minigame:
%bot.client.minigame = %player.client.minigame;

Adding a client tag would cause the bot to act like the client's player. If it died, they would go through the death process and respawn, leaving behind a clone of their actual player. Even with a fake client attached it's going to cause massive glitching.