Alright someone helped me by modifying a script, however he doesn't know a whole lot about scripting so can someone modify this to not let the player ride through walls and not flip over (or at least when they do, flip back)?
//script made by Bas BT 4-1-2010.
datablock WheeledVehicleTire(SkateboardwheelTire)
{
shapeFile = "./Skateboardwheel.dts";
staticFriction = 4;
kineticFriction = 7;
// Spring that generates lateral tire forces
lateralForce = 18000;
lateralDamping = 4000;
lateralRelaxation = 1;
// Spring that generates longitudinal tire forces
longitudinalForce = 18000;
longitudinalDamping = 4000;
longitudinalRelaxation = 1;
};
datablock WheeledVehicleSpring(SkateboardwheelSpring)
{
// Wheel suspension properties
length = 0.3; // Suspension travel
force = 3500; // Spring force
damping = 800; // Spring damping
antiSwayForce = 6; // Lateral anti-sway force
};
datablock WheeledVehicleData(SkateboardwheelVehicle)
{
category = "Vehicles";
displayName = "skate Board";
shapeFile = "./Skateboard.dts";
emap = true;
minMountDist = 3;
numMountPoints = 1;
mountThread[0] = "root";
massCenter = "0 0 0";
//massBox = "2 5 1";
maxSteeringAngle = 0.85;
integration = 4;
cameraRoll = false; // Roll the camera with the vehicle
cameraMaxDist = 13; // Far distance from vehicle
cameraOffset = 7.5; // Vertical offset from camera mount point
cameraLag = 001; // Velocity lag of camera
cameraDecay = 0.75; // Decay per sec. rate of velocity lag
cameraTilt = 0.4;
collisionTol = 0.1; // Collision distance tolerance
contactTol = 0.1;
useEyePoint = false;
defaultTire = SkateboardwheelTire;
defaultSpring = SkateboardwheelSpring;
flatTire = SkateboardwheelTire;
flatSpring = SkateboardwheelFlatSpring;
numWheels = 4;
mass = 400;
density = 5.0;
drag = 1.6;
bodyFriction = 0.6;
bodyRestitution = 0.6;
minImpactSpeed = 5; // Impacts over this invoke the script callback
softImpactSpeed = 5; // Play SoftImpact Sound
hardImpactSpeed = 15; // Play HardImpact Sound
groundImpactMinSpeed = 10.0;
engineTorque = 4000; //4000; // Engine power
engineBrake = 600; // Braking when throttle is 0
brakeTorque = 8000; // When brakes are applied
maxWheelSpeed = 40; // Engine scale by current speed / max speed
rollForce = 900;
yawForce = 600;
pitchForce = 1000;
rotationalDrag = 0.4;
justcollided = 0;
uiName = "Skateboardwheeler Board ";
rideable = true;
lookUpLimit = 1.6;
lookDownLimit = 1.6;
paintable = true;
minRunOverSpeed = 1; //Skateboardwheel fast you need to be going to run someone over (do damage)
runOverDamageScale = 10; //when you run over someone, speed * runoverdamagescale = damage amt
runOverPushScale = 10; //Skateboardwheel hard a person you're running over gets pushed
steeringUseStrafeSteering = false; //this vehicle has pitch control, so we can't use strafe steering
};
function Skateboardwheel::onCollision(%this,%obj,%col,%vec,%speed)
{
// Collision with other objects, including items
Parent::onDamage(%this, %obj);
}
function Skateboardwheel::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() $= "SkateboardwheelVehicle"){
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 Skateboard.");
}
}
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() $= "SkateboardwheelVehicle"){
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 Skateboard.");
}
}
function Nitroit(%client)
{
%client.Nitro = 0;
}
function SkateboardwheelVehicle::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!');
}
}
}