twhl-community / halflife-op4-updated

Half-Life: Opposing Force SDK based on Half-Life Updated, with bug fixes. Check README.md for more information.
Other
72 stars 28 forks source link

NPCs ignore pit drones #86

Closed Pandaprewmaster closed 2 years ago

Pandaprewmaster commented 2 years ago

So i have this HECU spawner for half life oppsing force to spawn those marines you leave behind since they cant come with you in vents etc i noticed that NPCs ignore pit drones completely even if the pit drones attack them they will just stare at the pit drone now i need ur skills to edit the friendly grunts including medics and engineers to shoot pit drones maybe also otis

SamVanheer commented 2 years ago

Can you provide a map to test this with?

Pandaprewmaster commented 2 years ago

Can you provide a map to test this with?

How so? Just use a code to spawn a HECU grunt near few pit drones of course make sure to have no target on yourself and press E as soon as possible to activate the grunt AI i can provide u with pics but idk how to do map since im using android or spawn a pit drone near a group of marines or any NPC u want make sure the NPC looks at the pit drone so you can see that the absurdity of the situation

Pandaprewmaster commented 2 years ago

You still there bro? Im counting on you

SamVanheer commented 2 years ago

monster_human_grunt_ally can fight pit drones just fine. It's just that when this NPC is spawned without any keyvalues being set it defaults to having no weapons equipped.

This is intended behavior: https://github.com/SamVanheer/halflife-op4-updated/blob/5cc4c357cd59e568536b25e2ff21003994f5871f/dlls/hgrunt_ally.cpp#L1197-L1201

And it's used in several maps to have grunts that don't have weapons equipped.

You can make grunts use the MP5 by default by adding this code:

if (pev->weapons == 0)
{
    // initialize to original values
    pev->weapons = HGruntAllyWeaponFlag::MP5 | HGruntAllyWeaponFlag::HandGrenade;
}

Right before this chunk of code: https://github.com/SamVanheer/halflife-op4-updated/blob/5cc4c357cd59e568536b25e2ff21003994f5871f/dlls/hgrunt_ally.cpp#L1180-L1201

But note that this will make those grunts have an MP5.

It may be easier to manually set the weapon when spawning them through code. To do that you can create the entity (but don't call Spawn yet), set the weapons keyvalue and then call Spawn.

If you need help figuring this out then you can ask for help in the TWHL Discord server: https://discord.gg/jEw8EqD

Pandaprewmaster commented 2 years ago

Screenshot_20220916_173138_in celest xash3d hl Screenshot_20220916_173125_in celest xash3d hl Screenshot_20220916_173104_in celest xash3d hl

Here take a look these guys have weapons and they dont shoot them i forgot to tell you that i spawn them with weapons yet the same behavior is as seen in these pics they attacked the zombies yet not the pit drones idk maybe its my version but if you can give me the file that makes friendly grunts attack pit drones that be more than enough (:

SamVanheer commented 2 years ago

This project isn't designed to work on Android so that must be somebody else's doing.

Pandaprewmaster commented 2 years ago

Perhaps but im sure the DLL of yours is fine can you plz gimme it? (:

SamVanheer commented 2 years ago

It doesn't work that way. This project only supports Windows and Linux. Android is a completely different environment.

I'm pretty sure the Android version comes from this project: https://github.com/FWGS/hlsdk-portable

Ask them about it.

Pandaprewmaster commented 2 years ago

Screenshot_20220916_173854_ru zdevs zarchiver

I mean this one

Pandaprewmaster commented 2 years ago

Okay thx for help anyway