Killing all monsters Created 6 years ago2017-04-13 22:10:46 UTC by abbadon abbadon

Created 6 years ago2017-04-13 22:10:46 UTC by abbadon abbadon

Posted 6 years ago2017-04-13 22:41:53 UTC Post #334347
Hi. I want to know if it´s possible to kill all monsters in a map through the use of entities. Tried a trigger_hurt that covers the whole map but it makes HLRAD needs skyrocket making the map being impossible to compile :(

Edit: could it be done through killtarget->netname?
Posted 6 years ago2017-04-13 23:32:40 UTC Post #334348
I... wouldn't have thought a trigger entity would affect RAD in any way. Isn't RAD just lighting?
Jessie JessieTrans Rights <3
Posted 6 years ago2017-04-14 02:15:24 UTC Post #334350
Assuming goldsource? Post in the correct forum :pwned:

Yeah a trigger shouldn't impact RAD in the slightest.
Archie ArchieGoodbye Moonmen
Posted 6 years ago2017-04-14 05:21:50 UTC Post #334351
To your other point, I think killtarget would remove monsters rather than kill them. Depending on what you're doing, that may work for you.

But a trigger_hurt should be the way to go, I think. Tell us how you're doing it if it is impacting RAD so.
Jessie JessieTrans Rights <3
Posted 6 years ago2017-04-14 08:40:43 UTC Post #334352
The map is HUGE, and whan I mean huge I mean that it occupies the 85% of all the available space to build in the editor, and the trigger hurt occupies the whole map in the inside, so every monster dies. But I think that it is not a problem that all the monsters dissapear, because when the moment comes, you will be blinded by a blast and env_fade. Try that then!.

BTW: as it is a brush entity it DOES alter HLRAD:

With trigger_hurt: 84000 patches
Without trigger_hurt: 51000 patches

unless I am doing something wrong... :/
Posted 6 years ago2017-04-14 08:58:15 UTC Post #334354
Are you using NULL on the trigger brushes?

If this is for your mod, you can just code an entity that does this for you:
class CTriggerKillMonsters : public CBaseEntity
{
public:
void Spawn();
void EXPORT KillUse( CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value );
};

LINK_ENTITY_TO_CLASS( trigger_killmonsters, CTriggerKillMonsters );

void CTriggerKillMonsters::Spawn()
{
SetUse( &CTriggerKillMonsters::KillUse );
}

void CTriggerKillMonsters::KillUse( CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value )
{
edict_t* pEdict = g_engfuncs.pfnPEntityOfEntIndex( gpGlobals->maxclients + 1 );

CBaseEntity* pEnt;

for( int i = gpGlobals->maxclients + 1; i < gpGlobals->maxEntities; ++i, ++pEdict )
{
pEnt = Instance( pEdict );

if( !pEnt || !pEnt->MyMonsterPointer() )
continue;

UTIL_Remove( pEnt );
}
}
(untested)

pEdict points at the first entity that is not the world or a player (who count as monsters too as indicated by MyMonsterPointer(), and is incremented every iteration to move to the next entity in the list.
The loop iterates over all possible entities (could take a while if your num_edicts is high). Every entity that is a monster is then removed, just as if they were killtargeted.
Posted 6 years ago2017-04-14 12:17:41 UTC Post #334357
O_o Wow, and, WOW!!!, that should be included in EHL too!,I will use it for sure, I will also see how can I make it remove a given monster (something like a remove monster flag). And I discover why The trigger hurt screwed the compiling process. You are right,i did use a normal texture instead of the AAAtrigger texture.
Posted 6 years ago2017-04-14 12:44:05 UTC Post #334359
I have no clue how that code works but I think I'm gonna snag it because I feel an entity like that is very handy to have. :)
The Mad Carrot The Mad CarrotMad Carrot
Posted 6 years ago2017-04-14 21:26:37 UTC Post #334369
Is da-entity!!, imagine it, you can remove any undesired monster as if they never existed. You can code a neutronic bomb weapon with that... :walter:

Oh. I used the trigger_hurt entity finally. Works fine now, but I will study how to use the env_killer entity in the map. ;)
Posted 6 years ago2017-04-14 22:00:48 UTC Post #334370
Very niche usage, this entity :P

Seems like trigger_killall would be a more appropriate name. Especially if you could define which types of entities to wipe.
Jessie JessieTrans Rights <3
Posted 6 years ago2017-04-14 22:46:13 UTC Post #334371
trigger_killall would be a more appropriate name
+1 vote :crowbar:
You must be logged in to post a response.