Blockland Forums > Modification Help
Two different projectiles for one item image?
Pages: (1/1)
Tezuni 2.0:
The OSR can be right clicked to a mount a separate image which fires a raycast, while the original image fires a projectile.
But, can one weapon image fire two distinct projectiles?
So far I've got the Armor::OnTrigger function for right clicking, but I don't know if I can use that to fire another projectile from the same weapon image. Any ideas?
Treynolds416:
I remember the old flak cannon did this. Left click shot pellets, right click shot a grenade. It's certainly possible
otto-san:
Make two different datablocks and have a value change which one is shot.
Zloff:
Code found in ShadowsfeaR's Halo 3: Silenced SMG
--- Code: ---package HaloSMGMelee
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
if(%player.getMountedImage(0) $= HaloSMGImage.getID() && %slot $= 4 && %val)
{
%projectile = HaloMeleeProjectile;
%vector = %player.getMuzzleVector(0);
%objectVelocity = %player.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%p = new Projectile()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %player.getMuzzlePoint(0);
sourceObject = %player;
sourceSlot = 0;
client = %player.client;
};
serverPlay3D(HaloMeleeSound,%player.getPosition());
%player.playthread("3","Activate");
MissionCleanup.add(%p);
return %p;
}
Parent::onTrigger(%this, %player, %slot, %val);
}
};
ActivatePackage(HaloSMGMelee);
--- End code ---
Code found in Amade/Pandan's G36C- has a delay so you can't just spit out 8 grenades in one second
--- Code: ---package G36C
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
if(%player.getMountedImage(0) $= G36CImage.getID() && %slot $= 4 && %val)
{
if(%player.lastGrenade !$= "" && getSimTime() - %player.lastGrenade < 30000)
{
return;
}
%projectile = GlrenadeProjectile;
%vector = %player.getMuzzleVector(0);
%objectVelocity = %player.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%p = new Projectile()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %player.getMuzzlePoint(0);
sourceObject = %player;
sourceSlot = 0;
client = %player.client;
};
%player.lastGrenade = getSimTime();
serverPlay3D(rocketFireSound,%player.getPosition());
MissionCleanup.add(%p);
return %p;
}
Parent::onTrigger(%this, %player, %slot, %val);
}
};
ActivatePackage(G36C);
--- End code ---
I think the TF2 flamethrower has code like these but more simple
Pages: (1/1)