Blockland Forums > Modification Help
What is wrong with this vehicle script section?
(1/1)
Midway Sentinel:
is there something wrong here?


--- Code: ---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;
}
--- End code ---
otto-san:
if(%obj.isFly == 0)

if(%obj.isFly == 1)

rather than

if(isFly = 0 %obj)

if(isFly = 1 %obj)


Midway Sentinel:
thanks :D
Navigation
Message Index

Go to full version