Jump to content

two npc conversation infinite loops


davidlallen

Recommended Posts

I have previously created conversations between two NPC's that work fine. I create a dialog package on one NPC and use addscriptpackage to start it; then I create say four conversation topics which are linked using the link from / link to fields, switching from one NPC to the other. Today I have created a conversation that appears to infinite loop. After getting to the fourth topic, the two NPCs start over from the first topic again and keep going as long as I care to listen. I have tried several things to get them to stop.

 

1. There is no reason to repeat at all; my other conversations have not repeated.

 

2. I added a quest stage, with "setstage <quest> <stage>" in the result script of the final line; and a condition on the package, "if <quest> <stage> == 0". This should prevent the package from running again, but it does not.

 

3. I checked the checkbox, "Once per day" on the dialog package. This is a more desperate hack, but it does not prevent the package from triggering again either.

 

What could be going wrong to make this conversation repeat itself?

Link to comment
Share on other sites

1. Are you testing with a clean save? Where is that AddScriptPackage added?

 

2. If you had a bit of scripting leading up to the addscriptpackage that had the conditions in that you wanted it would control when the package would trigger. I find scripting > conditions when managing addscriptpackage.

Link to comment
Share on other sites

It is a clean save before I have gone anywhere near the mod location.

 

Here are the steps just before the conversation. The player is discussing with NPC1, while NPC2 (a companion) is present. NPC1 gives a line, and the after-result script for the topic does "NPC1.addscriptpackage mypkg". Mypkg is a dialog package with NPC2 as the target, and mytopic as the topic. Mytopic is a linked conversation of four lines (NPC1, NPC2, NPC1, NPC2). The fourth line does "setstage myquest n". Mypkg has a condition which is "if getstagedone myquest n == 0" so it should be prevented from running again.

 

I don't see any opportunity to put another script in here. I had previously tried "NPC1.startconversation NPC2 mytopic" in the after-result script of the trigger line; but that had no effect at all.

 

Does this trigger any suggestions about what I should try? Similar packages in my first mod worked fine, and I cannot see any difference between the working ones and the "infinite loop" broken one.

Edited by davidlallen
Link to comment
Share on other sites

Does the result script of the setstage n, do an NPC1.evp? And does NPC1 have a default package to fall back on when the dialog package is no longer valid?
Link to comment
Share on other sites

Thanks for the suggestions. The problem seems to be something else, at any rate after many hours of beating my head against the wall with different things, I found one way to make the conversation stop looping. The conversation is triggered by an "addscriptpackage". At the end of the conversation I put "removescriptpackage" and now it stops.

 

The target NPC is actually a creature, a supermutant. I suppose it is possible that there is some bug in package evaluation which affects creatures differently from NPCs, but that is the only difference I can think of.

 

On to the next problem. Are we having fun yet?

Link to comment
Share on other sites

I had a problem with one of my addscriptpackages (well, four of them, but one type; it wouldn't complete and let my NPC go back onto her follow package) in my mod and I finally had to use removescriptpackage as well. I was also :wallbash: I've never had that problem with addscriptpackage before and I haven't had it with any other instance of addscriptpackage in the mod again. those four packages were on a NPC as are the rest of my addscriptpackages. Go figure. And yes, it is a barrel of fun working with packages. It always is. :tongue:
Link to comment
Share on other sites

AddScriptPackage will run until completion overriding any and all AI that npc currently has running. If the scripted package in question has no termination condition and/or lacks a RemoveScriptPackage... you'll get an infinite AI loop as you described. I always make sure that my scripted ai packages always contain some form of fall-through completion in addition to my planned completions. Usually a timer in addition to standard state checking. If all else fails, once the timer reaches a value I consider to mean that the AI has been running for way too long, I kill it.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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