Author Topic: Build-mountable weapons (REQUEST)  (Read 2619 times)

Lol.  For a non-moving vehicle, you could just construct a TSStatic with the vehicle shape and tires.

See Aloshi's warplane. It mounts (%vehicle.mountImage) a custom weapon to a point on the model (Front seat, bottom of plane) and edits some WarPlaneVehicle::onTrigger stuff to activate the weapons.

I made an edited Stuntplane which fires 5 HEGrenades out the bottom when you push Space. It directly creates the projectiles instead of using weapons.

Code: [Select]
other plane stuff
...

function stuntplaneVehicle::onTrigger(%this, %obj, %num, %cli, %wha)
{
if(%cli $= 1 && !%obj.nofire)
{
%obj.nofire = 1;
bottomprint(%obj.getMountedObject(0).client,"\c0Bombs launching!",2,2,2);
schedule(20000,0,resetfire,%obj);
Bombs(0,%obj);
}
}

function resetFire(%obj)
{
 %obj.nofire = 0;
 if(isObject(%obj.getMountedObject(0).client)){bottomprint(%obj.getMountedObject(0).client,"\c0Bombs ready!",2,2,2);}
}

function Bombs(%num,%obj)
{
     %p = new (Projectile)() {
      dataBlock        = heGrenadeProjectile;
      initialVelocity  = vectorScale("0 0 -1",heGrenadeProjectile.muzzleVelocity);
      initialPosition  = vectorAdd(%obj.position,"0 0 -2");
      sourceObject     = %obj;
      sourceSlot       = 0;
      client           = %obj.getMountedObject(0).client;
      minigame = %obj.getMountedObject(0).client.minigame;
   };
if(%num<6){schedule(500,0,bombs,%num++,%obj);}
}

Space mind if I use this?

See Aloshi's warplane. It mounts (%vehicle.mountImage) a custom weapon to a point on the model (Front seat, bottom of plane) and edits some WarPlaneVehicle::onTrigger stuff to activate the weapons.

I made an edited Stuntplane which fires 5 HEGrenades out the bottom when you push Space. It directly creates the projectiles instead of using weapons.

Code: [Select]
other plane stuff
...

function stuntplaneVehicle::onTrigger(%this, %obj, %num, %cli, %wha)
{
if(%cli $= 1 && !%obj.nofire)
{
%obj.nofire = 1;
bottomprint(%obj.getMountedObject(0).client,"\c0Bombs launching!",2,2,2);
schedule(20000,0,resetfire,%obj);
Bombs(0,%obj);
}
}

function resetFire(%obj)
{
 %obj.nofire = 0;
 if(isObject(%obj.getMountedObject(0).client)){bottomprint(%obj.getMountedObject(0).client,"\c0Bombs ready!",2,2,2);}
}

function Bombs(%num,%obj)
{
     %p = new (Projectile)() {
      dataBlock        = heGrenadeProjectile;
      initialVelocity  = vectorScale("0 0 -1",heGrenadeProjectile.muzzleVelocity);
      initialPosition  = vectorAdd(%obj.position,"0 0 -2");
      sourceObject     = %obj;
      sourceSlot       = 0;
      client           = %obj.getMountedObject(0).client;
      minigame = %obj.getMountedObject(0).client.minigame;
   };
if(%num<6){schedule(500,0,bombs,%num++,%obj);}
}

Space mind if I use this?
ask ALOSHI, who made it


No, that bombing code was Space Guy's.