Jump to content

Question about AddScriptPackage


Recommended Posts

I'm wondering if anyone has a good way of getting an AI package onto an NPC without editing them in the CS. Perhaps I should explain.


I've got a mod up going which affects the NPCs that exist in vanilla Oblivion. One of the things I need them to do is go somewhere until the player advances a quest, or until a quest variable changes. Up until now I simply check a quest stage/quest variable in the conditions of a package I add to the NPC.


The problem with this is that since I have changed the NPC, I conflict with any other mods that might affect the NPC. In my case I now deny the user a choice of which mod they use to "pretty up" the oblivion npcs because my mod is overriding it.


I've tried using AddScriptPackage to add the package during dialogue so I don't have to change anything but the package was removed almost immediately, even when I clicked "Must Complete".


Can anyone think of a good way to do this. I've trawled through the function list at the CS wiki but I can't find any other functions that might do the same thing.

Link to comment

So I tried this and had mixed results.


Let's assume the aim of the script is to get Casta Scribonia to immediately go to sleep on a bed I choose and stay that way until told otherwise. I want to be able to do this without actually editing her in the CS.


So I set up a token aaExtoken and a sleep package called aaExCastaPackage, Told her to Sleep in the package, Must Reach Location, Must Complete and I chose the bed. The conditions for the package are "GetIsId = CastaScribonia" and "GetItemCount aaExToken >= 1"


Method One - Script on the Token


I then put a script on the token that is simply:


Begin GameMode
 CastaScriboniaRef.AddScriptPackage aaExCastaPackage


With this method Casta starts to walk toward the bed then begins to pace back and forth, I'm assuming as the script package is evaluted every time gamemode is called.


Method Two - Script in the Quest Script


I removed the script from the item and put the following in the Quest Script.


Begin GameMode

if (CastaScriboniaRef.GetItemCount aaExToken >=1)
 CastaScriboniaRef.AddScriptPackage aaExCastaPackage


Now with this script she made it all the way back to the bed, but had a few stops along the way, I'm assuming as the gamemode fires and it chooses the script.


The problem is she lays down and goes to sleep, then immediately gets back up. I tried setting the sleep duration to 48 but it didn't make any difference.


Does anyone have any ideas?

Link to comment


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use