[Scripting] AddScriptPackage

Post » Mon Jun 18, 2012 10:03 pm

So, simple question: How exactly are we supposed to implement AddScriptPackage functionality in Skyrim? There's no function I can find that does anything remotely similar - the only "solution" I can find is to add packages to NPCs directly and conditionalize them to script / quest variables. Obviously not helpful. Is there some fancy thing with procedures / packages that I'm missing?
User avatar
TOYA toys
 
Posts: 3455
Joined: Sat Jan 13, 2007 4:22 am

Post » Mon Jun 18, 2012 5:52 pm

I believe you would create a referenceAlias on a quest (set to start at game start) which then contains the package you wish to place on the actor. You can also attach scripts to actors in this manner as well.

If you attach your script to that quest and then add a property to it of type "referenceAlias", you can then do a: myRefProperty.ForceRefTo(myRef). The actor you pointed it at will then get the package and any scripts attached to the reference alias.

In the reference alias properties you can tick the flag "optional" and this allows you to leave the initial target blank (otherwise it will crash the quest on startup).
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Mon Jun 18, 2012 2:45 pm

Thank you for the help, rlilewi. Too bad the Wiki doesn't say anything like that about ForceToRef.

One more question: Does the script / package addition become permanent, or is it automatically removed when the ReferenceAlias is changed?
User avatar
Louise Andrew
 
Posts: 3333
Joined: Mon Nov 27, 2006 8:01 am

Post » Mon Jun 18, 2012 11:00 pm

It should be automatically removed--I haven't tested your exact circumstances, but I know that when a quest that a reference alias is attached to is stopped the alias's packages are no longer applied to the actor. So they're definitely not permanent.
User avatar
Alada Vaginah
 
Posts: 3368
Joined: Sun Jun 25, 2006 8:31 pm

Post » Tue Jun 19, 2012 3:23 am

Thank you for the help, rlilewi. Too bad the Wiki doesn't say anything like that about ForceToRef.

One more question: Does the script / package addition become permanent, or is it automatically removed when the ReferenceAlias is changed?
It should be removed after you change it. The changes done by the alias should only affect whatever the alias points to.
User avatar
Terry
 
Posts: 3368
Joined: Mon Jul 09, 2007 1:21 am

Post » Mon Jun 18, 2012 3:48 pm

It should be automatically removed--I haven't tested your exact circumstances, but I know that when a quest that a reference alias is attached to is stopped the alias's packages are no longer applied to the actor. So they're definitely not permanent.
It should be removed after you change it. The changes done by the alias should only affect whatever the alias points to.
Thank you both very much for the info - I've already gotten it working in my mod. I'm actually starting to like the new Alias system.
User avatar
Prisca Lacour
 
Posts: 3375
Joined: Thu Mar 15, 2007 9:25 am

Post » Tue Jun 19, 2012 5:03 am

It's particularly useful when you want to run a script on the player - you can use a ReferenceAlias to effectively attach a script to the player without altering the player, so the old compatibility issue of attaching a script to the player is no longer really an issue.

Cipscis
User avatar
Laura Mclean
 
Posts: 3471
Joined: Mon Oct 30, 2006 12:15 pm


Return to V - Skyrim