Help with alias script

Post » Thu Jun 21, 2012 9:21 am

Ok so I made a script that allows you to see your character sleep, and it worked fine when attached to a bed. I was informed this is a bad idea because scripts are left behind even if a mod is installed, if attached in the editor, and was told to do dynamically add my script using a quest alias.

So I did this tutorial, and all that worked fine: http://www.creationkit.com/Dynamically_Attaching_Scripts

But when I tried using this technique on my mod, when I ported my code from my Object script to an alias script, it gives me all sorts of errors, not recognizing functions that Object reference scripts use.

Basically I think I need to exends it to object reference, but I don't really know exactly how to do that, since it is extending ReferenceAlias when I declare it in the first place.
User avatar
alicia hillier
 
Posts: 3387
Joined: Tue Feb 06, 2007 2:57 am

Post » Thu Jun 21, 2012 5:26 am

Rather than calling functions implicitly as you would with an ObjectReference, use http://www.creationkit.com/GetReference_-_ReferenceAlias to obtain the current alias. 'GetReference().Do Something()' will work just like 'Self.DoSomething()', but the 'GetReference()' is actually necessary.

Thing is, any reference forced into an alias will remain persistent even after your script clears the alias or fills it with another bed. We need Get/SetPersistent so non-persistent references could be left in the same state they're found after using 'em as aliases.
User avatar
Richus Dude
 
Posts: 3381
Joined: Fri Jun 16, 2006 1:17 am

Post » Thu Jun 21, 2012 1:32 pm

If I force an actor into an alias at runtime, then later delete the actor and put a new one in the alias, is it persistent after that even though its not in the alias and is deleted?
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Thu Jun 21, 2012 5:31 pm

If it's actually deleted and had been placed dynamically (FF range), it'll not matter. If filling with another actor reference from Skyrim.ESM or another pugin, they're probably already persistent (most beds aren't).
User avatar
Juan Suarez
 
Posts: 3395
Joined: Sun Nov 25, 2007 4:09 am

Post » Thu Jun 21, 2012 2:13 pm

Thing is, any reference forced into an alias will remain persistent even after your script clears the alias or fills it with another bed. We need Get/SetPersistent so non-persistent references could be left in the same state they're found after using 'em as aliases.

So does that mean that ForceRefTo has the the same effect as setting a force reference in the quest's alias tab?

And if so, is there a way of filling an alias that doesn't have the forcing effect?
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Thu Jun 21, 2012 6:53 am

I'm pretty sure to make a reference an alias is to make it persistent so long as it exists. I'd love to be wrong...

Edit: And I was.
User avatar
hannah sillery
 
Posts: 3354
Joined: Sun Nov 26, 2006 3:13 pm

Post » Thu Jun 21, 2012 12:06 pm

I don't think that http://www.creationkit.com/ForceRefTo_-_ReferenceAlias makes a reference permanently persistent.

I made my own version of the See You Sleep mod, where I used clones that are assigned to reference aliases. These clones are created at run time, assigned to the alias, then the alias is cleared, and the clone is deleted.

http://www.creationkit.com/Delete_-_ObjectReference only works if the reference is non-persistent. I know that delete worked because when I try using "Player.MoveTo ff000820" in the console, it tells me that it's an invalid object reference ID (ff000820 being the ref ID of my clone).
User avatar
Tha King o Geekz
 
Posts: 3556
Joined: Mon May 07, 2007 9:14 pm

Post » Thu Jun 21, 2012 7:34 pm

both Specific Reference = none on RefAliases and ObjectReference Property TempRef = None Auto, then filling them with refs at run time, is only temporary persistence.

however, in regards to the latter, if you fill the property with a specific refernce, that ref will become permanent, even if you set the property to none later on, although the new ref that fills the property will only be temporary.


the forced ref has to clear persistence, otherwise it would be a severely fatal design flaw. it is technically possible to recruit TONS of different followers within a single playthrough, and having all those refs persistence build up over time will probably cause a CTD. luckilly this doesnt actually happen and the persistence is cleared when the follower is dismissed
User avatar
Romy Welsch
 
Posts: 3329
Joined: Wed Apr 25, 2007 10:36 pm

Post » Thu Jun 21, 2012 5:21 pm

Oh, cool! I'd misunderstood then about ForceRefTo. That changes everything! :)
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Thu Jun 21, 2012 5:26 am

Awesome it works great! Thanks so much! I haven't tried it in a room where there might be a bunch of beds, I only have one alias. Do I need to add more than one? I mean the player can only sleep on one bed at a time, so I didn't really think I needed to duplicate it?
User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am

Post » Thu Jun 21, 2012 9:05 am

If you are using the method described http://www.creationkit.com/Dynamically_Attaching_Scripts, then you need multiple aliases. You cannot be sure which bed that the player is going to attempt to use, so you will want to have each bed fill an alias.
User avatar
Nina Mccormick
 
Posts: 3507
Joined: Mon Sep 18, 2006 5:38 pm


Return to V - Skyrim