Author Topic: My vehicle runs people over only in LAN & Singleplayer  (Read 3327 times)

How can I make a ski vehicle have the capacity to kill or wound people by bumping into them?
« Last Edit: October 29, 2012, 07:46:18 PM by tommybricksetti »

trace(1); and check the console to see what it echoes when the client runs into the other object, should return something along the lines of OnImpact() or OnCollision().

Not a very helpful post but it should give you an idea.

I figured it out. Got it working so this specific ski vehicle : ballvehicle can run people over. But for some reason it only works in singleplayer, not multiplayer.

The Datablock
Code: [Select]
datablock WheeledVehicleData(skijumpVehicle : ballVehicle)
{
//tagged fields
doSimpleDismount = false; //just unmount the player, dont look for a free space
maxDismountDist = 0;

   numMountPoints = 1;

   category = "Vehicles";
   shapeFile = "add-ons/Item_skis/skiVehicle.dts";
//   shapeFile = "Add-ons/vehicle_jeep/jeep.dts";
   emap = true;

   maxDamage = 1.0;
   destroyedLevel = 0.5;

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

   // 3rd person camera settings
   cameraRoll = false;         // Roll the camera with the vehicle?
   cameraMaxDist = 7.5;         // Far distance from vehicle
   cameraOffset = 4.4;        // 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 = 50; //was 90
   density = 0.5;
   massCenter = "0 0 0";    // 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; //was 0.8                // Drag coefficient
   bodyFriction = 0.21; //was 0.21
   bodyRestitution = 0.2; //was 0.2
   minImpactSpeed = 0;        // 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.000000000000000000000001;          // Contact velocity tolerance
   contactTol = 0.1;

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

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

forwardThrust = 00; //500
reverseThrust = 00;
lift = 10;
maxForwardVel = 40;
maxReverseVel = 10;
horizontalSurfaceForce = 50; //50
verticalSurfaceForce = 50;
rollForce = 4000; //was 1600
yawForce = 6000; //was 1600
pitchForce = 8000; //was 1600
rotationalDrag = 1; //1
stallSpeed = 0;

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


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

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

//   explosion = VehicleExplosion;

speedDamageScale = 1.04;
collDamageThresholdVel = 2.0;
collDamageMultiplier   = 0.02;

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

The Vehicle mount code
Code: [Select]
function Player::startSkiJumping(%obj)
{
//make a new ski 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);
// %obj.playthread(3,walk);

%posZ += 0.3;

%vel = %obj.getVelocity();

%newcar = new WheeledVehicle()
{
dataBlock = skijumpvehicle;
client = %client;
initialPosition = %posX @ " " @ %posY @ " " @ %posZ;
};
%newcar.setTransform(%posX @ " " @ %posY @ " " @ %posZ @ " " @ %rot);
%newcar.addVelocity("0 0 5");
%newcar.schedule(250, mountObject, %obj, 0);
%newcar.addVelocity(%vel);
}

I really have no clue why it doesn't work outside of singleplayer.
« Last Edit: October 25, 2012, 03:48:10 PM by tommybricksetti »

do some debugging?

also, what doesn't work?
« Last Edit: October 25, 2012, 03:58:04 PM by nerraD »

debugging? In singleplayer this current code lets the player run other players over with the Parkour Physics vehicle. In multiplayer, however, that code doesn't work.

Update:
It works in LAN also.
« Last Edit: October 25, 2012, 04:22:20 PM by tommybricksetti »

Are you testing this in a minigame? As far as I can tell, Singleplayer at least has some strange handling for when people can be damaged.

You need to use a minigame.



There's two different sets of game variables, one for single player and LAN and one for network servers. My guess is that somewhere you have something enabled in LAN that isn't enabled on NET.

There's two different sets of game variables, one for single player and LAN and one for network servers. My guess is that somewhere you have something enabled in LAN that isn't enabled on NET.
ah ok, where are these different variables?

ah ok, where are these different variables?
They're part of the $Pref::Server:: variable set, for example $Pref::Server::QuotaLAN::Vehicle

So this and this?
Code: [Select]
$Pref::Server::Quota::Environment = "5000";
$Pref::Server::Quota::Item = "1000";
$Pref::Server::Quota::Misc = "9999";
$Pref::Server::Quota::Player = "250";
$Pref::Server::Quota::Projectile = "200";
$Pref::Server::Quota::Schedules = "1000";
$Pref::Server::Quota::Vehicle = "100";
Code: [Select]
$Pref::Server::QuotaLAN::Environment = "5000";
$Pref::Server::QuotaLAN::Item = "1000";
$Pref::Server::QuotaLAN::Misc = "9999";
$Pref::Server::QuotaLAN::Player = "250";
$Pref::Server::QuotaLAN::Projectile = "500";
$Pref::Server::QuotaLAN::Schedules = "1000";
$Pref::Server::QuotaLAN::Vehicle = "100";

I changed it to be the same so...
Code: [Select]
$Pref::Server::Quota::Environment = "5000";
$Pref::Server::Quota::Item = "1000";
$Pref::Server::Quota::Misc = "9999";
$Pref::Server::Quota::Player = "250";
$Pref::Server::Quota::Projectile = "500";
$Pref::Server::Quota::Schedules = "1000";
$Pref::Server::Quota::Vehicle = "100";
$Pref::Server::QuotaLAN::Environment = "5000";
$Pref::Server::QuotaLAN::Item = "1000";
$Pref::Server::QuotaLAN::Misc = "9999";
$Pref::Server::QuotaLAN::Player = "250";
$Pref::Server::QuotaLAN::Projectile = "500";
$Pref::Server::QuotaLAN::Schedules = "1000";
$Pref::Server::QuotaLAN::Vehicle = "100";
« Last Edit: October 25, 2012, 06:54:44 PM by tommybricksetti »

It was a guess. I'm not positive, did you try looking at the Jeep vehicle?