Blockland Forums > Modification Help
How to make a melee weapon push a vehicle.
<< < (6/6)
Axolotl:

--- Quote from: Treynolds416 on June 10, 2012, 12:02:22 PM ---The important part is that the magnitude is one. You're making a big deal out of nothing, you know what it is now.

Anyway I feel guilty for partly filling this thread up with bullstuff, so here's the math you need

--- Code: ---function getDifVec(%orig,%pos,%vec)
{
    return vectorScale((vectorSub(%pos,%orig)),%mag);
}

--- End code ---
%orig is the would be the position of the golf club head, %pos is where it hits the object, %mag is how hard you want the hit to be

--- End quote ---
%mag isn't defined.
Port:

--- Quote from: Axolotl on June 15, 2012, 11:40:23 AM ---%mag isn't defined.

--- End quote ---

There's nobody saying you can't replace it with a value.
Treynolds416:

--- Quote from: Axolotl on June 15, 2012, 11:40:23 AM ---%mag isn't defined.

--- End quote ---
Go away
-Jetz-:
You can check out the Homerun Bat for an example.

--- Quote ---function HomerunBatSuperProjectile::Damage(%this,%obj,%col,%fade,%pos,%normal)
{
   %damageType = $DamageType::Direct;
   if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;

   %scale = getWord(%obj.getScale(), 2);
   %directDamage = %this.directDamage * %scale;
   %col.damage(%obj, %pos, %directDamage, %damageType);
   serverPlay3d(HomerunBatSuperHitSound, %pos);
   if(%col.isDisabled())
   {
      %velocity = vectorScale(%obj.client.player.getEyeVector(), 35);
      %velocity = VectorAdd(%velocity, "0 0 45");
      %col.setVelocity(%velocity);
      %col.mountImage(HomerunnedImage, 0);
      if(getRandom(1, 50) == 37)
         serverPlay3d(HomerunBatHomerunSound, %pos);
   }
}
--- End quote ---
The bolded part is the bit relevant to you.
Treynolds416:

--- Quote from: -Jetz- on June 15, 2012, 05:46:44 PM ---You can check out the Homerun Bat for an example.The bolded part is the bit relevant to you.

--- End quote ---
Just so he knows, this one shoots the object at the same direction of where the player is looking, as opposed to where the positions are versed
Navigation
Message Index
Previous page

Go to full version