Proper way of destroying/KILLING/remove permanently a monster. Created 5 years ago2019-08-14 19:22:00 UTC by abbadon abbadon

Created 5 years ago2019-08-14 19:22:00 UTC by abbadon abbadon

Posted 5 years ago2019-08-14 19:22:00 UTC Post #343005
Hi.
Ages ago I did use the method wich the creators of cs_italy used to "kill" the chicken to remove a cycler from a map; but, how would be a better (and less crabby) way to do it?, also, how can I made it so I can apply it to a "living" npc instead of a cycler?.

The "WHY" behind this is a mere question of trying to make disappear some monsters that, after performing an scripted sequence, will remain on the map increasing e-poly count numbers.
Posted 5 years ago2019-08-14 19:52:10 UTC Post #343007
Since you mentioned epolys, you could flip EF_NODRAW in pev->effects.
The entity will remain in the memory, and it will "live", but it shouldn't be rendered, so you can use the same one again.

However, if you want to remove them from memory, just kill them.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-15 10:34:03 UTC Post #343011
Mmmmm, that´s useful!!, a couple of npcs will benefit from this method!, but what I want to REMOVE the npc even from memory, so I think the kill method will work, right?
Posted 5 years ago2019-08-15 12:08:05 UTC Post #343012
Yes.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-15 14:36:03 UTC Post #343015
BIG thanks!!

I´m working on this:
caption textcaption text
Because of its size I need to remove three of the 6 fingers of the "hand" to reduce e-poly count once the sequence is finished, letting only 3 of the "fingers" play their role and attack the players.
Posted 5 years ago2019-08-15 16:09:02 UTC Post #343016
abbadon said:Because of its size I need to remove three of the 6 fingers of the "hand" to reduce e-poly count once the sequence is finished, letting only 3 of the "fingers" play their role and attack the players.
Then you should probably make the two sets of three fingers separate entities, with separate models for each finger set. Then you use a trigger_relay to kill the finger group that no longer needs to exist.
Dr. Orange Dr. OrangeSource good.
Posted 5 years ago2019-08-15 16:35:19 UTC Post #343017
Hi Dr.Orange!!, I have thought about this option in the first place, but since each finger then have to "open" in a different angle, the task was very complex. In this version I am animating each finger sepparately, and then make them join the same scripted sequence´s steps, from that they start to behave as individuals, but I need to "kill" three of them to avoid the processor suffer because of rendering the rest of models.
Each "finger" is not too heavy, probably 1k vertex and the same number of poly, but I am optimizing the mod beacuse apparently rendering rely entirely on the CPU and it makes the mod run only at 36 fps max actually with more than 32 bots and near 70 npcs at the same time fighting each others, and a bunch of tracers and sparks!!.
Posted 5 years ago2019-08-15 20:09:09 UTC Post #343018
You can always attach stuff to bones, though. Either via attachments or directly attaching to a bone.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-15 21:35:45 UTC Post #343019
Can you give me an example? I want to understand that method! :gak:
Posted 5 years ago2019-08-16 01:37:59 UTC Post #343020
I'm surprised you haven't heard of this one before.

Basically, you can use a certain macro that calls an engine function, to attach stuff to a bone, or attachment if you use that. I'll post more about it when I wake up, as it's currently very late at my place. xd
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-16 08:05:52 UTC Post #343021
Thanks Admer. Never heard about that !! (shame). I am still learning, you know, and that method uses CODING, and remember that coding it´s my Achilles heel... :( :crowbar:
Posted 5 years ago2019-08-16 11:33:01 UTC Post #343022
There we go:
User posted image
For example, you could make a "chain" of entities that attach to each bone.
Those entities could use the 'target' as the parent bone entity.

What this means is, you would do something like this:
CBaseEntity *pParent = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ) );

GET_BONE_POSITION( ENT( pParent->pev ), 1, pev->origin, pev->angles );
UTIL_SetOrigin( pev, pev->origin );
This is the most basic way. Of course, there would have to be more checks, and stuff.
For example, you can write the entity class to have m_pParent instead of allocating it in the Think() function every time.
A think function is required for the entity to update its position fast enough, basically, or else it'll appear choppy.

So here's what you could do: (alert: this isn't the finished code, it needs some extra security checks to avoid crashing etc.)
CAbbadonChain::SpawnThink( void )
{
    m_pParent = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ) ); // find our target

    SetThink( &CAbbadonChain::Think ); // we've spawnthought, now it's time to attach to the bones
    pev->nextthink = gpGlobals->time + 0.1;
}

CAbbadonChain::Think( void )
{
    GET_BONE_POSITION( ENT( m_pParent->pev ), 1, pev->origin, pev->angles );
    UTIL_SetOrigin( pev, pev->origin ); // to make me physically move to that origin, after I've visually moved there

   pev->nextthink = gpGlobals->time + 0.01;
}
And of course, somewhere in the Spawn() function, you'll SetThink( &CAbbadonChain::SpawnThink ); and maybe pev->flags ^= FL_ALWAYSTHINK; if you want your entity to think every frame.
Don't forget to put EXPORT in the declarations too:
void EXPORT SpawnThink( void );
void EXPORT Think( void );
Lastly, remember that this method might be a little bit network performance unfriendly, because you're now managing 3 or more entities instead of just 1. But if it's a singleplayer mod, then go for it. :P
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-16 13:29:29 UTC Post #343023
Mmmmm, maybe I am wrong, but: this way I can do a SWARM of sentinels following a "leader" simply creating a hog monster composed by a single sentinel and then make the rest of them attach to the right bone. i.e: group 1 of sentinels attach to bone 1 , group to to bone 2, and so on, right?. BTW, you have learned A LOT of coding this years!!!!, you "talk" like Solo ands Sheppard!! :P
Posted 5 years ago2019-08-16 19:23:43 UTC Post #343030
I used the number 1 because each "finger" has two bones: its own bone, and its child bone. Each finger attaches itself to a child bone.
So I was thinking of a chain, where each finger has a parent and a child. Finger A is the parent, finger B is the child, but a parent to finger C, for example.
User posted image
However, of course, you can easily achieve a swarm like what you said. In theory, at least.
It'd look something like this:
User posted image
At least the way I imagined it.

I think you'd still have to change the angles, but nonetheless, it'd be a really flexible system where you can detach a group from the parent to have its own AI, for example.

Also, LOL, yeah, I learn fast when I'm panicking for my future. I've been learning programming since 2015, I just had a chance to start doing it practically last year.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-16 20:49:58 UTC Post #343031
Brilliant!!, I would like to see some swarm of cyber-bees in your mod, Admer!! or giant killer-wasps... :crowbar:
Posted 5 years ago2019-08-16 22:58:56 UTC Post #343034
Well, something could be done about that too, though I can't say much right now.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-08-17 09:23:31 UTC Post #343038
If you need some of those models, just tell me, remember that I am quite good at modelling. ;)
You must be logged in to post a response.