Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-24 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
October 24, 2012, 03:20:45 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Backstabbing  (Read 283 times)
Ordoxous
Newbie
*
Posts: 20


View Profile
« on: September 24, 2011, 09:48:55 PM »

Would it be possible to make it so that when you hit someone in the back you do bonus damage, but only in the back??? in tf2
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #1 on: September 24, 2011, 09:49:34 PM »

regular bullets? yes
Logged

DarkEnergy
Ordoxous
Newbie
*
Posts: 20


View Profile
« Reply #2 on: September 24, 2011, 09:53:50 PM »

awesome, what incs would it require?

so that i can go through them and puzzle it out
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #3 on: September 24, 2011, 09:58:09 PM »

do complex tracing and vector mathematics. its in sourcemod includes
Logged

DarkEnergy
Ordoxous
Newbie
*
Posts: 20


View Profile
« Reply #4 on: September 24, 2011, 10:11:56 PM »

thanks
Logged
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 413


⠠⠵


View Profile
« Reply #5 on: September 25, 2011, 07:47:04 AM »

Code:
PrintHintText(attacker, "doing calculation");
new Float:attacker_pos[3];
new Float:victim_pos[3];      
new Float:victim_fwd[3];
new Float:victim_eyes[3];
new Float:angle_diff;
new Float:angle_vec[3];
GetClientAbsOrigin(attacker, attacker_pos);
GetClientAbsOrigin(victim, victim_pos);
attacker_pos[2] = victim_pos[2]; //the game ignores Z in the calculation. If you can hit them, you can backstab them regardless of height.

GetClientEyeAngles(victim, victim_eyes);
GetAngleVectors(victim_eyes, victim_fwd, NULL_VECTOR, NULL_VECTOR);
MakeVectorFromPoints(victim_pos, attacker_pos, angle_vec);
NormalizeVector(angle_vec, angle_vec);
angle_diff = GetVectorDotProduct(victim_fwd, angle_vec);
PrintToChatAll("Angle diff is %f", angle_diff);
if (angle_diff < 0.3)
{
    PrintToChatAll("backstab");
}

This is something I had lyin' around my snippets folder. When I tested it it worked pretty well, but you might have to adjust the 0.3 for different games/weapons/whatever
Logged

Ordoxous
Newbie
*
Posts: 20


View Profile
« Reply #6 on: September 26, 2011, 03:31:42 AM »

wow thanks man, thats awesome
thief race here i come

There will be a special mention on the race for you
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!