Author Topic: Plane Crash  (Read 1066 times)

Possible? Help Please.


I want to make a plane vehicle crash.

%vehicle.setVelocity("0 0 -999");

it'll crash

Code: [Select]
package crash
{
function wheeledVehicle::onCollision(%this)
{
crash();
}
};
activatepackage(crash);

Code: [Select]
package crash
{
function wheeledVehicle::onCollision(%this)
{
crash();
}
};
activatepackage(crash);
Do that in the console, and it'll work. Lol...

Nonononononono I mean a plane that explodes when it hits the ground too fast. But those are funny.

Nonononononono I mean a plane that explodes when it hits the ground too fast. But those are funny.
Stratofortress made a kind of mod like this, if it was turned all the way up-side down or hit a wall hard enough it would explode

Stratofortress made a kind of mod like this, if it was turned all the way up-side down or hit a wall hard enough it would explode
That's what I want.

Code: [Select]
package crash
{
function wheeledVehicle::onCollision(%this,%obj)
{
if(%this.getVelocity()>25)
{
%this.explode();
}
}
};
activatepackage(crash);
You're going to have to replace %this.explode(); with something else because its completely wrong, but should not be hard to figure out.  I'm not sure if if(%this.getVelocity() > 25) will work or even work correctly but I think with a bit of research you could be able to figure it out.

If it's moving in the X direction at over 25 units per second then it might explode.

Can you fix it Space Guy?

Code: [Select]
package crash
{
    function wheeledVehicle::onCollision(%this,%obj)
   {
      %vehicleclient = %this.client;
      if(%this.getVelocity()>5)
      {
         %this.damage(%vehicleclient,%this.getWorldBoxCenter(),%this.getDatablock().maxdamage);
      }
   }
};
activatepackage(crash);
Try that or something, it will damage it to it's max if it collides at a speed over 5 units per second, maybe.

Code: [Select]
package crash
{
    function wheeledVehicle::onCollision(%this,%obj)
   {
      %vehicleclient = %this.client;
      %vel = %this.getVelocity();
      %speed = getWord(%vel,0) + getWord(%vel,1) + getWord(%vel,2);
      if(%speed > 10)
      {
         %this.damage(%vehicleclient,%this.getWorldBoxCenter(),%this.getDatablock().maxdamage);
      }
   }
};
activatepackage(crash);
getVelocity returns a three part vector. Just add the three parts together. Maybe average the three parts.

Tom

Code: [Select]
$vCrashSpeed = 5;

package crash
{
function VehicleData::onImpact(%this,%obj)
{
echo(%bla);
//Parent::onImpact(%this,%obj);
%vel1 = getWord(%obj.getVelocity(), 0);
%vel2 = getWord(%obj.getVelocity(), 1);
%vel3 = getWord(%obj.getVelocity(), 2);

if(%vel1 >= $vCrashSpeed  || %vel2 >= $vCrashSpeed  || %vel3 >= $vCrashSpeed)
{
%obj.damage(lastDrivingClient.player,%obj.getWorldBoxCenter(),%obj.getDataBlock().maxDamage);
}
}
};
activatepackage(crash);

How I did it.