NPC AI packages have got me stumped..

Post » Tue Jun 19, 2012 11:46 pm

Hello all,

I've been trying to get to the bottom of this for many days now with varying success. My NPCs are fairly erratic in their packages.

I have 5 NPCs and they are originally supposed to stand about in their editor location. After a successful scene in which one of the actors attacks the player (through a package in the scene). This works without issues. The player is then required to talk to the other NPCs and tell them to perform a task. In dialogue I'm able to set the stage of their respective quests to stage 5.

First: I had the AI packages to the base NPCs with the condition that said quest had to have a stage of at least five. Testing it with a clean save, the NPCs were already performing their tasks - ignoring the condition. They have no other AI packages.

Instead I made each NPC an alias in their own quest. I gave the AI packages to the alias - without any conditions. In dialogue, I start their respective quests with the intention that they will begin to execute their AI package. They do not, they just stand about. I've even tried using the "actoralias.evaluatepackage()" on stage 0 (and stage 5, which it is immediately switched to). Using debug messages, I can verify that their quests begin and the stages are appropriately set. But 3 of the NPCs refuse to move anywhere. One is supposed to use a woodchopping furniture, the other has a single farming idle marker package, the third is a simple patrol to an xmarker.

Oddly enough, the fourth npc - a hunting package, is found immediately performing his package assigned to his alias before his quest is even started. None of the NPCs have any other AI packages other than what's given to their alias in their quest.

I can wait 24 hours in game and only one of the NPCs will begin to somewhat erratically follow his package. Two will still not move.


All I really want to do is just make the NPCs perform their AI packages immediately after talking to the player
User avatar
Emily abigail Villarreal
 
Posts: 3433
Joined: Mon Aug 27, 2007 9:38 am

Post » Tue Jun 19, 2012 4:03 pm

You can add Papyrus fragments to a package that run when the package starts and ends--have you tried that, to see if/when the NPCs actually get assigned your packages? If the packages start, then you'd know that the problem is in the logic of your procedures (maybe post a link to screenshots of the packages in that case). If the packages don't start, then there's some other problem...
User avatar
tegan fiamengo
 
Posts: 3455
Joined: Mon Jan 29, 2007 9:53 am

Post » Tue Jun 19, 2012 11:39 pm

Yes I have debug messages on the start and end of one of the packages, never fires. The package never initiates. I can post up screenshots.

I don't know why though, it's just a UseIdleMarker - assigned to a 'IdleFarmingMarker' in a named cell. The only flags set are the default interrupt flags. No conditions set, schedule is default (Hour: 0, Duration 0.0000) -> Which I'm assume means perform for infinity, right?

Console command using EVP doesn't affect anything. Console command "GetCurrentAIPackage" returns something along the lines of -1. The same command on the NPC visibly patrolling her xmarkers (the test NPC not assigned to any quest) returns -1 as well.
User avatar
Marine Arrègle
 
Posts: 3423
Joined: Sat Mar 24, 2007 5:19 am

Post » Tue Jun 19, 2012 8:10 pm

If the debug messages never fire then let's assume for now that the packages themselves are okay.

These are NPCs that you created yourself, yes? So there's no chance that there is another quest with a higher priority taking precedence (and anyway you said they had no other packages to follow). I suppose you could try setting the priority on their alias quests up to 99 or something, just to be sure.

Hmm...

Could they still be "in combat" somehow, since there was a fight beforehand? And thus governed by a combat package?
User avatar
Scott Clemmons
 
Posts: 3333
Joined: Sun Sep 16, 2007 5:35 pm

Post » Wed Jun 20, 2012 12:56 am

Yes, they are NPCs I've made. They are involved in earlier quests - but their dialogue in the current quest has no issues executing, and I've unloaded the alias referencing them in the previous quests. I am not sure if an NPC can be an actor alias in multiple quests but I've set a condition on the alias tab of the previous quests to "If CurrentQuest IsRunning == 0" so I'm assuming, or hoping, that will limit them to alias of the previous quest as long as the current quest isn't running.

You know what... There is combat because one of the NPCs attacks the player. The actors have "NONE" for all the Default Package list, Spectator Override, CombatOverride Package List and Observe Dead Body package list etc - but he does occasionally do the regular sandbox thing around the NPC that the PC kills.

How can I clear the in combat package if they're automatically given one?
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Tue Jun 19, 2012 4:27 pm

there's a flag (tab in the Package create form) called "No Combat Alert" (I've no idea what is does) ... It's not checked by default ... Does setting that work for you?
User avatar
chloe hampson
 
Posts: 3493
Joined: Sun Jun 25, 2006 12:15 pm

Post » Wed Jun 20, 2012 2:49 am

They are involved in earlier quests - but their dialogue in the current quest has no issues executing, and I've unloaded the alias referencing them in the previous quests. I am not sure if an NPC can be an actor alias in multiple quests but I've set a condition on the alias tab of the previous quests to "If CurrentQuest IsRunning == 0" so I'm assuming, or hoping, that will limit them to alias of the previous quest as long as the current quest isn't running.
This might be something...I haven't fiddled with these features too much myself, but there are those "reserves reference" and "allow reserved" checkboxes at the top of the Reference Alias screen. For the aliases tied to the quests with the packages you're trying to overlay, it wouldn't hurt to make sure "allow reserved" is checked, in case the earlier quest had reserved them. And add some debugging messages to make sure the quest aliases are being properly filled by the NPCs.

(In case you ever need to, BTW, yes, an NPC can be an alias in multiple concurrent quests; I do that in my mod and it works okay.)

I don't know about the combat thing...that really should clear itself, although maybe it doesn't because there is no other package to switch to? Really I'm just thinking out loud on that, though. Most likely, they are out of combat and the issue is elsewhere.
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Wed Jun 20, 2012 1:06 am

there's a flag (tab in the Package create form) called "No Combat Alert" (I've no idea what is does) ... It's not checked by default ... Does setting that work for you?

The No Combat Alert flag makes the NPC launch immediately into combat if necessary, instead of doing warnings or anything.

The Ignore Combat flag is the one that makes them never ever get into combat.
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Tue Jun 19, 2012 10:44 pm

The No Combat Alert flag makes the NPC launch immediately into combat if necessary, instead of doing warnings or anything.

The Ignore Combat flag is the one that makes them never ever get into combat.
:biggrin: Is that the only logically named thing in the entire CK?!
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Tue Jun 19, 2012 6:41 pm

This might be something...I haven't fiddled with these features too much myself, but there are those "reserves reference" and "allow reserved" checkboxes at the top of the Reference Alias screen. For the aliases tied to the quests with the packages you're trying to overlay, it wouldn't hurt to make sure "allow reserved" is checked, in case the earlier quest had reserved them. And add some debugging messages to make sure the quest aliases are being properly filled by the NPCs.

(In case you ever need to, BTW, yes, an NPC can be an alias in multiple concurrent quests; I do that in my mod and it works okay.)

I don't know about the combat thing...that really should clear itself, although maybe it doesn't because there is no other package to switch to? Really I'm just thinking out loud on that, though. Most likely, they are out of combat and the issue is elsewhere.

I have fiddled with the reserves reference flag to no avail. The CK wiki isn't quite clear about these flags - at least it confuses me. But I think I missed the "Allow Reserved" flag and that might be the key thing here. I know that the alias are being filled because the alias have lines to say and they've no problem speaking it.

The No Combat Alert flag makes the NPC launch immediately into combat if necessary, instead of doing warnings or anything.

The Ignore Combat flag is the one that makes them never ever get into combat.

I'll set this flag too.

What is really confusing is that even using the same method on each of the four NPCs all three act quite different. The one NPC begins executing his package given to his alias in the quest that hasn't begun yet! (Start Game Enabled is not checked). I start that quest via dialogue, and I've even set up debug messageboxs to prove it.

I'm obviously doing something wrong! Later today when I've the chance I'll try that allow reserved flag DreamKing mentioned - checking the wiki I'm positive this will solve some of the problems... We'll just wait and see. Thanks for the help I'll post again with results


EDIT: I checked the flag "Allow Reserved" on each of the alias of the current quests who aren't performing their package - no change. I'm wondering if it's a savegame problem even though I'm loading a different character from before the mod was ever activated. I'm going to make a new game and test her out.

EDIT2: The "Ignore Combat" flag is checked but it is in the AI package. The problem is that the AI package doesn't start.

I think I've solved it and if this is the case I'm going to facepalm myself into tomorrow.. Testing now.
User avatar
Kelly Upshall
 
Posts: 3475
Joined: Sat Oct 28, 2006 6:26 pm

Post » Tue Jun 19, 2012 11:11 am

Update: It's kind of sort of working. One of the debug statements shows that one of the NPCs is indeed starting their package - yet they won't actually start their package until the player waits 24 hours - even if I use npcalias.EvaluatePackage() at each stage that the quest updates. (TryToEvaluatePackage() says it's for alias, but for some reason it won't compile).

The other NPC has a very similar package and the setup is nearly identical, but he won't begin to execute his package. The debug script on package start will not fire.

Thirdly, the last NPC who was executing his package no matter what - this is very odd. He has no alias package, nor any package associated to his editor id. Why is he patrolling when there's no package to tell him to? It's because his linked ref is an xmarker and he'll automatically patrol the xmarker. But why? He has no package and is not inheriting any stats from any other template. He has no default package list and no overrides. He doesn't even have an ActorBase template.

This was tested on a new game start.
User avatar
Dale Johnson
 
Posts: 3352
Joined: Fri Aug 10, 2007 5:24 am

Post » Tue Jun 19, 2012 8:26 pm

Okay so I'm moving at a snails pace here.

Two of the NPCs are starting their packages - meaning the debug script appears when their quests (that they are the sole alias in) starts. The debug script is on the alias' packages at the start. So they are beginning their packages, but they won't move - even after 24 hours. The third and fourth NPC still won't begin their package even tho they're done almost identically.

To get it working thus far here's what I've done. I've ensured that the priority of the quests with packages are higher than any of the others. (90, vs 60). They are started via dialogue.

1. Alias has a Unique Actor fill type assigned to said actor.
2. Only the Allow Reserved flag is checked. The alias are used in prior quests (in dialogue and scenes successfully including packages in the scene).
3. Each alias has one package assigned.
4. The packages are all simple Patrol packages. No Owner Quest, singleRef assigned to an xmarker (or idle marker).
5. Only "Ignore Combat" set, no conditions, no schedule set. Lastly, debug messagebox set on the package start.

So with this, two of the NPCs will 'start' their package but won't actually perform it. I doubt it's the navmesh issue because I have a test NPC patrolling the area. (Just a back and forth patrol via linked ref on editor ID - not alias).
Two of the NPCs won't even start their package, yet their corresponding quests start normally with the rest. This is verified via debug messagebox.
User avatar
Davorah Katz
 
Posts: 3468
Joined: Fri Dec 22, 2006 12:57 pm

Post » Tue Jun 19, 2012 10:49 pm

Might be time to post screenshots, if you can. I personally haven't used patrol packages yet, but another set of eyes and all that, and maybe someone else can help.

Do you have any debugging code that fires when the packages end?
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Tue Jun 19, 2012 3:09 pm

Here are the pictures.

Spoiler

Navmesh: The four NPCs are there, and the player is spawn just below the Xmarker at the bottom. The furthest left xmarkerheading is part of the testNPC's patrol route (her editor location is two cells northeast of everyone here.
[img]http://a7.sphotos.ak.fbcdn.net/hphotos-ak-ash4/430674_10150590928169405_506814404_9030532_2002025645_n.jpg[/img]


With all the "Sneak Flag" checked on the AI packages, as testing that only two are demonstrating it properly. These ones had their debug script successfully fire on package begin. But still won't move to their target. The other two won't begin their packages, despite being almost identical.
[img]http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/419093_10150590927044405_506814404_9030521_814257426_n.jpg[/img]

The farthest left NPC is moving but her patrol AI package is given directly to the base NPC unit. This proves that the navmesh should be working.
[img]http://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/429015_10150590926999405_506814404_9030520_1870133856_n.jpg[/img]


Here is harf's alias. He's one who won't begin his AI package.
[img]http://a5.sphotos.ak.fbcdn.net/hphotos-ak-ash4/426276_10150590953229405_506814404_9030635_1994070014_n.jpg[/img]

And his AI Package [img]http://a8.sphotos.ak.fbcdn.net/hphotos-ak-ash4/426188_10150590958909405_506814404_9030647_1732402626_n.jpg[/img]


Here is Swims's alias (Her package begins but doesn't execute)
[img]http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/429668_10150590959119405_506814404_9030650_1970844683_n.jpg[/img]

And her package
[img]http://a2.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/423522_10150590959194405_506814404_9030652_1832908717_n.jpg[/img]

Here is both packages flags view. The one on the left isn't working (begin package debug message won't fire as it does with the others), Swims package on the right is working. The Allow swimming, always sneak (for testing shown before) and ignore combat is checked.
[img]http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/430112_10150590959029405_506814404_9030648_1500090065_n.jpg[/img]


EDIT, just let me know if I should post up any other shots or pages.

EDIT2:
I've concluded that the Navmesh bug is indeed playing a part in this problem of mine. Upon testing it again, the testNPC won't budge as before, and neither will the two others whose packages do start. Harf and Lothrar are the two NPCs whose packages still inexplicably refuse to begin.

The player arrives there via a moveto command, and is teleported to the same cell as the four. I believe that the reason the test NPC is intermittent in working is because she is initially in a separate cell than the player is moved to. She walks into the cell no problem, but if she happens to be there just as the player is teleported she gets stuck among the others in the navmesh bug.

Still doesn't explain why the two NPCs (Harf and Lothrar) won't begin their packages though.
User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm


Return to V - Skyrim