Jump to content

Run AI Package once per hour


JPSteel2

Recommended Posts

Hi guys,

 

I'm creating a mod which adds an AI Package to some guards and need this package to be running each hour.

 

This is a ForceGreet which is linked to a Dialogue (via a Quest). The guard comes to the player as soon as he is in his radius and plays the dialogue. Once finished, the guard should return to his starting location and wait at least an hour before replaying the dialogue, avoiding spam.

 

What I tried : - Adding a condition in the AI Package for the quest to be below stage 30 to start running, and reseting it after RegisterForSingleUpdateGameTime(1) and OnUpdate() -> Reset(), Stop()/Start() and Stop()/SetCurrentStageID(10), nothing worked...

- Adding a Script at the End of the AI Package using Utility.WaitGameTime(1)

- Using OnMenuClos("DialogueMenu") to trigger an Utilility.WaitGameTime(1)

 

Hopefully someone will have a better idea. I will continue my research and update if I find a solution

Link to comment
Share on other sites

Ok so I spent the whole night trying to fix this and finally did it, here's the solution in case someone ever has the same problem :

 

The key is to use the following condition

GetQuestRunning

in the ForceGreet AI Package, with the dialogue quest as parameter == 1

 

Then in the dialogue quest, add the script

YourQuest.Stop()

in the "End" Papyrus Fragment of the dialogue(s) which close the branch. Doing so will automatically stop the AI Package thanks to the condition we added to it. Now to restart the AI Package after one hour, add the following script in the "On End" Papyrus Fragment of the Package ("Begin/End/Change" tab)

Utility.WaitGameTime(1)
YourQuest.Start()

The Script will thus wait one in-game hour before restarting the dialogue quest, reactivating in the same time the AI Package, again thanks to the condition "GetQuestRunning".

Link to comment
Share on other sites

  • Recently Browsing   0 members

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