FiftyTifty Posted September 16, 2017 Author Posted September 16, 2017 (edited) Have you tried pasing empty formlist? For some other functions passing empty formlists make the function to work for every type of object.I haven't, but I think that would be ill-advised, if it did actually work. Papyrus arrays cap out at, what, 125 elements? Having multiple FormLists to check lowers the number of items returned each time the function is called, which reduces the chance of buggery. I've hit a wee snag, though. I want to make sure the variables in my script are cleared, to make sure there's no zombie data weirdness. Is there a way to set a variable to nil? E.g, formlistCurrent = nil Here's the current incarnation of the script: https://pastebin.com/jGgefwmt Edit: Found it. You have to set it to None: formlistCurrent = None Here's the finished script: https://pastebin.com/7ZrUrHxT Edited September 16, 2017 by FiftyTifty
FiftyTifty Posted September 16, 2017 Author Posted September 16, 2017 (edited) For some reason, the script isn't calling SetMotionType successfully. The script finds the items, and all the debug messages show, but the item's havok is still enabled. Here's the script: https://pastebin.com/2QDSPKbA Any idea why it's not working? Edit: Found out why. There were two culprits. The first, is that I had <= operators, where I should have had <. The second, is that the local variables weren't cleared properly, even after clearing them at the end of the script. I had to instead declare the variables within the event, rather than after the properties.. The second problem is absolutely bizarre. No idea why the script would call functions asynchronously. Here's the actual working script: https://pastebin.com/FasMA3aN Edited September 16, 2017 by FiftyTifty
shavkacagarikia Posted September 16, 2017 Posted September 16, 2017 Hmm, not sure if its related though. You are advancing index before the motion type is set so motion type will never be set for 0th element of the array. If you were testing this for one element that could be a problem. Also objrefarrayFoundItems[iFoundItemIndex] doesnt need cast as that element already is objectreference type.
FiftyTifty Posted September 16, 2017 Author Posted September 16, 2017 Hmm, not sure if its related though. You are advancing index before the motion type is set so motion type will never be set for 0th element of the array. If you were testing this for one element that could be a problem. Also objrefarrayFoundItems[iFoundItemIndex] doesnt need cast as that element already is objectreference type. Ya, I fixed that in the latest script. It's still bizarre that I have to have the variables as private ones, rather than local, in order to get the script to work properly. It's like the game spawned multiple threads for it.
Evangela Posted September 17, 2017 Posted September 17, 2017 (edited) You should toss that messagebox if you haven't already, so the event runs a lot faster. Edited September 17, 2017 by Rasikko
Recommended Posts