Author Topic: Helicopter pilot bot AI.  (Read 1143 times)

Code: [Select]
function AIPlayer::BotBeginJourny(%bot,%end)
{
for(%i=0;%i<10;%i++)
%bot.addVelocity("0 0 5");
%bot.VelocityLoop(%end);
%bot.end = %end;
}

function AIPlayer::VelocityLoop(%bot)
{
cancel(%bot.VelocityLoop);
%cx = getWord(%bot.getPosition(),0);
%cy = getWord(%bot.getPosition(),1);
%ex = getWord(%bot.end,0);
%ey = getWord(%bot.end,1);
if(%cx == %ex && %cy == %ey)return;
%bot.addvelocity(%bot.getEyePoint());
%bot.VelocityLoop = %bot.schedule(1500,0,velocityLoop);
}
Or you could just use the code that i haven't tested.
« Last Edit: November 16, 2011, 06:02:02 PM by cheese6 »

Code: [Select]
function AIPlayer::BotBeginJourny(%bot,%end)
{
for(%i=0;%i<10;%i++)
%bot.addVelocity("0 0 5");
%bot.VelocityLoop(%end);
%bot.end = %end;
}

funciton AIPlayer::VelocityLoop(%bot)
{
cancel(%bot.VelocityLoop);
%cx = getWord(%bot.getPosition(),0);
%cy = getWord(%bot.getPosition(),1);
%ex = getWord(%bot.end,0);
%ey = getWord(%bot.end,1);
if(%cx == %ex && %cy == %ey)return;
%bot.addvelocity(%bot.getEyePoint());
%bot.VelocityLoop = %bot.schedule(1500,0,velocityLoop);
}
Or you could just use the code that i haven't tested.

You spelled function wrong on the second one :3


I've done this in a Wasteland RP before, except there were 2 bots in a jeep, one had a machine gun.  It was simple, I just had them spawn on top of the vehicle, so they would mount it, then set the driver bot's movement to "Wander" 100.  There were problems with the jeep dying but not the bots, or the machine gunner sitting in the driver's seat when it spawned, that I couldn't prevent.  You could try to do this with vehicle events, using "OnVehicleSpawn>>Vehicle>>AddVelocity(Whatever)" for ascending and then "OnVehicleEnterZone>>Vehicle>>AddVelocity(Whatever, except this time using negatives)" for descending. You'd just have to zone event the area around the LZ.  I have no idea how to get it to fly back upward after landing though.