Blockland Forums > Modification Help
How to make a bullets direction vary?
<< < (3/3)
RFW2:

--- Quote from: Space Guy on August 13, 2010, 06:04:23 AM ---None of the shotgun's firing script is in the first post.

--- End quote ---

I know, what Im askng is for someone to edit the script in the OP so the bullet direction varies.
Space Guy:
Having the answers spoon-fed to you really won't help in future. Look at the Shotgun script and try to interpret what each part does. If you show me which parts you are trying to change then I can help.
RFW2:

--- Quote from: Space Guy on August 13, 2010, 08:28:16 AM ---Having the answers spoon-fed to you really won't help in future. Look at the Shotgun script and try to interpret what each part does. If you show me which parts you are trying to change then I can help.

--- End quote ---

Id like to have this one done so I know for the future aswell. If someone could find a Pistol that has spread that would be fine. But I cant think of one. I have interpreted what most of it does, but I did what you said and it didnt work.
Crysist:

--- Quote from: RFW2 on August 13, 2010, 09:17:13 AM ---Id like to have this one done so I know for the future aswell. If someone could find a Pistol that has spread that would be fine. But I cant think of one. I have interpreted what most of it does, but I did what you said and it didnt work.

--- End quote ---
*spoonfeed*

--- Quote ---function shotgunImage::onFire(%this,%obj,%slot)
{
   if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
      return;
   %obj.lastFireTime = getSimTime();
     
   %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"-3")));
   %obj.playThread(2, shiftAway);

   %projectile = %this.projectile;
   %spread = 0.0015;
   %shellcount = 3;

   for(%shell=0; %shell<%shellcount; %shell++)
   {
      %vector = %obj.getMuzzleVector(%slot);
      %objectVelocity = %obj.getVelocity();
      %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
      %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
      %velocity = VectorAdd(%vector1,%vector2);
      %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
      %velocity = MatrixMulVector(%mat, %velocity);

      %p = new (%this.projectileType)()
      {
         dataBlock = %projectile;
         initialVelocity = %velocity;
         initialPosition = %obj.getMuzzlePoint(%slot);
         sourceObject = %obj;
         sourceSlot = %slot;
         client = %obj.client;
      };
      MissionCleanup.add(%p);
   }
   return %p;
}
--- End quote ---
You change that to this: %shellcount = 1;
How could you have failed at doing that? Show us your attempt.
RFW2:

--- Quote from: Crysist on August 13, 2010, 10:57:22 AM ---*spoonfeed*You change that to this: %shellcount = 1;
How could you have failed at doing that? Show us your attempt.

--- End quote ---

Oh, Ill have to do it again, I deleted it.
Navigation
Message Index
Previous page

Go to full version