dizietemblesssma Posted April 26, 2022 Share Posted April 26, 2022 Am I imagining that this is possible? Assuming that the form is of an object that exists and is loaded.In this case I'm looking at the Staf of Arcane Authority (no bug, whay!) I know the RefId and my script says: debug.trace("s_to_form is "+s_to_form) ObjectReference objectref = s_to_form As ObjectReference debug.trace("objectref is "+objectref)I know from the papyrus.0.log that s_to_form is in fact the RefId of the staff - 0x000940d8 and the line in the log is: [04/26/2022 - 01:19:47AM] s_to_form is [Form < (000940D8)>]yet objectref is always None,the script extends SKI_ConfigBaseso I imported objectreference to be on the safe side (though it compiled fine without that).I need the form as objectreference in order to use the function AddItem to 'move' the item, not create a new one i.e. Function dz_transfer_object(ObjectReference akRef) PlayerRef.Additem(akRef,1) EndFunction diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 26, 2022 Share Posted April 26, 2022 You cannot take an object's base form and cast it into a pre-existing object reference. Papyrus will let you compile because ObjectReference does extend Form and thus the casting is technically viable. However, casting only looks at the form variable and checks to see if the object in that form variable matches the cast type. Thus supplying the base form to the form variable will fail a cast to ObjectReference while succeeding at casting to types such as Weapon, Armor or MiscObject to name a few. You have some options:A quest with an alias that is filled with the closest of the target object. You could then use AddItem to move the alias and by extension the assigned object.GetCurrentCrosshairRef as dylbill mentioned in the other threadGetFormFromFile use the ref ID and cast into ObjectReference i.e. ObjectReference myStaff = Game.GetFormFromFile(0x000940D7,"Skyrim.esm") as ObjectReference It should be noted that for the staff in question 000940D8 is the base form ID while 000940D7 is the initially disabled pre-placed object reference IDWill any of these work with an input string result that contains the Form ID number? No idea.Will any of these work with an in-game created ObjectReference? The first two should. The last one definitely will not. As an aside note, if the purpose of this is to add items that are intended to advance quests or display specific instances because those items are having some sort of issue in your game. It may be more prudent to track down the cause of the issue and remedy that rather than applying a "band-aid" solution. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted April 26, 2022 Author Share Posted April 26, 2022 Serves me right:) All this time testing with the baseid and not the refid, works now! Thankyou, and you are right, tracking down the cause of the Staff bug or why the Ivory Claw won't let itself be retrieved from the LOTD musuem display are better options. But when all my online searching fails I'm not giving up a months long playthrough when I don't know the bug won't happen again:) Thus, my need for an emergency tool. diziet Link to comment Share on other sites More sharing options...
Sphered Posted April 27, 2022 Share Posted April 27, 2022 String Clarity = "This assumes you are near said reference aka its loaded etc"Form BaseToScanFor = Game.GetForm(0x940D8)ObjectReference ClosestRefUsingThatBase = Game.FindClosestReferenceOfTypeFromRef(BaseToScanFor,Game.GetForm(0x14) as ObjectReference,10000.0) Also not seeing why you would import that script. Theres zero point to Link to comment Share on other sites More sharing options...
Recommended Posts