TempClone Question

Post » Mon Nov 19, 2012 10:46 am

Has anyone used TempClone() yet? I'm trying this:


   Form DegradingClone = ArmorInQuestion.GetReference().GetBaseObject()   DegradingClone = DegradingClone.TempClone()   ObjectReference ClonedRef = PlayerREF.addItem(DegradingClone)   PlayerREF.EquipItem(ClonedRef)   PlayerREF.RemoveItem(ArmorInQuestion.GetReference())   ArmorInQuestion.Clear()   ArmorInQuestion.ForceRefTo(ClonedRef)   ArmDegList9.addForm(ArmorInQuestion.GetReference())

and while I get a notification that something was added to my inventory, the name is blank and nothing appears there. It's as if there is a blank form being added rather than a cloned one.

EDIT: In the script log it says it can't do stuff with a None callstack, so that's interesting. But I do get a message saying simply "Added" without any item name before it.

NOTE: My skse_launcher.dll won't copy in properly to its directory, maybe this is the problem?
EDIT2: I doubt this is it. I looked and the old launcher dll is the same exact size as the new one. Dunno why it won't copy in though. Says something about it being used by explorer.

Here's the whole script:

Scriptname ARMDEG_CastingSpellScript extends activemagiceffect FormList Property ArmDegList0 autoFormList Property ArmDegList1 autoFormList Property ArmDegList2 autoFormList Property ArmDegList3 autoFormList Property ArmDegList4 autoFormList Property ArmDegList5 autoFormList Property ArmDegList6 autoFormList Property ArmDegList7 autoFormList Property ArmDegList8 autoFormList Property ArmDegList9 autoReferenceAlias Property EqCuirass autoReferenceAlias Property EqHelm autoReferenceAlias Property EqGaunt autoReferenceAlias Property EqBoots autoReferenceAlias Property EqShield autoReferenceAlias Property EqWeap autoActor Property PlayerREF autoevent OnEffectStart(Actor C, Actor T)Degrade()endEventfunction Degrade()ReferenceAlias ArmorInQuestion = PickSlot();Debug.Notification(ArmorInQuestion.GetName())if (ArmorInQuestion.GetReference()); && PlayerREF.IsEquipped(ArmorInQuestion.GetReference())  ;Debug.Notification("ArmorInQuestion.GetReference() Exists and is Equipped")  if ArmDegList1.HasForm(ArmorInQuestion.GetReference())   ArmDegList0.addForm(ArmorInQuestion.GetReference())   ArmDegList1.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList2.HasForm(ArmorInQuestion.GetReference())   ArmDegList1.addForm(ArmorInQuestion.GetReference())   ArmDegList2.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList3.HasForm(ArmorInQuestion.GetReference())   ArmDegList2.addForm(ArmorInQuestion.GetReference())   ArmDegList3.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList4.HasForm(ArmorInQuestion.GetReference())   ArmDegList3.addForm(ArmorInQuestion.GetReference())   ArmDegList4.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList5.HasForm(ArmorInQuestion.GetReference())   ArmDegList4.addForm(ArmorInQuestion.GetReference())   ArmDegList5.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList6.HasForm(ArmorInQuestion.GetReference())   ArmDegList5.addForm(ArmorInQuestion.GetReference())   ArmDegList6.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList7.HasForm(ArmorInQuestion.GetReference())   ArmDegList6.addForm(ArmorInQuestion.GetReference())   ArmDegList7.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList8.HasForm(ArmorInQuestion.GetReference())   ArmDegList7.addForm(ArmorInQuestion.GetReference())   ArmDegList8.RemoveAddedForm(ArmorInQuestion.GetReference())  elseIf ArmDegList9.HasForm(ArmorInQuestion.GetReference())   ArmDegList8.addForm(ArmorInQuestion.GetReference())   ArmDegList9.RemoveAddedForm(ArmorInQuestion.GetReference())  else   Form DegradingClone = ArmorInQuestion.GetReference().GetBaseObject()   DegradingClone = DegradingClone.TempClone()   ObjectReference ClonedRef = PlayerREF.PlaceAtMe(DegradingClone)   PlayerREF.additem(ClonedRef)   PlayerREF.EquipItem(ClonedRef)   PlayerREF.RemoveItem(ArmorInQuestion.GetReference())   ArmorInQuestion.Clear()   ArmorInQuestion.ForceRefTo(ClonedRef)   ArmDegList9.addForm(ArmorInQuestion.GetReference())  endIf;Debug.Notification("A piece of armor has degraded.")endIf  endFunctionReferenceAlias Function PickSlot()int SlotNum = Utility.RandomInt(1,5);Debug.Notification("SlotNum = " +SlotNum)if SlotNum==1return EqCuirasselseIf SlotNum==2return EqBootselseIf SlotNum==3return EqShieldelseIf SlotNum==4return EqGauntelseIf SlotNum==5return EqHelmendIfendFunction
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm

Post » Tue Nov 20, 2012 12:11 am

I haven't used it, but can you explain what good it does to tempclone a base object since you don't manipulate the tempclone before creating the reference? Or do you plan to do that later after you get it working? It seems like the function might only be intended to work on references, despite being a function of form? I would expect that it tries to take a reference, make another instance from the same base object of that ref, and then copy all properties of the ref to the clone... I'm not sure how it could work at all on a base object, even.

P.S. Another thing that seems to me to make this a bad idea even if it works: I'm kind of assuming by the name that tempclone deletes the object it makes after a while, but if you've successfully cloned a base object, what happens when its deleted and you have references of it in the game? Also you wouldn't be able to refer back to the original base object from the ref instantiated from the clone, because it now has a different base (the clone is/would be a different base object than the non-clone). Wow, sorry if that was confusing.

P.S. 2 - If you actually intended to tempclone the ref... you can ignore the above and just change the code to clone the ref instead of the base object.
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Mon Nov 19, 2012 11:25 am

Eventually I will be adding the Form to a FormList, and I don't want every other instance of the form to be added to this list.
Your PS is actually exactly the point of it. I want an IronCuirass form that I can manipulate without changing every IronCuirass in the game.
I'm more or less praying that the TEMP in TempClone() is not literal...
EDIT: Attempting to call TempClone() on an ObjectReference results in no errors in the CK, but causes immediate CTD.
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm

Post » Mon Nov 19, 2012 7:42 pm

Eventually I will be adding the Form to a FormList, and I don't want every other instance of the form to be added to this list.
Your PS is actually exactly the point of it. I want an IronCuirass form that I can manipulate without changing every IronCuirass in the game.
I'm more or less praying that the TEMP in TempClone() is not literal...
EDIT: Attempting to call TempClone() on an ObjectReference results in no errors in the CK, but causes immediate CTD.

Yeah, I can understand why, but the description literally said "temporary clone" so I don't know why it wouldn't be temporary. Haha. But after thinking, I also don't really see how it would be useful on a reference, so maybe it is designed for base objects. Maybe temporarily would instead mean that it's deleted when there are no more references of it left? Well, it would probably be best to ask one of the SKSE developers about how it's supposed to be used and if it works or not...
User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm


Return to V - Skyrim