iqoniq Posted April 10 Share Posted April 10 I've got a quest with a script that adds a formlist to a leveled item, and I've verified it's working. The problem is when I come to try to remove the form. I'll do Container_Loot_Cooler.RemoveAddedForm(itn_inthewilds_distribution) Only to be given "RemoveAddedForm is not a function or does not exist" when I compile it. There's a piece of code that does the same thing to remove an injected workshop menu which compiles fine, so I'm guessing there's an issue with it being a leveled item. Could anyone please tell me whether this is or isn't possible with leveled items and if so how I can fix it? Thanks in advance. Link to comment Share on other sites More sharing options...
NeinGaming Posted April 10 Share Posted April 10 You can only add to or revert() the levelled item list (to the state before any script touched it) https://ck.uesp.net/wiki/LeveledItem_Script If you want insert and remove things without interfering with other mods touching the same list, you could insert your own LL instead of inserting the items directly, and then you can revert() your injected LL any time to put other things in it. 1 Link to comment Share on other sites More sharing options...
iqoniq Posted April 10 Author Share Posted April 10 On 4/10/2025 at 6:59 AM, NeinGaming said: You can only add to or revert() the levelled item list (to the state before any script touched it) https://ck.uesp.net/wiki/LeveledItem_Script If you want insert and remove things without interfering with other mods touching the same list, you could insert your own LL instead of inserting the items directly, and then you can revert() your injected LL any time to put other things in it. Expand I made a mistake in my original post, and realised later it was another leveled item I was injecting, and research on that has lead me to the conclusion it's not possible. This is specifically to allow a user to perform an uninstall and attempting to minimise anything getting baked into the save (or more than it needs to). I'd considered the approach you suggested, but do you know how the game would handle it simply disappearing on the mod being removed? If it will just shrug and forget about it, then I may as well leave it (same result either way), but if it does have a consequence (especially the save file) am I right in the assumption an empty formlist would be better than something populated? Link to comment Share on other sites More sharing options...
NeinGaming Posted April 10 Share Posted April 10 Then Container_Loot_Cooler probably isn't a form list, or you shouldn't get that compilation error? I'm confused by "I'm guessing there's an issue with it being a leveled item" -- you mean the thing you want to remove? Shouldn't matter, AFAIK any form can go into a form list, and the compilation error isn't about the argument of the function, but the function itself, so it doesn't even get to the part of maybe having a problem with what you want to remove. Link to comment Share on other sites More sharing options...
iqoniq Posted April 11 Author Share Posted April 11 "Container_Loot_Cooler" is a leveled item, as is "itn_inthewilds_distribution" (this is the one I mistakenly said was a form list). All the research I've read sine my original post has said there's no way to remove a form list or leveled item from another leveled item. Thanks anyway Link to comment Share on other sites More sharing options...
LarannKiar Posted April 14 Share Posted April 14 Vanilla Papyrus only has Revert() to remove all script added forms. Someone requested a few LeveledList (LeveledItem, LeveledCharacter and LeveledSpell) functions earlier. I added some of them to Garden of Eden SE, if you're insterested. Reveal hidden contents Import GardenOfEden2 Function RemoveAddedForm(LeveledItem akLeveledItem, Form akFormToRemove) If akLeveledItem && akFormToRemove Form[] OriginalForms = GetLeveledListForms(akLeveledItem) ; return all forms found in the LeveledItem If OriginalForms.Length > 0 akLeveledItem.Revert() ; remove all script added forms Int Index = 0 While Index < OriginalForms.Length Form LoopForm = OriginalForms[Index] If LoopForm && LoopForm != akFormToRemove && HasLeveledListForm(akLeveledItem, LoopForm) == False ; add back all forms to the LeveledItem that aren't already in the LeveledItem and are not the one that was removed akLeveledItem.AddForm(LoopForm, 1, 1) EndIf Index = Index + 1 EndWhile EndIf EndIf EndFunction 1 Link to comment Share on other sites More sharing options...
Recommended Posts