How do I make HECU Grunts not instantly attack Vortigaunts? Created 10 months ago2023-06-21 15:42:33 UTC by RengerVanDerZande RengerVanDerZande

Created 10 months ago2023-06-21 15:42:33 UTC by RengerVanDerZande RengerVanDerZande

Posted 10 months ago2023-06-21 15:42:34 UTC Post #347638
I want to make a mod where the player fight Grunts & Vortigaunts, but I don't want Grunts & Vortigaunts to fight each other. I've had a look through hgrunt.cpp and islave.cpp and I can't find any references to each other in either files, but I might have just missed it. Please help.
Posted 10 months ago2023-06-21 20:08:24 UTC Post #347639
In goldsrc, monsters use a Classification system to decide how they feel about another monster.
The Classify() method is used by the monster to return which classification it belongs to, and IRelationship(CBaseEntity* pTarget) method is used to find the monster's relation to a target monster.

I guess you could override the IRelationship method in both hgrunt.cpp and islave.cpp to check if the target's classname is the opposite and return R_AL (-2, ally), something like:
if (FClassnameIs(pTarget->pev, "monster_human_grunt"))
{
    return R_AL;
}
Since both monsters already override that method with special handling, I'd suggest adding this check at the start of the method.
Posted 10 months ago2023-06-21 20:09:59 UTC Post #347640
Oh and you can check out the Monsters Programming - Classifications and Relationships guide for more info about this
Posted 10 months ago2023-06-22 11:42:18 UTC Post #347642
Thank you!
Posted 10 months ago2023-06-22 11:48:11 UTC Post #347643
honestly, i really should've been able to figure that out myself
You must be logged in to post a response.