Talk:Weapon frag

From Valve Developer Community
Jump to navigation Jump to search

How can I do red glow how on grenade with Residual presence? long trail --]{o$Tya It is me B-) 12:14, 16 May 2011 (UTC)

Drop Active on Death

In many NPC there is an Event_Killed() which handles actions during death. You can create an active grenade at this moment. This works for Combine, Elites, and Metrocops. In theory the same technique could be used for other OnDeath deployments (grenades, turrets, headcrab).

At the beginning of your NPC_Combine.cpp, below the other #include statements.

	#include "grenade_frag.h"

Down lower, in Event_Killed.

	void CNPC_Combine::Event_Killed( const CTakeDamageInfo &info )
	{
	 	Vector vecSrc;
	 	vecSrc = info.GetDamagePosition();
	 	Fraggrenade_Create(vecSrc, vec3_angle, vecSrc * 50, vecSrc + Vector(0, 0, 0), this, 1.5f, true);
	 	(  REST OF THE CODE  ) 

info contains information on the Damage done, used this as origin/angles/velocity for grenade to spawn in. The floating timer (1.5f in the above code) controls time-til-detonation. Have fun.