Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated InvalidateItem() to find multiple appearances #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RabidAnteater
Copy link

@RabidAnteater RabidAnteater commented Apr 10, 2021

Fixes #52

InvalidateItem() only invalidates the first appearances of an item in the _itemIds list. If the item appears again in the list, the later appearances are not invalidated. This leads to 'ghost' items that cause problems with other parts of the script, such as ProcessItem().

e.g. An invalid item, a_itemId, appears in both Group 1 @ index 2 and Group 4 @ index 96.
_itemIds1.Find(a_itemId) returns 2 and sets _itemInvalidFlags1[2] = true. Processing stops and the instance in group 4 is not detected.

InvalidateItem() only invalidates the first appearances of an item in the _itemIds list. If the item appears again in the list, the later appearances are not invalidated. This leads to 'ghost' items that cause problems with other parts of the script, such as ProcessItem().

e.g. An invalid item, a_itemId, appears in both Group 1 @ index 2 and Group 4 @ index 96. 
_itemIds1.Find(a_itemId) returns 2 and sets _itemInvalidFlags1[2] = true. Processing stops and the instance in group 4 is not detected.
@RullGit
Copy link

RullGit commented Apr 22, 2021

Looks great.
I'd love to see a workaround for savegames with ghost items in them already, but this will at least prevent new games from corrupting!

So as review comment; please increase the CurrentVersion, check in OnVersionUpdate for version increases and invalidate everything.

@RabidAnteater
Copy link
Author

This should also work to fix the issue mid-game and the testing I've done so far on broken saves seems to confirm this.

There is already a SKSE function that successfully finds invalid items and triggers the OnFoundInvalidItem event in this script. All my correction is doing is ensuring all the occurrences are flagged and not just the first.
The invalid items are still in the group, but are now ignored by the equip function and are eventually overwritten when the group fills up (more than 32 entries).

@RullGit
Copy link

RullGit commented Apr 23, 2021

I understand, they will indeed be found in the groupdata and reported as invalid. Nice.

@RullGit
Copy link

RullGit commented Apr 27, 2021

So, now, how to get this in a release? SkyUI hasn't been update for 4 to 6 years it seems. Do you have a compiled version of this?

@Mardoxx
Copy link
Collaborator

Mardoxx commented Apr 27, 2021 via email

@RabidAnteater
Copy link
Author

I've asked Schlangster for permission to upload a compiled version of this Papyrus script to Nexus Mods. We'll see what comes of that.
All the info is here for people to compile themselves in Creation Kit, though (this script, at least seems to be the same as the SSE 5.2 version on Nexus).

@jrooke81
Copy link

Hello, what's the status of this PR? I'm currently having this issue in-game and its really frustrating, would be good to get this fix added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Favorite Group swapping fails to equip apparel with matching Item IDs
4 participants