Dynamic Attack System I just wrote and tested.
It lets you set the attack of each weapon dynamic to each client.
You can input an image or you can use the image the client has in his hand.
function gameConnection::setAttack(%this, %attack, %image)
{
if(!isObject(%this.player))
return;
%player = %this.player;
if(!isObject(%image))
%mnt = %player.getMountedImage(0);
else
%mnt = %image.getName();
if(!isobject(%mnt))
return;
%mnt = %mnt.getName();
%this.attack[%mnt] = %attack;
}
if(isPackage(attackSystem))
deactivatepackage(attackSystem);
package attackSystem
{
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if(%sourceObject.getClassName() $= "Projectile")
%object = %sourceObject.client.player;
if(%object.getClassName() $= "Player")
{
%mnt = %object.getMountedImage(0);
%mnt = %mnt.getName();
if(isObject(%client = %object.client)) // why am I evne doing this
{
%ddamage = %client.attack[%mnt];
if(%damage !$= "")
%damage = %ddamage;
}
}
%r = parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
return %r;
}
};activatepackage(attackSystem);