61
Modification Help / Re: Proper kill message for delayed damage
« on: December 21, 2017, 02:34:51 AM »
I put a check so that in case of a bot being the killer it would use %obj.sourceObject, but the kill message still doesn't show the bot's name.
function gunASDFProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
if(%obj.sourceObject.getClassName() $= "AiPlayer")
%col.schedule(2000,damage,%obj.sourceObject,%col.getPosition(),100,%this.directDamageType);
else
%col.schedule(2000,damage,%obj.client,%col.getPosition(),100,%this.directDamageType);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
}
On further testing, it appears that kill messages are usually correct when the attacker is a player and either %obj (the projectile), %obj.sourceObject, or %obj.client is passed in to the damage method, provided that whatever is passed in still exists after 2 seconds. However, if the attacker is a bot, then neither %obj.sourceObject nor %obj.client will get a correct kill message, and only %obj works, as long as it exists.
How bad is it to be creating temporary script objects every time someone gets hit by the weapon's projectiles?
function gunASDFProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
if(%obj.sourceObject.getClassName() $= "AiPlayer")
%col.schedule(2000,damage,%obj.sourceObject,%col.getPosition(),100,%this.directDamageType);
else
%col.schedule(2000,damage,%obj.client,%col.getPosition(),100,%this.directDamageType);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
}
On further testing, it appears that kill messages are usually correct when the attacker is a player and either %obj (the projectile), %obj.sourceObject, or %obj.client is passed in to the damage method, provided that whatever is passed in still exists after 2 seconds. However, if the attacker is a bot, then neither %obj.sourceObject nor %obj.client will get a correct kill message, and only %obj works, as long as it exists.
How bad is it to be creating temporary script objects every time someone gets hit by the weapon's projectiles?