Jump to content

Photo

Run AI Package once per hour

ai package ai delay

  • Please log in to reply
3 replies to this topic

#1
JPSteel2

JPSteel2

    Fan

  • Supporter
  • PipPipPip
  • 386 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



#2
JPSteel2

JPSteel2

    Fan

  • Supporter
  • PipPipPip
  • 386 posts

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".



#3
Rasikko

Rasikko

    The Arbiter of Time

  • Members
  • PipPipPipPip
  • 1,236 posts

Wouldn't it have been easier if you gave the package a schedule of 1 hour per day?



#4
JPSteel2

JPSteel2

    Fan

  • Supporter
  • PipPipPip
  • 386 posts

I just tried it but it doesn't work, the AI Package will just run indefinitely. Thanks for the idea though







Also tagged with one or more of these keywords: ai package, ai, delay

Page loaded in: 1.048 seconds