Author Topic: Vehicle Help  (Read 622 times)

Hey, I'm in the process of making my first add-on/edit of a default.

It's going to be a soccer ball, going pretty well so far. I was wondering if someone could help me with scaling it down to 0.3 0.3 0.3 and also was looking for someone to teach me a little bit about masses and how to use them.

Thanks.

Look at the Scooter vehicle for how to detect when a vehicle is spawned.

Look at the Scooter vehicle for how to detect when a vehicle is spawned.
Ok, thanks.
EDIT: Is it this?

Code: [Select]
function scooterVehicle::onAdd(%this,%obj)
« Last Edit: August 11, 2009, 08:06:37 AM by Placid »

Try things out instead of asking for help and confirmation every ten seconds. It will really help you learn more if you experiment. What does it look like it does?

I'm pretty sure I have it right, I just have 2 problems. One is that it won't show up on the Vehicles list, even when all add-ons except the vehicle are disabled. Second is that I get a syntax error:

Object 'slowImpactSound' is not a member of the AudioProfile data block group.
Object 'hardImpactSound' is not a member of the AudioProfile data block group.

Any suggestions?

slowImpactSound and fastImpactSound are defined in the Jeep file, not default Blockland. Use forceRequiredAddOn (look at the Guns Akimbo for an example) to run the Jeep first, then use those sounds.

Also console log and/or script. I cannot fix errors if I cannot see where they are.

Thanks for the help, the syntax is gone.
I still can't get the UI to show up, but I'll play around with it. Hopefully it'll show up later. I also have to play around with mass so it goes far, but.. :/

Thanks for all the help. :)

Also console log and/or script. I cannot fix errors if I cannot see where they are.

OK, lol.

Don't mind the mass, I was screwing around with it earlier, will fix it later.

Code: [Select]

datablock WheeledVehicleData(SoccerBallVehicle)
{
category = "Vehicles";
displayName = "SoccerBall";
shapeFile = "./ball.dts";
emap = true;
minMountDist = 3;
   
   numMountPoints = 0;
   mountThread[0] = "sit";
   mountThread[1] = "sit";
   mountThread[2] = "sit";
   mountThread[3] = "sit";
   mountThread[4] = "sit";
   mountThread[5] = "sit";
   mountThread[6] = "sit";
   mountThread[7] = "sit";

maxDamage = 999999.00;
destroyedLevel = 200.00;
energyPerDamagePoint = 160;
speedDamageScale = 1.04;
collDamageThresholdVel = 20.0;
collDamageMultiplier   = 0.02;

massCenter = "0 0 0";
   massBox = "3 3 3";

maxSteeringAngle = 0.9785;  // Maximum steering angle, should match animation
integration = 4;           // Force integration time: TickSec/Rate
//tireEmitter = TireEmitter; // All the tires use the same dust emitter

// 3rd person camera settings
cameraRoll = false;         // Roll the camera with the vehicle
cameraMaxDist = 13;         // Far distance from vehicle
cameraOffset = 7.5;        // Vertical offset from camera mount point
cameraLag = 0.0;           // 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 = jeepTire;
//defaultSpring = jeepSpring;
//flatTire     = jeepFlatTire;
//flatSpring = jeepFlatSpring;

   numWheels = 0;

// Rigid Body
mass = 100000;
density = 3.5;
drag = 0.6;
bodyFriction = 0.6;
bodyRestitution = 0.9;
minImpactSpeed = 10;        // Impacts over this invoke the script callback
softImpactSpeed = 10;       // Play SoftImpact Sound
hardImpactSpeed = 15;      // Play HardImpact Sound
groundImpactMinSpeed    = 10.0;

// Engine
engineTorque = 12000; //4000;       // Engine power
engineBrake = 2000;         // Braking when throttle is 0
brakeTorque = 4000;        // When brakes are applied
maxWheelSpeed = 20;        // Engine scale by current speed / max speed

// Energy
maxEnergy = 10000;
jetForce = 3000;
minJetEnergy = 30;
jetEnergyDrain = 2;

   isSled = false;

   forwardThrust = 3000;
reverseThrust = 2000;
lift = 1000;
maxForwardVel = 40;
maxReverseVel = 40;
horizontalSurfaceForce = 0;   // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 0;
rollForce = 4000;
yawForce = 6000;
pitchForce = 6000;
rotationalDrag = 0.15;
stallSpeed = 10;

splash = vehicleSplash;
splashVelocity = 4.0;
splashAngle = 67.0;
splashFreqMod = 300.0;
splashVelEpsilon = 0.60;
bubbleEmitTime = 1.4;
splashEmitter[0] = vehicleFoamDropletsEmitter;
splashEmitter[1] = vehicleFoamEmitter;
splashEmitter[2] = vehicleBubbleEmitter;
mediumSplashSoundVelocity = 10.0;   
hardSplashSoundVelocity = 20.0;   
exitSplashSoundVelocity = 5.0;

//mediumSplashSound = "";
//hardSplashSound = "";
//exitSplashSound = "";

// Sounds
//   jetSound = ScoutThrustSound;
//engineSound = idleSound;
//squealSound = skidSound;
softImpactSound = slowimpact.WAV;
hardImpactSound = fastimpact.wav;
//wheelImpactSound = slowImpactSound;

//   explosion = VehicleExplosion;
justcollided = 0;

   uiName = "SoccerBall ";
rideable = false;
lookUpLimit = 0.65;
lookDownLimit = 0.45;

paintable = false;
   
   damageEmitter[0] = vehicleBurnEmitter;
damageEmitterOffset[0] = "0.0 0.0 0.0 ";
damageLevelTolerance[0] = 0.99;

   damageEmitter[1] = vehicleBurnEmitter;
damageEmitterOffset[1] = "0.0 0.0 0.0 ";
damageLevelTolerance[1] = 1.0;

   numDmgEmitterAreas = 1;

   initialExplosionProjectile = vehicleExplosionProjectile;
   initialExplosionOffset = 0;         //offset only uses a z value for now

   burnTime = 4000;

   finalExplosionProjectile = vehicleFinalExplosionProjectile;
   finalExplosionOffset = 0.5;          //offset only uses a z value for now

   minRunOverSpeed    = 2;   //how fast you need to be going to run someone over (do damage)
   runOverDamageScale = 5;   //when you run over someone, speed * runoverdamagescale = damage amt
   runOverPushScale   = 1.2; //how hard a person you're running over gets pushed
};

function soccerballvehicle::onAdd(%this,%obj)
{
%obj.setscale("0.3 0.3 0.3");
}


inb4obviousfix

Change the code to this:
Code: [Select]
function soccerballvehicle::onAdd(%this,%obj)
{
Parent::onAdd(%this,%obj);
%obj.setscale("0.3 0.3 0.3");
}
but that wouldn't cause it to not show up in the wrench menu...

Console log. It's possible that some obscure value I can't see causes it not to register as a valid vehicle.

It's possible that some obscure value I can't see causes it not to register as a valid vehicle.
It is.

This needs to be in the datablock for it to appear on the vehicle list.
Code: [Select]
rideable = true;

It is.

This needs to be in the datablock for it to appear on the vehicle list.
Code: [Select]
rideable = true;
Oh. Thanks, you two.
EDIT: Yay, it works. Now to play with mass.
« Last Edit: August 15, 2009, 08:15:36 AM by Placid »