Game Development Community

Flying Vehicle Probs

by Bryce · in General Discussion · 08/11/2006 (3:43 pm) · 7 replies

Hello ive been trying to create a flying vehicle for 1.4 and for some reason it wont compile. The console said that there was an error with line 1, but i see nothing wrong. Here's the entire code if it helps:

Datablock FlyingVehicleData(F22)
{
spawnOffset = "0 0 2";
emap = true;
category = "Vehicles";
shapeFile = "~/data/shapes/vehicles/F22.dts";
multipassenger = false;
computeCRC = true;

//debrisShapeName = "~/data/shapes/vehicles/F22_debris.dts";
//debris = F22ShapeDebris;
//renderWhenDestroyed = false;

drag = 0.25;
density = 1.0;

// Mounting Details
numMountPoints = 1; // How many mount points you want.
multipassenger = true; // Depends on # of mountpoints.
maxMountSpeed = 0.1;
mountDelay = 8;
dismountDelay = 1;
stationaryThreshold = 0.5;
maxDismountSpeed = 0.1;
mountPose[0] = "Sitting";
mountPointTransform[0] = "0 0 0 0 0 1 0";
isProtectedMountPoint[0] = false;
minMountDist = 2;

mountPose[0] = sitting; // This is the possition linked to the animation sequence name
// mountPose[9] = gun;
// mountPose[10] = bomb bay;

// Camera Settings
cameraOffset = 1.5; // Vertical offset from camera mount point
cameraMaxDist = 16;
cameraOffset = 3.65;
cameraLag = 0.1;
cameraRoll = true; // Roll the camera with the vehicle

maxDamage = 50.40;
destroyedLevel = 50.40;

// Afterburner and any energy weapon pool 
energyPerDamagePoint = 0;
maxEnergy = 280;
rechargeRate = 0;

minDrag = 40; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 20; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)

maxAutoSpeed = 10; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 400; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.55; // Dampen control input so you don't' whack out at very slow speeds

// Maneuvering
maxSteeringAngle = 3; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 20; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 20; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 6400; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 500; // Steering jets (force applied when you move the mouse)
steeringRollForce = 200; // Steering jets (how much you heel over when you turn)
rollForce = 10; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 0.5; // Height off the ground at rest
createHoverHeight = 0.5; // Height off the ground when created
maxForwardSpeed = 90; // speed in which forward thrust force is no longer applied (meters/second)

#1
08/11/2006 (3:44 pm)
Part two:

// Turbo Jet
jetForce = 3000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 28; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 2.8; // Energy use of the afterburners (low number is less drain...can be fractional) // Auto stabilize speed
vertThrustMultiple = 3.0;

// Rigid body
mass = 100; // Mass of the vehicle
integration = 3; // Physics integration: TickSec/Rate
collisionTol = 0.6; // Collision distance tolerance
contactTol = 0.4; // Contact velocity tolerance

bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.8; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 2000; // Don't mess with this.
softImpactSpeed = 3; // Sound hooks. This is the soft hit.
hardImpactSpeed = 15; // Sound hooks. This is the hard hit.

// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 10; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;

// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;

//Sounds
//jetSound = F22ThrustSound;
//engineSound = F22EngineSound;
//softImpactSound = F22SoftImpactSound;
//hardImpactSound = F22HardImpactSound;

//softSplashSoundVelocity = 10.0;
//mediumSplashSoundVelocity = 15.0;
//hardSplashSoundVelocity = 20.0;
//exitSplashSoundVelocity = 10.0;

//exitingWater = F22ExitWaterMediumSound;
//impactWaterEasy = F22ImpactWaterSoftSound;
//impactWaterMedium = F22ImpactWaterMediumSound;
//impactWaterHard = F22ImpactWaterMediumSound;
//waterWakeSound = F22WakeMediumSplashSound;

// dustEmitter = F22LiftoffDustEmitter;

triggerDustHeight = 4.0;
dustHeight = 1.0;

// damageEmitter[0] = LightDamageSmoke;
// damageEmitter[1] = HeavyDamageSmoke;
// damageEmitter[2] = MediumDamageSmoke;

damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 3;

// Weapons and Ammo
//max[RocketAmmo] = 1000;

//splashEmitter[0] = VehicleFoamDropletsEmitter;
//splashEmitter[1] = VehicleFoamEmitter;

//shieldImpact = VehicleShieldImpact;

//cmdCategory = "Tactical";
//cmdIcon = CMDFlyingScoutIcon;
//cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
//targetNameTag = 'F22';
//targetTypeTag = 'FlyingVehicle';
//sensorData = AWACPulseSensor;
//sensorRadius = AWACPulseSensor.detectRadius;
//sensorColor = "255 194 9";

checkRadius = 5.5;
observeParameters = "0 0 1";
shieldEffectScale = "0.937 1.125 0.60";
};
//----------------------------------------------------------------------------------------
// Game Functions
//----------------------------------------------------------------------------------------

function F22::onDamage(%this, %obj, %delta)
{
Parent::onDamage(%this, %obj);
%currentDamage = %obj.getDamageLevel();
if(%currentDamage > %obj.destroyedLevel)
{
if(%obj.getDamageState() !$= "Destroyed")
{
if(%obj.respawnTime !$= "")
%obj.marker.schedule = %obj.marker.data.schedule(%obj.respawnTime, "respawn", %obj.marker); 
%obj.setDamageState(Destroyed);
}
}
else
{
if(%obj.getDamageState() !$= "Enabled")
%obj.setDamageState(Enabled);
}
}
#2
08/11/2006 (3:50 pm)
Pretty tough to read with no formatting.

My recomendation for finding the problem would be to begin moving stuff from this file to another.

do this while the game is up and running and you can compile the script in the console.
so go make a change to the script and then compile it.

in other words create a very bare bones file that for example is an empty datablock and make sure that is compiling.

eg:
Datablock FlyingVehicleData(F22)
{

};

then begin copying the components in.
and if you clean up and organize the syntax at the same time, you will come out with a nice clean file.

just my 2 cents.

Edit:
heh make sure you dont copy too much in at once because you will get past your syntax error without segregating it.
#3
08/12/2006 (5:06 am)
Smart. thanks, ill try that.


GOING TO TURKEY TOMORROW, A PLACE A BORDER AWAY FROM A PLACE WHERE BEARDED MEN TRY TO KILL YOU!!!
#4
08/12/2006 (7:35 am)
Bryce. You're still making these asinine political outbursts? Do everyone a favor and grow a few years, and fully understand things before you make comments like that.

Do the forums not have some kind of "Report Post" functionality? :\
#5
08/12/2006 (8:38 am)
There is indeed a syntax error on line 1.

datablock should be spelt with a lower case d & not an upper case D

Here's your code with neater formatting. I removed all the commented out lines. Feel free to add them back in if you really need them.

datablock FlyingVehicleData(F22)
{
   spawnOffset              = "0 0 2";
   emap                     = true;
   category                 = "Vehicles";
   shapeFile                = "~/data/shapes/vehicles/F22.dts";
   multipassenger           = false;
   computeCRC               = true;

   drag                     = 0.25;
   density                  = 1.0;

   // Mounting Details
   numMountPoints           = 1;
   multipassenger           = true;
   maxMountSpeed            = 0.1;
   mountDelay               = 8;
   dismountDelay            = 1;
   stationaryThreshold      = 0.5;
   maxDismountSpeed         = 0.1;
   mountPose[0]             = "Sitting";
   mountPointTransform[0]   = "0 0 0 0 0 1 0";
   isProtectedMountPoint[0] = false;
   minMountDist             = 2;

   mountPose[0]             = sitting;

   // Camera Settings
   cameraOffset             = 1.5;
   cameraMaxDist            = 16;
   cameraOffset             = 3.65;
   cameraLag                = 0.1;
   cameraRoll               = true;

   maxDamage                = 50.40;
   destroyedLevel           = 50.40;

   // Afterburner and any energy weapon pool
   energyPerDamagePoint     = 0;
   maxEnergy                = 280;
   rechargeRate             = 0;

   minDrag                  = 40;
   rotationalDrag           = 20;

   maxAutoSpeed             = 10;
   autoAngularForce         = 400;
   autoLinearForce          = 300;
   autoInputDamping         = 0.55;

   // Maneuvering
   maxSteeringAngle         = 3;
   horizontalSurfaceForce   = 20;
   verticalSurfaceForce     = 20;
   maneuveringForce         = 6400;
   steeringForce            = 500;
   steeringRollForce        = 200;
   rollForce                = 10;
   hoverHeight              = 0.5;
   createHoverHeight        = 0.5;
   maxForwardSpeed          = 90;

   // Turbo Jet
   jetForce                 = 3000;
   minJetEnergy             = 28;
   jetEnergyDrain           = 2.8;
   vertThrustMultiple       = 3.0;

   // Rigid body
   mass                     = 100;
   integration              = 3;
   collisionTol             = 0.6;
   contactTol               = 0.4;

   bodyFriction             = 0;
   bodyRestitution          = 0.8;
   minRollSpeed             = 2000;
   softImpactSpeed          = 3;
   hardImpactSpeed          = 15;

   // Ground Impact Damage (uses DamageType::Ground)
   minImpactSpeed           = 10;
   speedDamageScale         = 0.06;

   // Object Impact Damage (uses DamageType::Impact)
   collDamageThresholdVel   = 23.0;
   collDamageMultiplier     = 0.02;

   triggerDustHeight        = 4.0;
   dustHeight               = 1.0;

   damageEmitterOffset[0]   = "0.0 -3.0 0.0 ";
   damageLevelTolerance[0]  = 0.3;
   damageLevelTolerance[1]  = 0.7;
   numDmgEmitterAreas       = 3;

   checkRadius              = 5.5;
   observeParameters        = "0 0 1";
   shieldEffectScale        = "0.937 1.125 0.60";
};

//----------------------------------------------------------------------------------------
// Game Functions
//----------------------------------------------------------------------------------------

function F22::onDamage(%this, %obj, %delta)
{
   Parent::onDamage(%this, %obj);
   %currentDamage = %obj.getDamageLevel();

   if(%currentDamage > %obj.destroyedLevel)
   {
      if(%obj.getDamageState() !$= "Destroyed")
      {
         if(%obj.respawnTime !$= "")
            %obj.marker.schedule = %obj.marker.data.schedule(%obj.respawnTime, "respawn", %obj.marker);
            %obj.setDamageState(Destroyed);
      }
   }

   else
   {
      if(%obj.getDamageState() !$= "Enabled")
         %obj.setDamageState(Enabled);
   }
}
#6
08/12/2006 (9:10 am)
Did not know tge was case sensitive. gonna have to debug the rest of my scripts now...
#7
08/13/2006 (6:11 pm)
Are you reffering to Iraq?? Of course they try to kill you when you burst through their front door, point assault rifles at their faces and then promise them freedom while setting up YOUR industry in THEIR country, slowly developing their economy to be dependant on yours for a few good years. Though this puppet government will still probably leave them off more or less better, they don't care about the words coming from your mouth, THEY'RE MORE PREOCCUPIED WITH THE BULLETS THAT WERE POURING FROM YOUR GUN 8 SECONDS PRIOR. As Teck said, refrain from political outbursts(i'll remember that too). This isn't a political discussion forum, unless you want to discuss something that has to do with a game storyline or another such game related thing, refrain.