Jump to content

NPC AI troubles


Evan555alpha

Recommended Posts

Splitting this off in to its own thread, in hopes of more responses.

 

Right, so I've got an NPC, and I want it so that they're human, but they attack enemies of the player the same way that feral ghouls attack, generally lunging towards the enemy. I also want it so that they're spawned in much like how synths are spawned in via the Synth Relay Grenade.

Now, I've got the whole spawning them in part down. That works. What doesn't work is that they won't attack enemies. They'll go in to the fighting stance, and even run up to the enemy, but they won't actually do anything beyond that.

 

The way they're set up, is that their overall race is the DefaultRace, and their Attack Race is FeralGhoulRace. Their Combat style is csFeralGhoul, and their class is Citizen. 

They're set to be part of the PlayerAllyFaction, with a rank of one.

 

I'm stumped as to why they're not attacking properly. Any ideas? Am I doing something wrong?

Spoilered is screenshots of what I think is all relevant NPC pages in the CK.

Spoiler

image.thumb.png.373b5a437631aa53c3469407c70711e0.png

image.thumb.png.f05a44c7a97aa0003fe5e2ad4ea540bb.png

image.thumb.png.427e5fc9d918013212cd7d39da613341.pngimage.thumb.png.12831c8fb430f22397b15dd28d5569d9.png

image.thumb.png.25e88d4a053b9ec34403022aa811d3f3.pngimage.thumb.png.164f9e4119d577c6eff4d712b1edff90.png

image.thumb.png.736592a9e540b16133544daa35bf7908.png

image.thumb.png.8e22253ee80bf15712ca023294bac0a7.png

image.thumb.png.551e78d6a17eb0e47e2f954751002ba7.png

image.thumb.png.a9e39d95839a6619e2925c248a3f2dfe.png

Link to comment

Aren't the ferals using different skeleton than the humans?

Therefore, at the very least, your first problem may be that the attack animations cannot be used with the skeleton/behavior your race is using?

 

How about porting the human body onto the feral skeleton, and using that together with a new race based on feral ghouls race?

I did the same exact thing, except i was porting an Assaultron to the human skeleton, using Max 2014, and it worked perfectly - i even made it bodyslide compatible.

 

EDIT: i forgot to mention, i also used Outfit Studio during the process to copy the bone weights - which was maybe easy, due to the fact that i was porting TO the human skeleton, but you need to do it the other way - human TO something else, and i am not sure how cooperative the Outfit Studio might be in such case (in theory, it should work the same, but i never tried).

You can of course do the weighting in Max, but that is even more out of my expertise - i am no animator nor 3d artist, so i dont know squat about that.

Link to comment
8 hours ago, Roggvir said:

Aren't the ferals using different skeleton than the humans?

That... Isn't something I had considered looking in to. I won't be doing anything in Max, though, as I do all my stuff in blender, or outfit studio. I'll give it a lookover, and see what the results are. Cheers!

Link to comment

Well, i mentioned Max only because that was what i used - of course (or rather "most probably") you can do the same in Blender too.

 

1.) Import the feral ghoul skeleton.

2.) Import (preferably into a different layer, to avoid chaos) the human skeleton with body, hands, head and clothing (if you want any).

3.) Now rotate/scale bones of the human skeleton (the meshes will move/rotate/scale accordingly) to make it fit the feral skeleton in that other layer as best as you can.

4.) Export all those (now adjusted) meshes into a NIF

5.) Launch OutfitStudio, set its skeleton to feral ghoul skeleton, and import the NIF

6.) Copy bone weights or paint as neccessary, save as BS project, build in BS and use that NIF as the ArmorAddon for the body/skin/whatnot.

 

...it should work like this, but maybe someone can correct me if i wrote something wrong, or if there is an easier way.

 

Link to comment
7 hours ago, Evan555alpha said:

I could, but that would require going back to an older version of Blender, so I won't. Bodyslide ought to be enough, considering how alike both skeletons seem to be, proportion wise.

I understand, i just cant help but mention one last thing before i shut up:

The thing about going the Blender way (or max) is, that you could actually make a custom feral ghoul skeleton, with bones moved so it fits the human skeleton.

Then you could just open Outfit Studio, import any human NIF, and use this custom feral skeleton to copy weights (if OS can work with other skeleton, which i believe it should - provided nothing from the human one is hardcoded).

This would have a GREAT advantage in case youd want to convert not only body, but also some clothing items - such conversions could then theoreticaly be just starting OS, importing NIF, loading custom feral skeleton as reference, clicking on copy bone weights, DONE.

Maybe you'd need to fix some clipping here and there, but thats it.

 

The way you seem to be going, is to do everything in OS only - ie. "sculpting" the human body to fit the pose of feral body, so you can use feral skeleton to copy weights, etc.

Such sculpting will be a nightmare to do in OS, and if you want to use some clothing too, you'll have to "sculpt" every clothing like that, using same painfull, time consuming, and in essence very sloppy process.

I think installing that other version of Blender (portable, so it wont mess your precious current install), would be worth avoiding the incredibly huge pain in the ass you are about to endure.

Unless i misunderstood, or you have some genial simple solution that eluded me.

Link to comment
On 2/22/2018 at 9:17 AM, Roggvir said:

Aren't the ferals using different skeleton than the humans?

On 2/22/2018 at 6:04 PM, Evan555alpha said:

That... Isn't something I had considered looking in to. I won't be doing anything in Max, though, as I do all my stuff in blender, or outfit studio. I'll give it a lookover, and see what the results are. Cheers!

Welp, you were right. Simply going back and changing their race to the FeralGhoulRace was enough to fix that. However, because I didn't reweight their bodies, they ended up being invisible. Regardless, testing in QASmoke using a spawned in raider showed that they do indeed attack now, presumably with their respective animations.

 

What this means is, I'll be reweighting their bodies at some point.

 

Now, on to less of an issue, but more of an "I don't know how to do this" situation: I want these summoned NPCs to follow the player. Would making that possible be as simple as adding the "FollowPlayer" AI package, or is there more to it?

Link to comment
1 hour ago, Evan555alpha said:

Now, on to less of an issue, but more of an "I don't know how to do this" situation: I want these summoned NPCs to follow the player. Would making that possible be as simple as adding the "FollowPlayer" AI package, or is there more to it?

Well, almost, but not really. Actually, not at all :smile:

You want to make your own version of the FollowPlayer package, because the original is meant for followers.

Its functionality is tied to the follower quest, from which it uses some variables in some of its conditions, and it contains sandboxing and waiting procedures that you definitely do not want.

In general, it probably wouldn't work.

 

So, make a new package.

Take a look at "BoS100Fight_GhoulCharge" package - i believe it is the package used by those ferals attacking Paladin Danse as part of the "Fire Support" quest, and i'd say you basically want the same exact thing.

It contains only a single Travel procedure, so i guess that is all you need - once those NPC get close enough, they start attacking, so you might not even need a Follow procedure there (you can add it after the Travel proc just in case, but i'd test without it first).

 

Once you have the package, make some quest (i guess you already have it, so use whatever you have), add a Reference Collection Alias to that quest, and add your created package to this RefCollection Alias (in case you didn't know, it's like an Alias, except it contains a "collection" of all NPCs you put in it, who will be using any packages/spells/inventory/whatever you set on that RefColAlias).

When you spawn those "creatures" of yours, just add them into this RefCollectionAlias, and they will start using that package.

If they die, i think the game should remove them from the collection automatically if the collection doesn't have the "allow dead" flag checked (if i am mistaken, then you can attach a script to this collection, where you handle removing deadders using an OnDead event handler).

...all i want to say - the RefCollectionAlias should make things a LOT easier for you (compared to the old ways of using one alias for each spawned creature and maintaining that alone was super shitty, or trying to store the actor references in some array, etc. - my hairs stands up just when i think about it).

 

That being said, since you are creating new NPCs, you can probably just give them that package right away in the CK, and then you might not need that collection.

You just make them spawn, and they will already have that package.

But you probably still want to keep track of them, so you know how many of them are alive at any point, maybe making sure you do not have more than N of them chasing the player, etc. - for that, you still can (and SHOULD) use some Reference Collection like i mentioned (except now without having to attach the package to it).

 

 

Link to comment
8 hours ago, Roggvir said:

snip

I uh, wow. Okay. A lot of this is going over my head, to be honest. I haven't made any quests or anything, all scripts so far are tied to perks and magic effects/spells. Hell, the spawning system is literally a copy of the Synth Relay Grenade, but with changes assets/NPCs.

 

What kind of quest do I need to make? How would I add them to the RefColAlias when they're spawned? I've never dealt with the AI or Quest parts of the CK before.

 

I really do appreciate the help. Cheers.

Link to comment

Hmm, maybe you should describe the whole thing in more detail - how exactly you want it to work, when, why, etc., because without knowing more, it is hard to decide what would be the best approach, and i want to make sure i am not pushing you into something you dont really need (ie. if grenades work, you dont need a quest - but i think you are using those grenades as temporary means, because you weren't sure how else to do it?).

 

Don't worry, it is simple.

The quest in this case, should be used as a means to start some script, which will be handling the spawning based on some conditions, rules - maybe you want to spawn the creatures when player enters some area, or maybe you want to trigger it after player does something, or maybe you want to do it at random times - all that and more can be sone by using a "quest" to start a script which will serve as some kind of main controller for the whole thing.

This way you will not need any magic effect scripts.

But i need to know more about how you want it to work, then we can think about the best way how to do it.

Link to comment
1 hour ago, Roggvir said:

-snip-

Nope, the grenades are exactly how I want it to work. All intended. The 'nades are given to the player once some conditions have been met, though, namely perks and scripts related to said perks.

 

All it should be is that, when the NPC is spawned in, they follow the player around until they happen to die in combat. Said NPC is supposed to fight the same way a feral ghoul does, but at the player's "command", so to speak. 

 

Speaking of combat, using some stand-in assets that were hastily reweighted to the ghoul skeleton, I've managed to see that, yes, they do now fight. However, it's just the bog-standard melee punch throwing, rather than the ghoul diving that I was hoping for. Don't really need any help with this at the moment here, just figured I'd note it. I'll be looking in to it more soon.

Link to comment
14 hours ago, Evan555alpha said:

...

Aha, so i had everything wrong :-D

You do not want them to follow player as in "chase the player and attack him", but you want them to follow player so they can help - to attack player's enemies.

Grenades are intentional, and not as a temporary solution - so, forget about the quest script, now its obvious you dont need that.

 

You have pretty much everything figured out i'd say.

Except maybe you will need to revisit the package for controlling those creatures - the package i described the last time, was meant for creatures attacking the player, and so it will need some changes.

Most importantly, you do need to add that Follow procedure now.

But now i also understand why you decided to try the original Follower package.

 

Is it enough if the creatures just blindly follow the player and automatically attack enemy entities? or do you actually want them to behave like true followers, or at least so player can command them?

If you want them to follow, and maybe only allow player to command them to attack things, then that simplistic follow package should suffice, and the commanding can be scripted (you just need something to set the "commanding state").

But if you want them as true followers, you will need to make your version of that Follower package (like you were trying to do when i barged in and started to mislead you :)), and probably also of some related quest (serving as a source for some variables that package might need).

 

LOL, i didn't help you at all :-D sorry

Link to comment
7 hours ago, Roggvir said:

Is it enough if the creatures just blindly follow the player and automatically attack enemy entities? or do you actually want them to behave like true followers, or at least so player can command them?

Yep. That's all there is to it. They're not true followers, just (temporarily, as in, until they die) summon-able helpers. I think the closest equivalent would be the various Antronachs from Skyrim, but just not time limited.

Link to comment

Tangentially related, as it's a very similar NPC, but not an AI issue, and not something worth creating another thread for:

 

An actual human NPC this time, that's equipped with a modified alien blaster and such. Their AI is fine.

I've got it so that this human NPC is meant to use a Skin, the dropdown that's located under the traits tab. I've got the skin set, but for the life of me, I just cannot get said skin to apply to the NPC in game. the models referenced by the ArmorAddons unique to this skin exist, and those ArmorAddons are referenced by the "armor" which is the skin, and the skin is referenced by the NPC, but for whatever reason, it just won't apply.

 

The only reason I can think of for this to happen is due to how these NPCs are teleported in, just like the ones talked about above.

Any ideas on why this might be happening, and/or how to fix it?

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use