mind if I do it?
also, how do I check an AIPlayer's line of sight to its target, and how do I tell it to fire once I have checked it?
[edit]
not real intelligent yet, but thats for tomorrow
Code:
also, how do I check an AIPlayer's line of sight to its target, and how do I tell it to fire once I have checked it?
[edit]
not real intelligent yet, but thats for tomorrow
Code:
function createFighterBot(%target)
{
%who = new AIPlayer() {
dataBlock = LightMaleHumanArmor;
aiPlayer = true;
};
MissionCleanup.add(%who);
echo("ID :"@%who);
// Player setup
%who.setMoveSpeed(1);
%who.setTransform(pickSpawnPoint());
%who.setEnergyLevel(60);
%who.setShapeName(%target.namebase@"'s Evil Twin");
%who.setSkinName(%target.colorSkin);
%who.mountImage(%target.headCode, $headSlot, 1, %target.headCodeColor);
%who.mountImage(%target.visorCode, $visorSlot, 1, %target.visorCodeColor);
%who.mountImage(%target.backCode, $backSlot, 1, %target.backCodeColor);
%who.mountImage(%target.leftHandCode, $leftHandSlot, 1, %target.leftHandCodeColor);
%who.mountImage(%target.chestCode, $chestSlot, 1, %target.chestdecalcode);
%who.mountImage(%target.faceCode, $faceSlot, 1, %target.facedecalcode);
%who.mountImage(%target.player.getmountedimage(0),$rightHandSlot);
echo(%who.namebase);
echo(%target.namebase);
schedule(1000,0,mybotreaim,%who,%target);
}
function mybotreaim(%who,%target)
{
%who.setAimObject(%target);
%who.setImageTrigger(0,1);
%targetlocation = %target.player.getTransform();
%targetx = getWord(%targetlocation, 0);
%targety = getWord( %targetlocation, 1);
%targetz = getWord( %targetlocation, 2) + 1;
%who.setMoveDestination((%targetx - 10)@" "@(%targety - 10)@" "@%targetz);
%who.setAimLocation(%targetx@" "@%targety@" "@%targetz);
schedule(1000,0,mybotreaim,%who,%target);
}