Jump to content

Any way to force NPCs in cover to crouch before reloading?


trashgarbage666

Recommended Posts

Going into this post, I'm aware this one might be a little too specific to solve easily. But I still wanted to put it out there, just on the off-chance someone knows something I don't!

 

I've been tinkering around with Combat Styles lately, and managed to piece together a ranged combat style that's pretty good at popping in and out of cover. Though I couldn't help but notice how NPCs like to stand when they're reloading their gun. It makes them easy targets, and kind of negates all that time they spent carefully hiding behind cover. My goal is to get NPCs firing their gun from cover to crouch back into full cover before reloading their gun.

 

I've seen NPCs reload while crouched before, so at least I know that part's possible. I wish I could say "I've already tried X, and can confirm it didn't work", but I'm actually completely in the dark on where to start! So any suggestions at all would be amazing, haha.

 

Thanks!

Link to comment
Share on other sites

Just a suggestion, but the ones who are standing to reload: do they even have a crouched reload animation for whatever weapon they are using? That (available 3rd person animations) would seem to be dictating if they can or not. (See 'TIP: Animation Summary' under "Animation" section of the wiki "Getting started creating mods using GECK" article.)

 

Always good to hear someone is working on better AI.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

So is this for any ranged npc anywhere anytime in the game. Or do you have a few specific combat scenes you are wanting to adjust this for ?

 

Because I think making them always crouch to reload might not be to hard. But to find cover to crouch behind and reload ... will of course matter if there has been cover drawn on the navmesh.

 

All the kf crouching reload animations , start with "Sneak" and are in a "Reload" anim group.

So removing all the reload that don't start with sneak ... seems it will leave them with only the crouching ones. But it may just make them not be able to reload unless their combat style had them crouching in cover already ... not sure how the call to reload really works with that.

 

With the package ... "Use Weapon" there is a flag for "Crouch to reload"

 

Also seems you could have them running a script that detects when they need to reload , then either set a package that would make them find cover and crouch to reload ? Or specifically tell them what to do in the script ?

 

But of course those are not going to be viable for a full game scenario ... just specific combat scenes.

 

There is 2 game settings that might do something for you ... But have a look at all the ones filtering with just "cover"

 

fCoverFiringReloadClipPercent

&

fCoverWaitReloadClipPercent

 

But still crouching behind cover depends if it is present on the navmesh , not just objects to stop bullets.

 

By the way ... what did you come up with for adjustments on their combat style that you liked their find cover behavior ?

Edited by Mktavish
Link to comment
Share on other sites

This looks useful:

https://geckwiki.com/index.php/IsAnimPlayingEx

 

Theoretically, you could use

https://geckwiki.com/index.php/LoopGroup

 

or

 

https://geckwiki.com/index.php/SetForceSneak

 

but I have my doubts that it will work. No reason not to try, though.

 

Did you see that I found the function you needed for knocked out NPCs? I answered you in that thread but you're not following it I realised. That function needs to be babied a bit, so read the documentation.

Edited by EPDGaffney
Link to comment
Share on other sites

Hey guys!! Sorry for the huge delayed response. Just got a little busy is all. So!

 

Just a suggestion, but the ones who are standing to reload: do they even have a crouched reload animation for whatever weapon they are using? That (available 3rd person animations) would seem to be dictating if they can or not. (See 'TIP: Animation Summary' under "Animation" section of the wiki "Getting started creating mods using GECK" article.)

 

Always good to hear someone is working on better AI.

 

-Dubious-

 

I'd be really surprised if that were the case! While I don't have any proof, I feel like I've occasionally seen NPCs reload while crouched. And I replay New Vegas to completion once every two years or so! But then again, getting more involved in modding has shown me that I had a lot of misconceptions about the game's inner workings. So it could go either way. I'll be sure to give that article a read, and try to get to the bottom of this! Thanks! :D

 

So is this for any ranged npc anywhere anytime in the game. Or do you have a few specific combat scenes you are wanting to adjust this for ?

 

Because I think making them always crouch to reload might not be to hard. But to find cover to crouch behind and reload ... will of course matter if there has been cover drawn on the navmesh.

 

All the kf crouching reload animations , start with "Sneak" and are in a "Reload" anim group.

So removing all the reload that don't start with sneak ... seems it will leave them with only the crouching ones. But it may just make them not be able to reload unless their combat style had them crouching in cover already ... not sure how the call to reload really works with that.

 

With the package ... "Use Weapon" there is a flag for "Crouch to reload"

 

Also seems you could have them running a script that detects when they need to reload , then either set a package that would make them find cover and crouch to reload ? Or specifically tell them what to do in the script ?

 

But of course those are not going to be viable for a full game scenario ... just specific combat scenes.

 

There is 2 game settings that might do something for you ... But have a look at all the ones filtering with just "cover"

 

fCoverFiringReloadClipPercent

&

fCoverWaitReloadClipPercent

 

But still crouching behind cover depends if it is present on the navmesh , not just objects to stop bullets.

 

By the way ... what did you come up with for adjustments on their combat style that you liked their find cover behavior ?

 

Sorry for not specifying! I'm trying to change general combat behavior for all NPCs, not just a specific scene.

 

I was actually tinkering with those two fCover settings right before posting this! They seem to control when an NPC thinks it's time to reload, based on the remaining percentage of bullets in their clip. Changing those values around can force them to reload after each shot, or only when they're completely out of ammo.

 

After reading what you said about navmeshes, I decided to read up on how they impact NPC behavior. I had no idea objects had to be designated as cover in the editor before an NPC can hide behind it! I've always thought they just decide what to hide behind in real time, based on the situation. But nope! So I loaded up Goodsprings to see what its navmesh looked like, and found almost no helpful cover at all. Which would explain why characters tend to stand out in the open during firefights. I spent the rest of the day editing the navmesh to feature more accurate cover, and the results so far have been amazing! I keep replaying the Goodsprings vs. Powdergangers fight just to see how it all plays out. Giving the NPCs access to better cover has really helped make the fights feel more engaging!

 

But you asked what adjustments I made to their combat style! Not too many, honestly. But I'm constantly tweaking things as I go. Here's what I have currently:

 

In the "Simple" tab, under "Cover Behavior"

Cover Search Radius - 2048

Take Cover Chance - 100

Wait Timer Min - 5 (how long they stay behind cover before peeking out)

Wait Timer Max - 25

Wait to Fire Min - 5 (how long they're willing to search for targets while peeking out)

Wait to Fire Max - 10

Fire Timer Min - 1 (how long they fire their weapon once they find a target)

Fire Timer Max - 5

 

I recently got headshots working, which is why I have the Wait Timer Min so low, and the Max so high. It makes it much harder to predict when someone will pop out from cover and try to blow your face off. Makes combat a lot more intense!

 

Some relevant Game Settings I also changed:

 

fCoverEvaluationLastSeenExpireTime - 0.5 (Was originally 7.5. Based on results, I think this is how often an NPC evaluates if they're in good cover relative to their opponent or not.)

fTargetMovedCoveredMoveRepathLength - 1024 (Can't remember the original value. I'm not ...exactly sure what this one does??)

fCoveredAdvanceMinAdvanceDistanceMin - 256 (Currently at original value. Still figuring out what this one does as well.)

fCoveredAdvanceMinAdvanceDistanceMax - 512 (Same as above.)

fCombatThreatRatioUpdateTime - 3.0 (Was originally 7.5. I think this one's how often they evaluate their odds of survival. However, lowering it by a lot seems to make them terrified of fighting.)

 

If you have any suggestions on changes I should make, I'll gladly give them a try!

 

This looks useful:

https://geckwiki.com/index.php/IsAnimPlayingEx

 

Theoretically, you could use

https://geckwiki.com/index.php/LoopGroup

 

or

 

https://geckwiki.com/index.php/SetForceSneak

 

but I have my doubts that it will work. No reason not to try, though.

 

Did you see that I found the function you needed for knocked out NPCs? I answered you in that thread but you're not following it I realised. That function needs to be babied a bit, so read the documentation.

 

I'll be sure to give these a try!

 

I actually didn't see your post until you mentioned it! And yeah, you're not kidding about SetUnconscious needing constant adult supervision. It's a very fickle setting, but I think it might just be the solution to that problem. The trick is in figuring out how to implement it correctly. It really, really hates being used on an NPC with less than zero Fatigue, which is ...a little confusing. To say the least, haha.

 

Also! Just wanted to say thanks for suggesting I switch to JIP NVSE. It's made scripting in GECK so much easier!

Edited by punchbattle
Link to comment
Share on other sites

SetUnconscious is fairly strange, yeah. I don't remember the exact parameters but I somehow got an NPC to start walking about with no head using that function. And he tried to say his lines but there was no sound, which was really weird. It had the subtitles for it but the game somehow knew he had no mouth to produce the words and it was silent. I thought I just hadn't given him a voice as he's normally dead anyway in my mod, but I tested and he can speak just fine upon resurrection (provided you leave his head intact).

 

I like the sound of that Goodsprings fight.

 

There is probably some way to do this crouching thing, but it's probably none of what we've come up with. There are JIP functions to replace files if I recall. It's a little weird but in an extreme scenario, you could have a back-up of the idle pose as well as a copy of the sneak pose, and then do some renaming via JIP as a fight is in progress. This is of course not something I'm recommending, at least not without a lot of tests, but it's a thing that could happen if you wanted.

 

Actually, I'll leave that there as it's a bit interesting, but that would make every single person crouch simultaneously if it worked, and yet it may have the animations cached anyway and thus not work after all.

 

Yes, JIP is probably the difference between my perseverance and my giving up on my mod. The Obsidian Conversation Editor once had that honour but I'm doing far more scripting of late than dialogue.

Link to comment
Share on other sites

As a vague thought experiment script ...

Have the player running a script , to get combat targets , then transfer that to combat group.

Which then gets their current weapons , and checks the clip percent.

And at said time ... gives them a package of "Use Weapon" which is flagged with "Crouch to Reload"

Then remove the package. ???

 

But still , reworking a lot of navmesh with better cover , may give you what you want. Since crouching to reload isn't really giving you what you wanted.

 

Would be a bit of a long tedious process ... and then package it as an .esm to load last amongst the masters. Would make it a stand alone and not mix it up with other mod additions / changes.

Except maybe just some game setting tweaks with it.

 

So your headshot scripting is working good now ?

 

Add edit: Oh and my mention of removing all the reload animations that don't start with sneak from the archives. I guess I will go ahead and guinea pig that ... since it may involve messing up an install. Which I was planning on purging all my tinkering with a fresh install anyways. Will let ya know ... at least for some curiosity curbing if nothing else.

 

Another edit : Well that didn't work of course . Atleast just unpacking the "Fallout - Meshes.bsa" Deleting all the reloads except the sneaks. Then repackaging.

Crashes the game ... but looking in geck. The npc's now only are showing about 15 -20ish animations. Which looks to be the ones listed before the first group of "1hpreload's" I deleted. So it's like it won't read past my deletion point in the list.

 

Oh well didn't really expect it to work anyways ... but was easy enough to just drop the original BSA back in to get it working again.

Edited by Mktavish
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...