Blockland Forums > Modification Help

Sword not shooting projectiles at all

Pages: << < (3/4) > >>

YoshiDude:

In the script that creates a new player datablock, inside of an entering water trigger:

--- Code: --- if(%obj.getMountedImage(0) $="0")
{
%wep = %obj.getMountedImage(0).getName();
echo(%wep); //if(%obj.getMountedImage(0)==LoZFlippersImage)
if(%wep $= "Flippers")
{
%obj.changeDatablock(PlayerLinkWater);
}
else
{
%obj.kill();
}
}
else
{
%obj.kill();
}

--- End code ---

The item is named the exact same, and is equipped, but it always kills me.

Placid:

Ooh, i forgeted up. it's not getMountedObject, it's getMountedImage.

..getmountedobject is for vehicles, silly me. sorry about that.

and .getname() should work on that, too.

YoshiDude:

Locking to (hopefully) avoid crossposting, as I believe this belongs in General Modification Help. Not sure how else to move it.

EDIT: Never mind, the questions that need answered are more appropriate here.

YoshiDude:

Bump. I've been waiting 5 days for an answer...

Space Guy:

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: ---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;
}
--- End code ---
It's not exact but should work in the same way for however you need to edit it.

Pages: << < (3/4) > >>

Go to full version