Sorry if this is a nooby question, haven't done weapons in Blockland or even coded for it at all for some time.
I'm trying to make an edit of the hammer item, but white. Whenever I swing the hammer, it always spawns the hit emitter even if I haven't hit anything. How do I stop this? Also, it won't make any sounds.
if(!isObject(SpaceAxeItem))
{
datablock ItemData (SpaceAxeItem : HammerItem)
{
uiName = "Space Axe";
image = SpaceAxeImage;
canDrop = true;
doColorShift = true;
colorShiftColor = "0.9 0.9 0.9 1";
};
datablock ShapeBaseImageData(SpaceAxeImage : HammerImage)
{
item = SpaceAxeItem;
showBricks = false;
doColorShift = true;
colorShiftColor = "0.9 0.9 0.9 1";
};
}
//Functions
function SpaceAxeImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armAttack);
}
function SpaceAxeImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root);
}
function SpaceAxeImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
talk("This doesn't work :(. Can anyone figure out why? I think this only works for raycasts or something, right?");
parent::onHitObject(%this, %obj, %slot, %col, %pos, %normal);
}