Author Topic: Request: Tumble and Spin when someone is hit by a specific projectile  (Read 1221 times)

Ghoul posted this earlier:

Is there any way to make the guy you shoot go spinning with the bullet?

And so I was wondering if anyone would be willing to reverse engineer the Death Tumble script to accommodate this?
Specifically:

When a person is hit/killed by the weapon's projectile (wavebuster projectile), he starts tumbling with a high speed spin added to the tumble immediately after he starts tumbling.

Here's the death tumble script by Zor.

Code: [Select]
package deathzor{
 function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc){
  if(!%this.player.normaldeath && %this.minigame){
   Deathtumble(%this.player);
  }
  Parent::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc);
 }
};
activatepackage(deathzor);

function Deathtumble(%obj, %time)
{
//return;

//mount the object on a new deathvehicle for %time milliseconds
%currentVehicle = %obj.getObjectMount();
%client = %obj.client;

%newcar = new WheeledVehicle()
{
dataBlock = deathVehicle;
client = %client;
initialPosition = %posX @ " " @ %posY @ " " @ %posZ;
};

//%newcar = %client.DeathtumbleVehicle;
%newcar.setVelocity("0 0 0");

if(!%newcar)
return;

//neutralize current velocity
%newcar.applyImpulse( %newcar.getPosition(), vectorScale(%newcar.getVelocity() * -1, %newcar.getDataBlock().mass) );

//error("player tumbling!");
%obj.canDismount = false;

if(%currentVehicle && (%currentVehicle.getDataBlock().getName() $= "skiVehicle") )
{
//%obj.client.setControlObject(%obj);
//match ski vehicle
//neutralize velocity first

%newcar.setTransform(%currentVehicle.getTransform());
%newcar.applyImpulse( %newcar.getPosition(), vectorScale(%currentVehicle.getVelocity(), %newcar.getDataBlock().mass) );
%newcar.mountObject(%obj, 0);

%currentVehicle.setTransform("0 0 -1000");
%currentVehicle.schedule(500, delete);
}
else
{
//match player
//error("transform = ",%obj.getTransform());
%newcar.setTransform(%obj.getTransform());
%newcar.applyImpulse( %newcar.getPosition(), vectorScale(%obj.getVelocity(), %newcar.getDataBlock().mass) );
//%newcar.setTransform(%obj.getTransform());

//%obj.setTransform("0 0 0 0 0 1 0");

%newcar.mountObject(%obj, 0);

//error("not skiing");
//error("transform = ",%obj.getTransform());
}

//definitely delete after 45 seconds
%newcar.schedule(45 * 1000, delete);

%newcar.schedule(2000, DeathtumbleCheck);

%client.camera.setMode("Corpse",%obj);
%client.setControlObject(%client.camera);

//remove %player.istumbling after a we stop
//schedule(%time, %obj, stopDeathtumble, %obj);


//%nextDeathtumbleVehicle = new WheeledVehicle()
//{
// dataBlock = deathVehicle;
// client = %client;
// initialPosition = %posX @ " " @ %posY @ " " @ %posZ;
//};
//%obj.client.DeathtumbleVehicle = %nextDeathtumbleVehicle;
//%nextDeathtumbleVehicle.setTransform("0 0 -90");



//%newcar.schedule(%time, unmountobject, %obj);
//%obj.schedule(%time, setcontrolobject, 0);
//%newcar.schedule(%time + 250, setTransform, "0 0 -90");
}

function Vehicle::DeathtumbleCheck(%obj)
{
%obj.getDataBlock().DeathtumbleCheck(%obj);
}

function deathVehicle::DeathtumbleCheck(%this, %obj)
{
if(vectorLen(%obj.getVelocity()) < 1 || %obj.getWaterCoverage() > 0.3)
{
%player = %obj.getMountedObject(0);
if(isObject(%player))
{
%player.canDismount = true;
%player.stopSkiing();
}
%obj.schedule(10, delete);
}
else
{
%obj.schedule(2000, DeathtumbleCheck);
}
}

function deathVehicle::onRemove(%this, %obj)
{
// echo("deathvehicle::onremove ", %this, " ", %obj);
%player = %obj.getMountedObject(0);
if(isObject(%player))
{
%player.canDismount = true;
}
}
« Last Edit: November 27, 2007, 08:21:29 PM by Muffinmix »

Zor or spaceguy i belive.

Zor or spaceguy i belive.
Zor. Notice the topic where masterninja stole it and Zor owned him? Or the fact that the package is deathzor

Zor or spaceguy i belive.
Zor. Notice the topic where masterninja stole it and Zor owned him? Or the fact that the package is deathzor
Ah, I'll modify the original post then.