Author Topic: Sword not shooting projectiles at all  (Read 1653 times)

Why have you commented out stateScript[3] = "onFire"; - it needs that to work. Even if you're not making a custom onFire function you'll need a state with that so it uses the default WeaponImage::onFire function.

The problem could also be with the rest of your states if it's still not working after that.

For the second post, the default WeaponImage::onFire function goes something like this: (from the TGE weapon example and a bit for scaled-up projectiles)
Code: [Select]
function WeaponImage::onFire(%this,%obj,%slot)
{
%projectile = %this.projectile;

if(%this.melee)
%initPos = %obj.getEyeTransform();
else
%initPos = %obj.getMuzzlePoint(%slot);

%muzzleVector = %obj.getMuzzleVector(%slot);
%scale = getWord(%obj.getScale(),2);
%vector1 = VectorScale(%muzzleVector, %projectile.muzzleVelocity * %scale);

%objectVelocity = %obj.getVelocity();
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);

%muzzleVelocity = VectorAdd(%vector1, %vector2);

%p = new (%this.projectileType)()
{
dataBlock        = %projectile;
initialVelocity  = %muzzleVelocity;
initialPosition  = %initPos;
originPoint      = %initPos; //it's in the Tank, not sure if needed
sourceObject     = %obj;
sourceSlot       = %slot;
client           = %obj.client;
};

if(isObject(%p))
{
%p.setScale(%scale SPC %scale SPC %scale);
MissionCleanup.add(%p);
return %p;
}

return -1;
}
It's not exact but should work in the same way for however you need to edit it.

Thanks a lot. Locking.

I did try enabling onFire a few times, though, but defining the script manually apparently fixed it.