Page 1 of 1

Punchangle for sshogun hits

Posted: Sat Mar 21, 2015 6:47 pm
by Cobalt
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.



Re: Punchangle for sshogun hits

Posted: Mon Mar 23, 2015 1:46 am
by PrimalLove
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. :)