Author Topic: Team DM Mod: Variable Name  (Read 2440 times)

Solved with help from Randy.

Quote
In the function Armor::Damage which I'm editing to stop people using a rocket/impulse weapon to kill others via 'slam' damage when on their team, the third argument "%sourceObject" usually represents the object ID of the player that killed you. However, when you die via crater/wall damage, this variable is always 0 or "" no matter whether the message shown is "Client0 [Crater] Client1" or "[Crater] Client1". How do you get the name/client ID of who killed you in the first instance (Client0)? It seems to have saved a "Who Hit You Last" variable to one of the objects which I cannot access.

Code: [Select]
package NoSlam {
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
echo(%obj.client.team SPC "%obj.client.team");
echo(%this SPC "%this");
echo(%obj SPC "%obj [dead guy]");
echo(%sourceObject SPC "%sourceObject");
echo(%sourceObject.team SPC "%sourceObject.team");
echo(%damageType SPC "DAMAGE TYPE");
echo(%position SPC "Position?");
echo(%damage SPC "Damage?");
echo(%sourceObject.client.name SPC "Source Object");
echo(%obj.client.name SPC "Obj Name");
if (%obj.client.team != %sourceObject.client.team) //Works unless you are dying via Slam
{
  Parent::Damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
}
};
ActivatePackage(NoSlam);
« Last Edit: March 28, 2007, 12:45:53 PM by Space Guy »