Jump to content

Need an AI package pro!


Recommended Posts

EDIT- this initial post was solved. so please read down to find the solution you may want.

Heya guys n gals. I am taking my first few steps into modding around with ai packages and am having a few problems.

 

In a WIP mod I am working on, I am able to dynamically assign up to 5 random hostile human NPC's into 1 of 5 identical aliases, whilst at the same time doing some script magic to make them non-hostile.

 

Once I have done this, I want the alias to run an ai package that makes them follow me & when I or the alias enters combat, they should flee combat, returning to its follow package once combat is over.

 

After some dialogue trigger, I will then want to get the alias to just stand on spot, mark it to be deleted when I leave the cell and clear the reference from the alias. I have already got the script for the underlined sorted.

 

Can anyone provide some assistance? Most of the guides out on the web are focused on combat followers or daily routines :sad:

Edited by thesniperdevil
Link to comment
Share on other sites

well, a bit more investigating and messing around seems to have helped :) There are two basic templates taht I used. 1 is the basic follow package adn another is flee from. THis second package I used as a combat overide and had some cinditions to check that the player is in combat and it seems to do what I want!

 

Now I have a problem. When I trigger to clear the alias, the actors who were previously the alias reference lose their follow/ flee packages (which is OK) but revert back to their original ones, which is not OK because I want them to stay still and do nothing because they will be deleted when the player leaves their cell.

 

any tips?

 

T

Link to comment
Share on other sites

Hmm its not entirely clear what you want here but as soon as you clear the alias the package it contains will cease running too and and they will revert to whatever their default package is.

 

Personally rather than clear the alias on dialogue I'd use OnUnload() to delete them and/or clear alias or whatever when you exit the area so you won't see them leave.

 

To make them stay in one place I'd use StayAtCurrentLocation template which will make them stay put and set some variable via dialogue to be used by the Condition.

Link to comment
Share on other sites

Hey SoupDragon, it appears that using onUnload() has some problematic effects. It appears to cause some unexpected behaviour when entering doors to new areas (such as the entrance to Whiterun).

 

This of course triggers the unload, then a test "if global value ==0" seems to fire incorrectly (the global is actually >1) furthermore, self.deletewhenable() does not seem to fire- resulting in the target npc to re-appear in their original spawn location.

 

So I guess that as the onUnload() event is firing when entering a new area, the global variable is momentarily not loaded, which causes the false positive to my condition? And that at that moment, when the actor is in its unloaded state, deleteWhenAble() does not work?

 

Is there a way around this? (using wait for example) I will investigate myself, but any advice would be appreciated!

Link to comment
Share on other sites

a test "if global value ==0" seems to fire incorrectly

If that global is used in a quest, you may need to call UpdateCurrentInstanceGlobal() on it to get the correct resullts. Just a guess.

 

 

So I guess that as the onUnload() event is firing when entering a new area

Try OnCellDetach instead. According to the wiki it is more reliable.

Link to comment
Share on other sites

Edit: Initial query and follow up were resolved. I was able to use some base ai packages (follow & flee ) to give my quest alias the behaviours I was looking for.

 

I wanted the alias to stay put in a location and delete itself when next able. The best way to do this was to make the alias wait with a "wait" ai package, and use ongametimeUpdate() to clear the alias and delete the reference after a set amount of time (giving the player ample time to leave the area and avoid seeing any messy behaviours.

 

:D

Edited by thesniperdevil
Link to comment
Share on other sites

  • Recently Browsing   0 members

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