Blockland Forums > Modification Help

IF statement help

Pages: << < (2/2)

Midway Sentinel:

thank you once again :D

you sir, are incredible

edit: where do i put it in the script? lol

ThinkInvisible:


--- Code: ---if(ShapeBase::isMovingForward(YOURPLAYER)) {
   STUFFYOUWANTTODOIFPLAYERISMOVING
}
else
{
   STUFFYOUWANTTODOIFPLAYERISNOTMOVING
}
--- End code ---

Correct?

Headcrab Zombie:


--- Quote from: Headcrab Zombie on August 18, 2011, 08:08:19 PM ---If you want this for that vehicle you made, just add '&& %obj.isMovingForward()' to the if that makes it fly if it passes, and if you want to to stop when you stop moving, I think add ' || !%obj.isMovingForward() ' to the other if

--- End quote ---

So,


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

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

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

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

You might even want to take out the velocity checks

Midway Sentinel:

thanks a mil. :D

Pages: << < (2/2)

Go to full version