Jump to content

AddScriptPackage Persistence?


Recommended Posts

I'm coming around to messing with Oblivion, and there's a rather big problem. There's no such thing as quest aliases, so we have to make do with adding packages directly, or using AddScriptPackage.

 

Do packages added via AddScriptPackage get written to the save, so that an actor will continue the package when the game is restarted? Or does it have to be reapplied whenever the game is loaded?

Link to comment
Share on other sites

In my experience (I use AddScriptPackage to add a custom sleeping package to NPCs quite often) if I load a save with them sleeping via AddScriptPackage while my character is in the same cell they will continue with the sleep package. Leave the cell and even if you return immediately and they'll be onto whatever package evalutes true in their list of AI packages assigned via the CS or vanilla game.

 

I also find that most of the time they will be on to their next valid package if my guy is sleeping with them (often they'll be just standing on the bed if their assigned package is a wander) but every now and then the sleep package will still be executing (my custom sleep that I assign via AddScriptPackage has a 6 hour duration).

 

Maybe sometimes my guy is more charismatic than others.

Link to comment
Share on other sites

According to the Wiki, a package added via AddScriptPackage will be removed the next time the actor reevaluates his package.

 

I suppose it does not matter if the game is saved/restored in between.

 

 

In my experience (I use AddScriptPackage to add a custom sleeping package to NPCs quite often) if I load a save with them sleeping via AddScriptPackage while my character is in the same cell they will continue with the sleep package. Leave the cell and even if you return immediately and they'll be onto whatever package evalutes true in their list of AI packages assigned via the CS or vanilla game.

 

I also find that most of the time they will be on to their next valid package if my guy is sleeping with them (often they'll be just standing on the bed if their assigned package is a wander) but every now and then the sleep package will still be executing (my custom sleep that I assign via AddScriptPackage has a 6 hour duration).

 

Maybe sometimes my guy is more charismatic than others.

Hmm. So it seems that it's very spotty. I'll have a go at adding a follow package to a bunch of NPCs, then check if it persists, to get to the bottom of this.

 

Edit: Good news, the packages added by AddScriptPackage are completely persistent. I tested two packages, one a Wander package, the other a Follow package. For each of them, I did the following:

 

1. Add to random NPCs

2. Save the game

3. Close Oblivion, then start it back up again

4. Load the save

5. Check if packages were still being run (they were)

6. Fast travelled

7. Check if packages were still being run (they were)

 

Throughout all of that, the packages continued to run. They had the flags Must Complete and Continue if PC Near set to true.

Edited by FiftyTifty
Link to comment
Share on other sites

Yes I find assigning a follow package works consistently (I use the vanilla 9828a Follow Player myself on occasion on things like dogs, Xivilai etc that Fluffy Follower Frill won't work on). Sleep packages (both vanilla and my own custom packges) are far more tempermental, eating packages as bit less tempermental (after you've gifted some food or a pewtermug01 and some drink to those who don't carry stuff like that).

 

I've even found that some NPCs will get "stuck" on certain packages (especially eat) ... Maglir is still happily drinking at West Weald Inn more than a thousand hours after I gifted him some mead, a pewtermug01 and an eat package (haven't done any Fighters Guild quests on this character).

Link to comment
Share on other sites

  • 4 weeks later...

There's no such thing as quest aliases

Why hello there. :D

 

I think I remember you from the Skyrim hub then?

 

I personally didn't really understand how these aliases work. XD

I've just made mods for Enderal and used these as recommended by other users who helped me out a lot. :smile:

 

Gamebryo is a lot different and I personally like it far more, but you surely have to take many things into account.

 

Skyrim doesn't have "GetGameLoaded" and "GetGameRestarted" as far as I know.

These are functions that return true only once per script according the respective happening.

Gamebryo is far more forgiveable when activating and deactivating mods as far less info gets saved into the savegame.

Yet therefore it is required to use these 2 functions to re-apply previously changed aspects.

 

But as you are working on followers, I really can recommend using OBSE Event Handlers:

https://obse.silverlock.org/obse_command_doc.html#Events

https://cs.elderscrolls.com/index.php?title=SetEventHandler

 

I used them to make a dog follower level on his own, by killing enemies:

 

Creature script:

 

Begin GameMode
    if GetGameRestarted && SadFluffyNachZerst.GetLevel < 50
        SetEventHandler "OnDeath", SadFluffyKillsEnemy, "object"::SadFluffyNachZerst
    endif
[...]
End

So this one sets up the event handler for the function "SadFluffyKillsEnemy". This function will be called everytime the world reference "SadFluffyNachZerst" (which is a dog companion), kills something. Function script:

 

scn SadFluffyKillsEnemy

ref Target
ref Killer

Begin Function{Target, Killer}
    Let SadFluffyLevelQUEST.FutterCOUNTER += 1
[...]
;---> When Fluffy reaches max level we turn off the event handler!
    elseif SadFluffyLevelQUEST.FutterCOUNTER == 150 && SadFluffyNachZerst.GetLevel < 50
        SadFluffyNachZerst.SetAV Health 330
        SadFluffyNachZerst.SetAV Strength 90
        SadFluffyNachZerst.SetAV Intelligence 75
        SadFluffyNachZerst.SetAV Willpower 80
        SadFluffyNachZerst.SetAV Agility 110
        SadFluffyNachZerst.SetAV Speed 55
        SadFluffyNachZerst.SetAV Endurance 85
        SadFluffyNachZerst.SetAV Luck 70
        SadFluffyNachZerst.SetLevel 50
        SadFluffyNachZerst.SetScale 1.30
        Message "Fluffy has reached his maximum Level of 50."
        Set SadFluffyLevelQUEST.FutterCOUNTER to 0
        RemoveEventHandler "OnDeath", SadFluffyKillsEnemy, "object"::SadFluffyNachZerst
    endif
End

The event handler will only be applied if max level is not reached yet.

And it will surely be removed as soon as max level is reached.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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