Blockland Forums > Help
GSF Sea Copter script not working
<< < (3/3)
Tezuni:

--- Quote from: phflack on February 03, 2010, 12:18:50 AM ---well tezuni, would it work?

--- End quote ---

The vehicle velocity events functions are:

--- Code: ---function Vehicle::setVelocity(%this,%vel)
{
%this.setVelocity(%vel);
}

function Vehicle::addVelocity(%this,%vel)
{
%this.setVelocity(vectorAdd(%this.getVelocity(),%vel));
}
--- End code ---

Here is the completely rewritten script by Clockturn:

--- Code: ---function gsfseacopterVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val)
   {
      if(%triggerNum == 2)
      {
         %vel = %obj.getVelocity();
         if(getWord(%vel,2) < 30)
    %obj.setVelocity(vectorAdd(%vel,"0 0 3"));

      }
   }
}

package SeaCopterTrigger
{
   function Armor::onTrigger(%datablock,%player,%slot,%val)
   {
      Parent::onTrigger(%datablock,%player,%slot,%val);
      %mount = %player.getObjectMount();
      if(%slot == 2 && isObject(%mount))
      {
         if(%val)
         {
            %mountdatablock = %mount.getDatablock();
            if(%mountdatablock.getName() $= "GSFSeaCopterVehicle")
            {
               %mountdatablock.climbUp(%mount);
            }
         } else {
            cancel(%mount.climbUpSchedule);
         }
      }
   }
};
ActivatePackage(SeaCopterTrigger);

function GSFSeaCopterVehicle::climbUp(%datablock,%vehicle)
{
   %vel = %vehicle.getVelocity();
   if(getWord(%vel,2) < 20)
   {
      %vehicle.setVelocity(vectorAdd(%vel,"0 0 1"));
   }
   %vehicle.climbUpSchedule = %datablock.schedule(50,"climbUp",%vehicle);
}
--- End code ---

Here is the original: (Broke after v13)

--- Code: ---function gsfseacopterVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val){
      if(%triggerNum == 2){
      %pmount = %client.player.getObjectMount();
      %pmount.setVelocity("0 0 20");
  }
   }
}

function gsfseacopterImage1::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}

function gsfseacopterCheck(%obj)
{
// return;
if(!isObject(%obj))
return;

%speed = vectorLen(%obj.getVelocity());
if(%speed < %obj.dataBlock.mingsfseacopterSpeed)
{
if(%obj.getMountedImage(3) !$= "")
{
%obj.unMountImage(2);
}
}
else
{
if(%obj.getMountedImage(3) $= 0)
{
%obj.mountImage(gsfseacopterImage1,2);
}
}


schedule(2000,0,"gsfseacopterCheck",%obj);
}


function gsfseacoptervehicle::onadd(%this,%obj)
{

   %obj.playThread(0,"spin");
       gsfseacopterCheck(%obj);
}

--- End code ---

I've tried using all of these and modifying them, but with no results.  I've given up on it, but I encourage anyone else to take a shot.
Navigation
Message Index
Previous page

Go to full version