Author Topic: What is wrong with this vehicle script section?  (Read 319 times)

is there something wrong here?

Code: [Select]
function DMTVCheckVelocity(%obj)
{
cancel(%obj.checkVelocitySchedule);
if(!isObject(%obj))
return;

if(vectorLen(%obj.getVelocity()) >= 10 && !%obj.isFly && %obj.isMovingForward(30))   
{
    if(isFly = 0 %obj)
    {
      %obj.playThread(0,"toFly");
      %obj.isFly = 1;
    }
}

if((vectorLen(%obj.getVelocity()) < 10 && %obj.isFly) || !%obj.isMovingForward(30))
{
    if(isFly = 1 %obj)
    {
      %obj.playThread(0,"toIdle");
      %obj.isFly = 0;
    }
}

%obj.checkVelocitySchedule = schedule(100,0,DMTVcheckVelocity,%obj);
}

function Vehicle::addVelocity(%vehicle,%velocity)
{
%vehicle.setVelocity(vectorAdd(%vehicle.getVelocity(),%velocity));
}


function DMTVvehicle::onadd(%this,%obj)
{
     %obj.PlayAudio(0,DMTVSound);
     %obj.playThread(0,"toIdle");
     %obj.isFly = 0;
}

if(%obj.isFly == 0)

if(%obj.isFly == 1)

rather than

if(isFly = 0 %obj)

if(isFly = 1 %obj)