Hoamaii Posted March 27, 2016 Posted March 27, 2016 Hi guys, I'm trying to compile this attached to an ObjectReference (which is not an Alias, but may have filled an optional one) to try and clear the Alias this object may have filled: If Game.GetModByName("NewMod.esp") != 255 Quest _NM_MyQuest = Game.GetFormFromFile(0x000008B8, "NewMod.esp") as Quest int idx = _NM_MyQuest.GetNumAliases() while idx > 0 idx -= 1 Alias nthAlias = _NM_MyQuest.GetNthAlias(idx) as Alias if nthAlias ObjectReference nthAliasRef = nthAlias.GetReference() If nthAliasRef == MyObjectReference nthAlias.Clear() Debug.Notification("MyObjectReference cleared as Alias") EndIf EndIf endWhile EndIf I know I'm mixing apples and pineapples here, trying to call referenceAlias functions on an Alias - and of course Papyrus tells me "GetReference()" is not a function and "Clear()" is not a function either - but I can't figure out which functions to use to go from my nthAlias Alias to an Alias_nthAlias ReferenceAlias before I can call GetReference() to get a nthAliasRef that I'll be able to compare to my objectReference before clearing the Alias if need be... :huh: Could a kind soul enlighten me, please? Many thanks in advance :smile: (and Happy Easter - uh, if it's Easter in your country too I mean)
cdcooley Posted March 28, 2016 Posted March 28, 2016 Just change the types from Alias to ReferenceAlias and it should work. ReferenceAlias extends Alias so you can cast the results of the GetNthAlias to a ReferenceAlias.
Hoamaii Posted March 28, 2016 Author Posted March 28, 2016 Ooh, silly me!.. :rolleyes: Thanks again, cdcooley :)
Recommended Posts