I have a problem with the event when the player can take critical hits when the CriticalHit is checked. The event executed, but nothing happens. Can anyone help?
package CTC
{
function fxDTSBrick::CriticalHits(%obj, %this, %ya)
{
if(isObject(%this))
{
%obj.CanTakeCriticals = %ya;
PCTC();
}
}
};
activatepackage(CTC);
package CriticalEvents
{
function PCTC()
{
if(%obj.CanTakeCriticals == 1)
{
CriticalHit();
}
else
{
%client.chatmessage("<color:FF0000>ERROR<color:FFFFFF>: You can not take criticals!");
}
}
function CriticalHit(%this,%obj,%damage)
{
if(%obj.CanTakeCriticals == 1)
{
%colScale = getWord(%col.getScale(), 2);
if(isObject(%col))
{
%damage = %this.directDamage * 10 - %this.directDamage;
%damageType = $DamageType::Direct;
if(%this.directDamageType)
{
%damageType = %this.directDamageType;
%col.spawnExplosion(critProjectile,%colScale);
%col.client.play2d(critRecieveSound);
serverplay3d( critRecieveSound ,%pos);
}
%col.damage(%obj,%pos,%damage,%damageType);
}
}
}
};
activatepackage(CriticalEvents);
registerOutputEvent(fxDTSBrick, "CriticalHits", bool, 0);