DdsLedg Posted December 24, 2021 Share Posted December 24, 2021 (edited) SORRY I REALISED I POSTED THIS IN THE WRONG LOCATION - REPOSTED HERE: https://forums.nexusmods.com/index.php?/topic/10871368-help-checking-itemsreferences-using-a-formlist/ Hi, I am creating a Hearthfire build your own home style house for my mod, Midwood Isle. The house works great, however I have run into a problem regarding checking if a room is complete (so that the option to pay to decorate it disappears).I currently have it set up so that when the misc object is created at a workbench, it enables the reference in the room and runs the Function CheckCompletionStatus()This function is setup like this (the example being the library room): if Game.GetPlayer().GetItemCount(MI_CheckLibraryList) == MI_CheckLibraryList.GetSize()MI_LibraryCompleted.SetValue(1)endifThe MI_CheckLibraryList is a formlist of all the Misc objects that can be created in the library - currently 35 objects. However, this seems to be very inconsistent.For some of the rooms, it sets the global when I have created like half the objects, and for some it never sets the global once all are created.Additionally, I tried changing it to be == 35, however this also doesnt work. The weird part is when I set it to == 5, sometimes it works and sometimes it doesn't.I was wondering if anyone knew of a problem with using formlists for GetItemCount or GetSize? After banging my head against a wall I tried coming up with a different approach (a bit messy):MI_LibraryIncomplete.SetValue(0)int iCurrentArrayIndex = 0while iCurrentArrayIndex < DecorationsLibrary.lengthif DecorationsLibrary[iCurrentArrayIndex].IsDisabled()MI_LibraryIncomplete.SetValue(1)endifiCurrentArrayIndex = iCurrentArrayIndex + 1endWhileif MI_LibraryIncomplete.GetValue() == 0MI_LibraryCompleted.SetValue(1)endifMI_LibraryIncomplete.SetValue(0)For this, the DecorationsLibrary points to an array of ObjectReferences (all the references that are enabled in the room). My thinking here was the script would quickly run through the array, and if any are disabled it sets a global that it is incomplete. At the end, if the global hasnt been set, the room is complete.The weird thing here is it causes the exact same issues as the first one. The same rooms that were completed early are still completed early, and the rooms that didn't complete still dont complete. From what I can tell, all the globals, formlists and arrays are identical to each other (except what they contain). The MiscObjects you create at the workbench all have the script calling the function CheckCompletionStatus() - so I have no idea whats different about the rooms. Alternatively, is there a better way for me to remove the dialogue to pay to decorate a room when it is completed? Hearthfire doesn't actually have this feature - so I'm almost tempted to just leave it, but it'd be nice to have. I'm completely lost in this, so would appreciate any advice! Edited December 24, 2021 by DdsLedg Link to comment Share on other sites More sharing options...
Recommended Posts