Forum

Punchangle for sshogun hits

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Punchangle for sshogun hits

Postby Cobalt » Sat Mar 21, 2015 6:47 pm

Im experimenting with punchangle in regard to close attacks with the ssg, and in traceattack () at the veery bottom I have:

Code: Select all
if (trace_ent.invincible_finished < time) // target has No pent
if (vlen (org - self.origin) < 200 && trace_ent.ishuman && self.weapon == 2) // range is under 200, for humans only attacker has ssg
   {
   if (trace_ent.origin_y + 5 < org_y) //  +/- 5 unit buffer from targets center
       trace_ent.punchangle_y = vlen(org - self.origin) /5; // a value of about 40 just for tests       
   if (trace_ent.origin_y - 5 > org_y)
       trace_ent.punchangle_y = vlen(org - self.origin) / -5;

   }

Is there a better way to do this and also include the _x and _z factors as well? Has any other mod tried this? Feel free to add code and colaborate.


User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: Punchangle for sshogun hits

Postby PrimalLove » Mon Mar 23, 2015 1:46 am

You can have fun with punchvector also. I had a small mini mod where you could punch players and I used something like this for when the player got hit...



Code: Select all
if (random() < .50)
   self.punchangle_x = -5+ random()*-3;
   else
   self.punchangle_x = 5+ random()*3;
   if (random() < .50)
   self.punchangle_y = -10+ random()*-3;
   else
   self.punchangle_y = 10+ random()*3;
   if (random() < .50)
   self.punchangle_z = -4+ random()*-3;
   else
   self.punchangle_z = 4+ random()*3;
   if (random() < .50)
   self.punchvector_y = -5 + random()*-3;
   else
   self.punchvector_y = 5 + random()*3;
   if (random() < .50)
   self.punchvector_x = -4 + random()*-3;
   else
   self.punchvector_x = 4 + random()*3;
   if (random() < .50)
   self.punchvector_z = -10 + random()*-3;
   else
   self.punchvector_z = 10 + random()*3;


Its pretty fun. :)
PrimalLove
 
Posts: 14
Joined: Sun Oct 19, 2014 2:37 am


Return to QuakeC Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest