Closed ghost closed 10 months ago
I merely wanted to share with the community functionality I wish I'd had when I first started modding and was exclusively dependent on Papyrus, with all it's faults and shortcomings. If you had issue with the code, or simply weren't interested, a short comment would have been appreciated vis-à-vis the disregarding silence.
I have very little time to work on the script extender projects every week. Last week:
Any delay in review is not intended to be a personal insult. Thank you for your interest in the project, but I must admit that I cannot meet your standards for code review turnaround, and will respect your wishes. I apologize for my lack of time and regret that we will not be able to work together.
Hey there Ian, Here's a few bits and pieces I've been sitting on for a while and thought perhaps the SKSE community could find some of it useful. Let me know if you have issue with the code and I'll be happy to work with you to get it merged.
Cheers.
Perk tree traversal fix:
When going through an ill-formed perk tree, ActorValueInfo::GetPerks will recurse endlessly, resulting in a stack overflow. The mod in question responsible for this feat: https://www.nexusmods.com/skyrimspecialedition/mods/20605 Surprisingly, the game doesn't have an issue with it.
I fixed the crash by limiting the amount of times the same node is revisited to 4, which isn't ideal since it's possible oddly constructed but valid trees go above this number. Additionally, the resulting array of perks can not have repeated entries anymore.
New container functions
container.AddItemsBulk(Form[] items, int[] count, bool remove = false) Adds every form in the passed array to the container in one single operation. Mass addition/removal of items can also be achieved by the native AddItems if given a formlist as argument, but it will quickly send OnItemAdded notifications to all listeners, which can overwhelm the VM resulting in stack dumps and massive slowdowns. This avoids that and has the added benefit of not requiring formlists.
container.GetItemCountCached(Form item) Upon the first call, the contents of the container are cached and subsequent call simply retrieve the cached value without looking up the container. Much faster than the native GetItemCount. Intended for use when the container's contents are known not to change.
RestoreItemCharge(Weapon wepn, bool all = false) While there are other charge functions, this one works directly on forms inside containers. It restores and returns the missing charge of the first pertinent entry in the extradata list. Or all of them if all is set true.
container.GetDisplayValue(form item) native There's already a function that returns a form's base value, however the final value can vary widely from this amount depending on enchantments, temper status and other factors. This function returns the final value, as shown on the UI.
perk.GetSkillRequirement(string actorvalue) Returns the skill level needed to acquire this perk.