Jump to content

AI package/scripting help?


Broken_Code

Recommended Posts

Hello,

 

I need some help with the AI on my new mod. Basically what happens is this:

 

Player meets NPC, NPC follows player to inn, that part is all-good. What I'm having trouble with is stopping the NPC from following the player once he's at the inn.

 

So far I've used AI packages with a condition variable (which is set to 1 when the player enters the inn) then I re-evaluste the NPC's AI using NPC.evp in a script.

 

However, weather the NPC stops following the player or not seems a bit arbitrary, some times he does, sometimes he doesn't. Any ideas what it could be, or a better way of doing it?

 

Thanks,

Broken_Code

Link to comment
Share on other sites

The documentation on AI packages is very very poor. Half of the conditions do not work. Many of the conditions work on a random basis and cannot be trusted. If you find conditions behaving this way, you should stop using them for this particular purpose.

 

Evp does not work. It is reputed to work, but in all the specific instances I try to use it in, it does not work. Of course if you couple it with a condition that does not work, then it is wrong to blame evp.

 

The most powerful trigger I have found is SetStage.

 

What I would do is make a quest and have a trigger which changes the SetStage of the quest when the NPC reaches the inn. Have the NPC only follow during the lower stage number, and put a condition on a wander package or whatever that uses the higher SetStage number which has been triggered by something at the inn. This other package will get the NPC doing something besides following.

 

It is rather elementary, and I imagine you are doing already it, but there must be some other AI package besides follow available. If an NPC has only one AI package, which is follow, he will always follow no matter how many conditions you place on it telling him not to follow. He will disregard all your conditions.

 

You might also find it helpful to observe the order in the list of AI packages. The ones on the top of the list win and get executed. So lets say you have two packages that can occur at any time with no conditions. Eat and Sleep, Eat at the top of the list. Your NPC will probably always eat, and very seldom sleep if ever.

 

I hope this helps.

Link to comment
Share on other sites

It is entirely possible that I only attempt evp when the cause is lost because the conditions do not work in the situations I am trying to use them for. Since the conditions cannot possible work (although the documentation fails to mention this) the code with evp does not work, and it is not the fault of this highly-regarded command. Sometime if I am really bored, I will have to devise some experiments to prove that evp works.
Link to comment
Share on other sites

Yes, I've got packages that make him follow, wait, drink(at the inn), sleep(at the inn) and wander(at the inn), all et up correctly.

 

After some experimentation I managed to get it working just by changing when evp was called.

 

Which leads me to the conclusion that my script and AI packages did work, however, to re-evaluate a NPC's packages using evp it needs to be used in a different frame to adding any packages or changing a variable associated with any of the NPC's packages.

 

Does my conclusion make sense, or is it just coincidental?

 

Thanks,

Broken_Code

Link to comment
Share on other sites

Does my conclusion make sense, or is it just coincidental?

Yep, which is why using script variables as a sole means of controlling a package usually doesn't work too well if you want an action to be performed here and now.

 

You might get better luck with this package by having another condition:

no getincell {Inn cell} == 0

 

This should force the package to stop immediately upon entering the cell.

 

 

Other alternatives to script variables are things like dispositions, faction ranks, and any other condition which does not require reading of some script. With packaging, if any of the AND conditions are not present, the package will not be used.

Link to comment
Share on other sites

Yes, I see, but later, when you come back to see this NPC you ask him to follow you (while he's still in the inn's cell) so when I tried this it didn't work because he was already in the cell.

 

So, I think, on balance using a script works best for me, and now it's working I'm a bit hesitant to change it incase I run into more problems.

 

Thanks for the input,

Broken_Code

Link to comment
Share on other sites

Hey, I found an awesome tutorial that helps figure out AI package use through quest scripting. It is to make an operator for a drawbridge (the operator uses the activator to open/close the bridge). You can find it here:

http://thewormhole.nfshost.com/forum/index.php?topic=1583.0

Link to comment
Share on other sites

  • Recently Browsing   0 members

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