Talk:Weapon frag: Difference between revisions
Jump to navigation
Jump to search
(question about frag components) |
Ninjaofsauce (talk | contribs) (→Drop Active on Death: new section) |
||
Line 1: | Line 1: | ||
How can I do red glow how on grenade with Residual presence? long trail --[[User:Kostya|]{o$Tya]] [[File:Itisme.jpg|200px|It is me B-)]] 12:14, 16 May 2011 (UTC) | How can I do red glow how on grenade with Residual presence? long trail --[[User:Kostya|]{o$Tya]] [[File:Itisme.jpg|200px|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. | |||
<small> | |||
#include "grenade_frag.h" | |||
Down lower, in Event_Killed. | |||
void CNPC_Combine<nowiki>::</nowiki>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 ) | |||
</small> | |||
'''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. |
Latest revision as of 23:33, 23 February 2025
How can I do red glow how on grenade with Residual presence? long trail --]{o$Tya 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.