Author Topic: How does the backstab system work.  (Read 1052 times)

I've been hoping to make some weapons for blockland, and I'd like to include some of the TF2 knives.
So if you know how to explain the backstab script, I'd appreciate if you would post it in the comments.
I'd like to see if anyone can help me code some of these features:
-Onbackstab> Disguise
-Onbackstab> Freezeenemy (Would set the body as a ragdoll and set the player nodes to an icy blue)
-Onbackstab> Addcloakenergy
-Onbackstab> Absorbhealth
-Onequip> Playweaponanimation
If you can tell me how to animate weapons, that would be appreciated too.
« Last Edit: June 29, 2012, 10:02:35 PM by Cool Boi »

If you are using blender there is a tutorial that includes animation:
http://forum.blockland.us/index.php?topic=66763.0
You will have to do the animations in 2.49 though.

If you are using blender there is a tutorial that includes animation:
http://forum.blockland.us/index.php?topic=66763.0
You will have to do the animations in 2.49 though.
I'll have to check it out. I suck at blender though, so it may take me a while...

look at the script to find where these are if you plan on editing them, as i'm only explaining the backstab part to you.
Quote

      %stab = (vectorDot(%obj.getForwardVector(),%col.getForwardVector()) > 0); //This is checking where you are in relation to your victim, and returns 1 if you are in the proper backstab position.
      
      if(%stab)
      {
         //You are in the stab radius, start the animation
         %obj.setImageAmmo(0,1);    //This is setting the knife's "ammo", which is used in the next function to check whether to do the backstab sound and such
         serverplay3d(bknifeFireSound,%obj.getHackPosition());
         %obj.playthread(2, rotCW); //this is the stab animation, for the most part.
      }
      else
      {
         //Skip backstab animation waiting and do normal attack
         %obj.setImageAmmo(0,0); 
         %obj.playthread(2, armattack);
      }
   }
   else
   {
      //Skip backstab animation waiting and do normal attack
      %obj.setImageAmmo(0,0);
      %obj.playthread(2, armattack);
   }
}

function bKnifeImage::onFire(%this,%obj,%slot)
{
   if(%obj.getDamagePercent() < 1.0 && %obj.getImageAmmo(%slot)) //This is checking that the player using the knife is still alive and, as set in the last function, whether or not to do the backstab stuff
   {
      %obj.playThread(2,spearThrow);
      serverplay3d(critFireSound,%obj.getHackPosition()); //This is the critical backstab sound playing
   }
   Parent::onFire(%this,%obj,%slot);
}

look at the script to find where these are if you plan on editing them, as i'm only explaining the backstab part to you.
Thank you, it's very appreciated.