Author Topic: Rocket Skis - Bugs  (Read 1302 times)

I have trying to make a recreation of the Rocket Skis from v8. Its working out pretty good as expected. Its supposed to go a lot faster than the normal skis, without tumbling. I have had open beta servers for this.

Here is the list of known bugs:
1. When dismounting the Rocket Skis, the ski image dose not dismount (Skis stick to feet when not skiing)
2. To much flying - Been trying to decrease flying
3. Conflicts with default skis - Skis do everything that the Rocket Skis do
4. When holding the item, it is a printer instead of the ski's image - I tried fixing this
5. Console is spammed when Rocket Skis collide with a object:
Code: (console) [Select]
Object 'skisImpactAprojectile' is not a member of the 'GameBaseData data block class.
Add-Ons/Item_RocketSkis/item_Rocketskis (601): Register object failed for object (null) of class Projectile
Set::add: Object "0" doesn't exist
[/s]
Here is the code: Updated 11/29/10
Code: (Item_RocketSkis.cs) [Select]
datablock AudioProfile(Impact1ASound)
{
   filename    = "Add-Ons/Item_skis/impact1A.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(Impact2ASound)
{
   filename    = "Add-Ons/Item_skis/impact2A.wav";
   description = AudioClose3d;
   preload = false;
};
datablock AudioProfile(Impact1BSound)
{
   filename    = "Add-Ons/Item_skis/impact1B.wav";
   description = AudioClosest3d;
   preload = true;
};

//removed the particle data. Dont want to reinvent the wheel. It also saves space for the other code.

//////////
// item //
//////////

datablock ItemData(rocketskisItem)
{
category = "Item";  // Mission editor category

equipment = true;

//its already a member of item namespace so dont break it
//className = "Item"; // For inventory system

// Basic Item Properties
shapeFile = "Add-Ons/Item_skis/ski.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Rocket Skis";
iconName = "Add-Ons/Item_skis/skis";
doColorShift = true;
colorShiftColor = "1.000 0.100 0.100 1.000";

// Dynamic properties defined by the scripts
image = rocketskisWeaponImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(rocketskisWeaponImage)
{
   // Basic Item properties
   shapeFile = "Add-Ons/Item_Skis/ski.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "-0.17 0.17 -0.07";
   rotation = eulerToMatrix("-90 90 0");
   eyeOffset = "0.7 1.2 -0.15";
   eyeRotation = eulerToMatrix("90 -90 0");

   doColorShift = true;
colorShiftColor = rocketskisItem.colorShiftColor;
   

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = false;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = rocketskisItem;

   //melee particles shoot from eye node for consistancy
   melee = true;
   //raise your arm up or not
   armReady = true;

   //casing = " ";

   doColorShift = true;
   colorShiftColor = rocketskisItem.colorShiftColor; //"0.200 0.200 0.200 1.000";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]       = "Ready";

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTriggerUp[2] = "Ready";
stateScript[2]                  = "onFire";
};
function rocketskisWeaponImage::onFire(%this, %obj, %slot)
{
%player = %obj;

if(%player.isMounted())
{
%mountedVehicleName = %player.getObjectMount().getDataBlock().getName();

if(%mountedVehicleName !$= "rocketskisVehicle")
{
//we're mounted on some other kind of vehicle
commandToClient(%player.client, 'CenterPrint', "\c4Can\'t use Rocket skis right now.", 2);
//messageClient(%player.client, 'Clientmsg', 'Can\'t use Rocket skis right now.');
return;
}
else
{
//we're mounted on a rocketskisVehicle, so stop sking
%player.stopSkiing();
%player.unMount();

}
}
else
{
//we are not mounted on anything
if(vectorLen(%player.getVelocity()) <= 10)
{
%player.startSkiing();
//messageClient(%player.client, 'MsgEquipInv', '', %InvPosition);
commandToClient(%player.client,'setScrollMode', -1);

//%player.isEquiped[%invPosition] = true;
%player.unMountimage(%slot);

fixArmReady(%player);
}
else
{
//echo(" velocity = ", vectorLen(%player.getVelocity()));
commandToClient(%player.client, 'CenterPrint', "\c4Can\'t use Rocket skis while moving.", 2);
//messageClient(%player.client, 'CenterPrint', 'Can\'t use Rocket skis while moving.');
}

}
}
function rocketskisItem::onUse(%this, %player, %InvPosition)
{

%playerData = %player.getDataBlock();
%client = %player.client;

if(%player.getObjectMount())
%mountedVehicleName = %player.getObjectMount().getDataBlock().getName();

//if(%mountedVehicleName !$= "rocketskisVehicle")
//{
%player.updateArm(rocketskisWeaponImage);
%player.MountImage(rocketskisWeaponImage, 0);
//}

return;

if(%player.isMounted())
{
%mountedVehicleName = %player.getObjectMount().getDataBlock().getName();

if(%mountedVehicleName !$= "rocketskisVehicle")
{
//we're mounted on some other kind of vehicle
messageClient(%player.client, 'Clientmsg', 'Can\'t use Rocket Skis right now.');
return;
}
else
{
//we're mounted on a rocketskisVehicle, so stop skiing
%player.stopSkiing();
}
}
else
{
//we are not mounted on anything
if(vectorLen(%player.getVelocity()) <= 0.1)
{
%player.startSkiing();
messageClient(%player.client, 'MsgEquipInv', '', %InvPosition);
%player.isEquiped[%invPosition] = true;
}
else
{
messageClient(%player.client, 'Clientmsg', 'Can\'t use Rocket Skis while moving.');
}

}
}


function Player::startSkiing(%obj)
{
//make a new rocketskis vehicle and mount the player on it
%client = %obj.client;
%position = %obj.getTransform();
%posX = getword(%position, 0);
%posY = getword(%position, 1);
%posZ = getword(%position, 2);
%rot = getWords(%position, 3, 8);

%posZ += 0.3;

%vel = %obj.getVelocity();

%newcar = new WheeledVehicle()
{
dataBlock = rocketskisvehicle;
client = %client;
initialPosition = %posX @ " " @ %posY @ " " @ %posZ;
};
   MissionCleanup.add(%newcar);
%newcar.setVelocity(%vel);
//%newcar.setVelocity(%obj.getVelocity() * 90);
%newcar.setTransform(%posX @ " " @ %posY @ " " @ %posZ @ " " @ %rot);

//%obj.client.setcontrolobject(%newcar);
//%obj.setArmThread(root);
%newcar.schedule(250, mountObject, %obj, 0);
//%newcar.mountObject(%obj,0);
//%obj.setTransform("0 0 0 0 0 1 0");

%obj.unhidenode(Lski);
%obj.unhidenode(Rski);

%color = getColorIDTable(%client.currentColor);
%obj.setNodeColor("LSki", %color);
%obj.setNodeColor("RSki", %color);

//%obj.setNodeColor("Lski", SkiItem.colorShiftColor);
//%obj.setNodeColor("Rski", SkiItem.colorShiftColor);
}


function Player::stopSkiing(%obj)
{
//%rocketskisVehicle = %obj.getObjectMount();
//if(%rocketskisVehicle)
//{
// if(%rocketskisVehicle.getDataBlock().getName() $= "rocketskisVehicle")
// {
// %rocketskisVehicle.delete(); 
// }
//}
%obj.hidenode(Lskis);
%obj.hidenode(Rskis);

return;


//VVV super old inventory stuff VVV

//de-equip-hilight inv slot
%player = %obj;
%playerData = %player.getDataBlock();
%client = %player.client;
for(%i = 0; %i < %playerData.maxItems; %i++) //search through other inv slots
{
if(%player.isEquiped[%i] == true) //if it is equipped then
{
if(%player.inventory[%i] == rocketskis.getId()) //if it is rocketskis
{
messageClient(%client, 'MsgDeEquipInv', '', %i); //then de-equip it
%player.isEquiped[%i] = false;
break; //we're done because only one item can interfere
}
}
}

}










//deathVehicle - invisible vehicle that you are mounted on when you die so you bounce around
//rocketskis vehicle - slippery, stable vehicle that lets you ski



datablock WheeledVehicleData(deathVehicle)
{
//tagged fields
doSimpleDismount = true; //just unmount the player, dont look for a free space


   category = "Vehicles";
   shapeFile = "Add-Ons/Item_Skis/deathVehicle.dts";
   emap = true;

   maxDamage = 1.0;
   destroyedLevel = 0.5;

   maxSteeringAngle = 0.885;  // Maximum steering angle, should match animation
   //tireEmitter = TireEmitter; // All the tires use the same dust emitter

   // 3rd person camera settings
   cameraRoll = false;         // Roll the camera with the vehicle
   cameraMaxDist = 6;         // Far distance from vehicle
   cameraOffset = 0;        // Vertical offset from camera mount point
   cameraLag = 0.0;           // Velocity lag of camera
   cameraDecay = 0.0;        // Decay per sec. rate of velocity lag

   // Rigid Body
   mass = 90; //3100 lbs
   density = 0.5;
   massCenter = "0.0 0.0 1.25";    // Center of mass for rigid body
   massBox = "1.25 1.25 2.65";         // Size of box used for moment of inertia,
                              // if zero it defaults to object bounding box
   drag = 0.6;                // Drag coefficient
   bodyFriction = 0.6;
   bodyRestitution = 0.7;
   minImpactSpeed = 5;        // Impacts over this invoke the script callback
   softImpactSpeed = 1;       // Play SoftImpact Sound
   hardImpactSpeed = 1;      // Play HardImpact Sound
   integration = 10;          // Physics integration: TickSec/Rate
   collisionTol = 0.1;        // Collision distance tolerance
   contactTol = 0.1;          // Contact velocity tolerance

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

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


   // Energy
   maxEnergy = 0;
   jetForce = 0;
   minJetEnergy = 0;
   jetEnergyDrain = 0;

   // Sounds
//   jetSound = ScoutThrustSound;
   //engineSound = Impact1ASound;
   //squealSound = Impact1ASound;
   softImpactSound = Impact1ASound;
   hardImpactSound = Impact1BSound;
   //wheelImpactSound = Impact1BSound;

//   explosion = VehicleExplosion;
};



function deathVehicle::onImpact(%this,%obj)
{
//%trans = %obj.getMountedObject(0).getWorldBoxCenter();
%trans = %obj.getMountedObject(0).getEyePoint();
%p = new Projectile()
{
dataBlock = tumbleImpactAProjectile;
initialVelocity  = "0 0 0";
initialPosition  = %trans;
sourceObject     = %obj;
sourceSlot       = 0;
client           = %obj.client;
};
MissionCleanup.add(%p);
}

function deathVehicle::onAdd(%this,%obj)
{
//do nothing
}

datablock WheeledVehicleTire(NothingTire)
{
   // Tires act as springs and generate lateral and longitudinal
   // forces to move the vehicle. These distortion/spring forces
   // are what convert wheel angular velocity into forces that
   // act on the rigid body.
   shapeFile = "Add-Ons/Item_skis/emptyWheel.dts";
   staticFriction = 0.0;
   kineticFriction = 0.0;

   // Spring that generates lateral tire forces
   lateralForce = 0;
   lateralDamping = 0;
   lateralRelaxation = 1;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 0;
   longitudinalDamping = 0;
   longitudinalRelaxation = 1;
};

datablock WheeledVehicleSpring(rocketskisSpring)
{
   // Wheel suspension properties
   length = 1.2;             // Suspension travel
   force = 195; //3000;              // Spring force
   damping = 60; //600;             // Spring damping
   antiSwayForce = 0; //3;         // Lateral anti-sway force
};


datablock ParticleData(rocketskisParticle)
{
textureName          = "base/data/particles/cloud";
dragCoefficient      = 2.0;
gravityCoefficient   = -0.5;
inheritedVelFactor   = 0.1;
constantAcceleration = 0.0;
lifetimeMS           = 1600;
lifetimeVarianceMS   = 500;
useInvAlpha = false;

colors[0]     = "0.9 0.0 0.0 1.0";
colors[1]     = "0.6 0.3 0.0 0.8";
colors[2]     = "0.3 0.6 0.0 0.6";
colors[3]     = "0.3 0.9 0.0 0.4";
colors[4]     = "0.3 0.9 0.0 0.0";

sizes[0]      = 0.50;
sizes[1]      = 0.70;
sizes[2]      = 0.25;
sizes[3]      = 0.15;
sizes[4]      = 0.05;

times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
times[3] = 2.2;
times[4] = 3.0;
};

datablock ParticleEmitterData(rocketskisEmitter)
{
   ejectionPeriodMS = 18;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 5;
   thetaMax         = 20;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   particles = rocketskisParticle;
};

datablock WheeledVehicleData(rocketskisVehicle)
{
//tagged fields
doSimpleDismount = true; //just unmount the player, dont look for a free space

   category = "Vehicles";
   shapeFile = "Add-Ons/Item_skis/skiVehicle.dts";
   emap = true;

   maxDamage = 1.0;
   destroyedLevel = 0.5;

   maxSteeringAngle = 0.885;  // Maximum steering angle, should match animation
   tireEmitter = rocketskisEmitter; // All the tires use the same dust emitter

   // 3rd person camera settings
   cameraRoll = false;         // Roll the camera with the vehicle?
   cameraMaxDist = 11;         // Far distance from vehicle
   cameraOffset = 6.8;        // Vertical offset from camera mount point
   cameraLag = 0.0;           // Velocity lag of camera
   cameraDecay = 1.75;  //0.75;      // Decay per sec. rate of velocity lag
   cameraTilt = 0.3201; //tilt adjustment for camera: ~20 degrees down

   // Rigid Body
   mass = 90; //3100 lbs
   density = 0.5;
   massCenter = "0.0 0.0 0.5";    // Center of mass for rigid body
   massBox = "1.5 1.5 1.5";         // Size of box used for moment of inertia,
                              // if zero it defaults to object bounding box
   drag = 0.8;                // Drag coefficient
   bodyFriction = 0.21;
   bodyRestitution = 0.2;
   minImpactSpeed = 3;        // Impacts over this invoke the script callback
   softImpactSpeed = 3;       // Play SoftImpact Sound
   hardImpactSpeed = 10;      // Play HardImpact Sound
   integration = 10;           // Physics integration: TickSec/Rate
   collisionTol = 0.1;        // Collision distance tolerance
   contactTol = 0.01;          // Contact velocity tolerance


isSled = true; //if its a sled, the wing surfaces dont work unless its on the ground

   // Engine
   engineTorque = 35000;       // Engine power
   engineBrake = 25;         // Braking when throttle is 0
   brakeTorque = 80000;        // When brakes are applied
   maxWheelSpeed = 30;        // Engine scale by current speed / max speed

//For the Rocket rocketskis, the values will be increased by 500%, becuase its fun
forwardThrust = 2500;
reverseThrust = 2500;
lift = 0;
maxForwardVel = 200;
maxReverseVel = 50;
horizontalSurfaceForce = 75;   // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 0;
//Divide by 2 to make it more hard to move when flying
rollForce = 450;
yawForce = 300;
pitchForce = 500;
//This value is a odd number, make it 1.5? Na.
rotationalDrag = 3;
stallSpeed = 0;

jumpForce = 100; //havent added this into code yet.


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

   // Sounds
//   jetSound = ScoutThrustSound;
   //engineSound = "";
   //squealSound = sprayFireSound;
   //softImpactSound = Impact1ASound;
   hardImpactSound = Impact1BSound;
   //wheelImpactSound = Impact1BSound;

//   explosion = VehicleExplosion;
   
   steeringUseStrafeSteering = false; //this vehicle has pitch control, so we can't use strafe steering
};

function rocketskisVehicle::onAdd(%this,%obj)
{
//mount the nothing tire and ski spring
%obj.setWheelTire(0, nothingtire);
%obj.setWheelTire(1, nothingtire);
%obj.setWheelTire(2, nothingtire);
%obj.setWheelTire(3, nothingtire);

%obj.setWheelSpring(0, rocketskisSpring);
%obj.setWheelSpring(1, rocketskisSpring);
%obj.setWheelSpring(2, rocketskisSpring);
%obj.setWheelSpring(3, rocketskisSpring);
}

function rocketskisVehicle::onUnMount(%this, %obj)
{
%obj.delete();
}

function rocketskisVehicle::onImpact(%this,%obj)
{
//echo("rocketskisvehicle impact");
%trans = %obj.getTransform();
%p = new Projectile()
{
dataBlock = skiImpactAProjectile;
initialVelocity  = "0 0 0";
initialPosition  = %trans;
sourceObject     = %obj;
sourceSlot       = 0;
client           = %obj.client;
};
MissionCleanup.add(%p);
}


//called when the driver is unmounted for whatever reason
function DeathVehicle::onDriverLeave(%this, %obj, %player)
{
//echo("**************** rocketskisVehicle::onDriverLeave ", %this, " ", %obj);
%obj.setTransform("0 0 -9999");
%obj.schedule(10, delete);

}
function rocketskisVehicle::onDriverLeave(%this, %obj, %player)
{
//echo("**************** rocketskisVehicle::onDriverLeave ", %this, " ", %obj, " player=", %player);

if(isObject(%player))
%player.stopSkiing();

%obj.setTransform("0 0 -9999");
%obj.schedule(10, delete);
}

//The tumble code has been deleted because the rocket skis will not tumble, it would be annoying at high speed.


function deathVehicle::onRemove(%this, %obj)
{
// echo("deathvehicle::onremove ", %this, " ", %obj);
%player = %obj.getMountedObject(0);
if(isObject(%player))
{
%player.canDismount = true;
}
}
I have been cutting the code to reduce file size and just use some of the Default skis code when enabled.
« Last Edit: November 29, 2010, 04:23:16 PM by Tyler66 »

25 Views and no replys. C'mon people!

Send me a package, I have some experience with tweaking vehicles. I can help you out. I would just copy the script and package it myself, but it'd be better if you could do it :P

Looks like theres no datablock for "skisImpactAProjectile".
So, you need to create a datablock for it.

Looks like theres no datablock for "skisImpactAProjectile".
So, you need to create a datablock for it.
Thankyou, the datablock name was supposed to be "skiImpactAProjectile".

Jetz has one just like you want, but I don't think the flying can be fixed. Unless you give it a higher gravity. Or something.