Gilding the lilly: selective types of sttack Created 4 years ago2020-02-28 12:48:23 UTC by abbadon abbadon

Created 4 years ago2020-02-28 12:48:23 UTC by abbadon abbadon

Posted 4 years ago2020-02-28 12:48:23 UTC Post #343813
Hi. I was trying to make one of my monsters be able to choose between two types of attack movements depending of the type of enemy they find. I have tried the method of FindEntitiesInSphere and FindEntityByClassname putting the name of the monster in there, but the result vary from the monster stop attacking any monster, game crashes to simply not working at all.

I have searched the SDK for sonething like this, but I have only found the
if pEnemy->isPlayer;
method that, of course, is not what I want.

Could it be done or I am exceeding what's do-able?
Posted 4 years ago2020-02-29 05:52:07 UTC Post #343820
STRING(pEnemy->pev->classname) or something like that should tell you the enemy type.
Posted 4 years ago2020-02-29 18:14:06 UTC Post #343828
One way of doing it would be like this:
if ( FClassnameIs( pEnemy->pev, "monster_something" ) )
This will work if the monster has already chosen an enemy and is about to attack it.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 4 years ago2020-02-29 19:33:31 UTC Post #343829
Thanks!!.
It needed some testing but it works. For those to want it to use this code, it goes in the ATTACK function:
//==============================================================================
// Codigo para que ingonen a los Trolley y no les disparen CRASHEA EL JUEGO!!!!
//==============================================================================
CBaseEntity *pEnemy;

pEnemy = m_hEnemy;

if ( FClassnameIs( pEnemy->pev, "monster_trolley"  ))
{
		return;
}

//=============================================================================
BTW: they ATTACKS the trolley guys, but the laser is not shot anymore.

In this case I don´t want them to RANGE attack the trolley guys, instead I want the gunners MELEE attack them, well, that´s other history of the weird things I have to do for getting what I want :)
Posted 4 years ago2020-03-01 23:24:35 UTC Post #343836
It works!!.The gunners now chase the trolley guys as if they "follow" and protect him, the only thing that I was not able to do is to keep them from showing the muzzleflash; of course no lightning is cast towards the trolley guy, but it is annoying to see the muzzleflash and hearing the shoot sound as they follow hte trolley guys . :(
You must be logged in to post a response.