Blockland Forums > Modification Help
Checking For Death by explosion
Amade:
player::damage(%obj, %sourceObject, %pos, %amount, %type)
%sourceObject could be any number of things, usually a player, client, projectile, or vehicle.
Swollow:
--- Code: ---package bloodBath
{
function player::damage(%obj, %sourceObject, %pos, %amount, %type)
{
%cp = %sourceObject;
if($damage::direct[%type] == 0)
{
%cp.mountImage(bleedImage,0);
%p = new Projectile()
{
datablock = goryDeathExplosionProjectile;
scale = "3 3 3";
initialVelocity = "0 0 0";
initialPosition = %cp.position;
sourceObject = %cp;
sourceSlot = 0;
client = %sourceObject;
};
}
parent::Damage(%obj, %sourceObject, %pos, %amount, %type);
}
};
activatePackage(bloodBath);
--- End code ---
This is what I have now but theres two problems
#1 Suiciding results in this
#2 I can no longer seem to mount "bleed image"
infiniteLoop:
--- Quote from: swollow on August 08, 2011, 08:50:17 PM ---
--- Code: ---package bloodbath
{
function player::damage(%obj, %sourceObject, %pos, %amount, %type)
{
%cp=%sourceObject;
if($Damage::Direct[%type] == 0)
{
%cp.mountImage(BleedImage,0);
%p = new projectile()
{
dataBlock = GoryDeathExplosionProjectile;
scale = ("3 3 3");
initialVelocity = ("0 0 0");
initialPosition = %cp.getPosition();
sourceObject = %cp;
sourceSlot = 0;
client = %sourceObject;
};
Parent::Damage(%obj, %sourceObject, %pos, %amount, %type);
}
}
};
activatePackage(bloodbath);
--- End code ---
This is what I have now but theres two problems
#1 Suiciding results in this (not really a problem that I care about but....)
#2 Direct projectiles (bullets) Don't hurt you anymore
--- End quote ---
@#2, You need to call the parent outside of the if statement (like shown below), also indent like this:
package bloodBath
{
function player::damage(%obj, %sourceObject, %pos, %amount, %type)
{
%cp = %sourceObject;
if($damage::direct[%type] == 0)
{
%cp.mountImage(bleedImage,0);
%p = new Projectile()
{
datablock = goryDeathExplosionProjectile;
scale = "3 3 3";
initialVelocity = "0 0 0";
initialPosition = %cp.position;
sourceObject = %cp;
sourceSlot = 0;
client = %sourceObject;
};
//Parent moved from here to ..
}
//..Here
parent::Damage(%obj, %sourceObject, %pos, %amount, %type);
}
};
activatePackage(bloodBath);
Swollow:
ya i already figured that out i modified my post, and I was hurrying to get this done so indents got kinda wacko :p so what am I supposed to mount bleed image too? and is there a way to get around the Self Delete problem?
--- Quote from: swollow on August 08, 2011, 08:50:17 PM ---
--- Code: ---package bloodBath
{
function player::damage(%obj, %sourceObject, %pos, %amount, %type)
{
%cp = %sourceObject;
if($damage::direct[%type] == 0)
{
%cp.mountImage(bleedImage,0);
%p = new Projectile()
{
datablock = goryDeathExplosionProjectile;
scale = "3 3 3";
initialVelocity = "0 0 0";
initialPosition = %cp.position;
sourceObject = %cp;
sourceSlot = 0;
client = %sourceObject;
};
}
parent::Damage(%obj, %sourceObject, %pos, %amount, %type);
}
};
activatePackage(bloodBath);
--- End code ---
This is what I have now but theres two problems
#1 Suiciding results in this
#2 I can no longer seem to mount "bleed image"
--- End quote ---
EDIT: Realized my mistake I had to mount bleedimage to %obj instead of %cp
hope someone can help me with the Self Delete part though
Double Edit: I noticed when you mount the bleedimage it unmounts your tools how would I make it so that bleed image only mounts when your dead?
Chrono:
Type.