Author Topic: Basic Skateboard (Jumping + Straight Tires)  (Read 4361 times)

I am having trouble with two things in my Skateboard.

First, How do I make none of the tires show turning animation, but still have it turn?

Second, How do I get The skateboard to jump?
I got this from the Hoverboard and put it in my Skateboard script.
Code: [Select]
function hov::onCollision(%this,%obj,%col,%vec,%speed)
{
   // Collision with other objects, including items
   Parent::onDamage(%this, %obj);
}

function hov::onAdd(%this,%obj)
{
         %obj.playThread(0,"Action");
}

function StaticShapeData::create(%block)
{
 %obj = new StaticShape()
 {
      dataBlock = %block;
 };
 return(%obj);
}

function ServerCmdOllie(%client)
{
%pmount = %client.player.getObjectMount();
%vec2 = %pmount.getForwardVector();
%vec2 = VectorNormalize(%vec2);
%vec2 = VectorScale(%vec2, 15);
Checkheight(%client, %pmount);
if($Pref::Server::Midollie){
%client.ollie = 1;
}
if(%pmount.getDataBlock().getname() $= "hovVehicle"){
if(!%client.ollie) return;
%vec3 = %pmount.getposition();
%client.ollie = 0;
%vec = VectorAdd(%pmount.getposition(), "0 0" SPC 10);
%vec = VectorAdd(%vec, %vec2);
%vec = VectorSub(%vec, %vec3);
%vec = VectorNormalize(%vec);
%vec = VectorScale(%vec, 30);
%pmount.setVelocity(%vec);
}else{
messageclient(%client,"","You are not on a Hoverboard.");
}
}

function CheckHeight(%client, %obj)
{
%Zspeed = getWord(%obj.getvelocity(), 2);
if(%Zspeed < 0.35 && %Zspeed > -1.5)
{
%client.ollie = 1;
}else{
%client.ollie = 0;
}
}

function ServerCmdNitro(%client)
{
%pmount = %client.player.getObjectMount();
if(%pmount.getDataBlock().GetName() $= "hovVehicle"){
if(%client.nitro){
messageclient(%client,"","You do not have Nitro charged.");
return;
}
%vec = %pmount.getForwardVector();
%vec = VectorAdd(%vec, "0 0" SPC 0.3);
%vec = VectorNormalize(%vec);
%vec = VectorScale(%vec, 65);
%pmount.setVelocity(%vec);
%client.nitro = 1;
schedule(3500,0,"Nitroit",%client);
}else{
messageclient(%client,"","You are not on a Hoverboard.");
}
}

function Nitroit(%client)
{
%client.Nitro = 0;
}

function hovVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val){
      if(%triggerNum == 2){
      ServerCmdollie(%obj.spawnbrick.client);
 }
   }
}

function ServerCmdToggleMidollie(%client)
{
if(%client.issuperadmin || %client.isadmin)
{
 if($pref::server::Midollie){
  $pref::server::Midollie = 0;
  messageAll('','Midollie is now disabled!');
  }else{
  $pref::server::Midollie = 1;
  messageall('','Midollie now enabled!');
 }
}
}
Then I changed it up for mine.
Code: [Select]
function bskateboard::onCollision(%this,%obj,%col,%vec,%speed)
{
   // Collision with other objects, including items
    Parent::onDamage(%this, %obj);
}


function ServerCmdjump(%client)
{
%pmount = %client.player.getObjectMount();
%vec2 = %pmount.getForwardVector();
%vec2 = VectorNormalize(%vec2);
%vec2 = VectorScale(%vec2, 8);
Checkheight(%client, %pmount);
if($Pref::Server::Midjump){
%client.jump = 1;
}
if(%pmount.getDataBlock().getname() $= "bskateboardVehicle"){
if(!%client.jump) return;
%vec3 = %pmount.getposition();
%client.jump = 0;
%vec = VectorAdd(%pmount.getposition(), "0 0" SPC 12);
%vec = VectorAdd(%vec, %vec2);
%vec = VectorSub(%vec, %vec3);
%vec = VectorNormalize(%vec);
%vec = VectorScale(%vec, 12);
%pmount.setVelocity(%vec);
}else{
messageclient(%client,"","You are not on a Basic Skateboard.");
}
}

function CheckHeight(%client, %obj)
{
%Zspeed = getWord(%obj.getvelocity(), 2);
if(%Zspeed < 0.35 && %Zspeed > -1.5)
{
%client.jump = 1;
}else{
%client.jump = 0;
}
}

function bskateboardVehicle::OnTrigger(%this, %obj, %triggerNum, %val)
{
   if(%val){
      if(%triggerNum == 2){
      ServerCmdjump(%obj.spawnbrick.client);
  }
   }
}
The skateboard does jump like I want it to.
But It somehow disables the hoverboard. When I try to jump on the Hoverboard, it says "You are not on a Hoverboard"
Why?
« Last Edit: August 22, 2010, 09:43:52 PM by Uxie »

It's because you are using serverCmdOllie for both scripts. Change one.

I changed mine to servercmdjump a few times. Still failed.

Also, after leaving the server and rejoining you could not jump on your skateboard. Respawning it would not work either. This would require a whole new brick placement.

What? Okay, Changed to jump. But still fails.

Double Post

If people don't help here, you guys can all forget the Basic Skateboard's Jumping ability.

Double Post

If people don't help here, you guys can all forget the Basic Skateboard's Jumping ability.
I got an idea do you have Pandan's "Bike"?

I got an idea do you have Pandan's "Bike"?

Yep uxie can use his script for jumping

The bike is like the horse

it's a bot/playertype that you can mount, not an actual vehicle like the skateboard and hoverboard.

I suggest doing it the way the Horse does it, if you want jump.

I suggest doing it the way the Horse does it, if you want jump.
Your right

I suggest doing it the way the Horse does it, if you want jump.
I would suggest this also, however this would probably require an almost full rescript of this. Not sure if Uxie would like that. :s

I suggest doing it the way the Horse does it, if you want jump.

The horse is a botlike vehicle, and the skateboard is a physics vehicle. It only takes common sense to know that the scripts aren't interchangeable.

I would rather it be a physics vehicle so it can actually do upside down flips and stuff.

Same. Besides, I tried making it a bot first. But I don't know how exactly to do the spin animation.