So I have this code to make bots that can either spawn with a sword, or a bow, and they'll attack the nearest player. But for some reason, they can't damage me in a minigame, and I can't damage them back.
package hax
{
function getMiniGameFromObject(%obj)
{
if(isObject(%obj.miniGame))
return %obj.miniGame;
return Parent::getMiniGameFromObject(%obj);
}
};
activatePackage("hax");
function newAlien()
{
%bot = new AIPlayer()
{
datablock = "playerStandardArmor";
position = pickSpawnPoint();
miniGame = findLocalClient().miniGame;
ShootBool = 0;
};
%random = getRandom(1,2);
switch(%random)
{
case 1:
%bot.mountImage(bowImage,0);
case 2:
%bot.mountImage(swordImage,0);
}
%bot.alienTick();
%bot.shootTick();
}
function AIPlayer::alienTick(%bot)
{
//Find closest
initContainerRadiusSearch(%bot.getPosition(), 500, $TypeMasks::PlayerObjectType);
while (%obj = containerSearchNext()) {
if (%obj == %bot || %obj.getClassName() $= "AIPlayer" || %obj.client.miniGame != %bot.miniGame)
continue;
%target = %obj;
%bot.setAimObject(%target);
%bot.setMoveObject(%target);
break;
}
%bot.schedule(100,0,alienTick);
}
I don't know how to fix this, pls help