-
Notifications
You must be signed in to change notification settings - Fork 8
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
Exclusive Groups #18
Closed
Closed
Exclusive Groups #18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…and distributables.
- Fixed compilation errors - Fixed support for Keywords. - Extracted form lookup logic to avoid almost identical code blocks. - Refactored LookupForms to fit in a new type of lookup for Exclusion Groups.
Odd bug where first Keyword was always sorted alphabetically by EditorID 😅
adya
force-pushed
the
feature/exclusive-groups
branch
2 times, most recently
from
March 12, 2024 01:58
31ddfaf
to
a848824
Compare
adya
force-pushed
the
feature/exclusive-groups
branch
from
March 12, 2024 02:01
04ed49e
to
5bd77ed
Compare
Yeah, it bothered me too much 🤓
Closed as original branch was rebased onto the latest stable version 6.8.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Exclusive Groups allow users to define sets of distributable forms where only one from the set can be distributed at any time. Ordering and other distribution rules are unaffected by Exclusive Group. When one entry is distributed, all other entries from common exclusive groups are banned for that NPC.
Use Case
For example, when people want to distribute only one type of weapon, but still being able to randomize it.
Let's imagine we have a distribution of several new weapons:
In this scenario NPC can get anywhere between 0 and 3 items. If we want to ensure that only one of those items can be distributed we could introduce a set of temp keywords:
It works, but it's ugly 🙂 and limited.
Other than cluttering keywords and growing exponentially in size and complexity, this approach also can't reliably support add-ons.
So if there are some other mods that would like to extend weapons that NPCs can get there is no way for them to know about
each other and take them into account.
This is where Exclusive Groups come to the rescue 😄 we don't need to foresee all possible weapons that other people might add, we only want to tell them that there is this group of weapons and we really don't want to distribute any other weapons on top. So we do it like this:
and we're done. We no longer need to clutter Keywords or worry about compatibilities.
Now when another mod wants to add a crossbow, it just needs to add this crossbow to the
Primary Weapon
group:all for weapons will be mutually exclusive now.
Syntax
Familiar syntax was preserved.
Defining Exclusive Group
To define a new Exclusive Group we only need to provide a name and at least one form (FormID/EditorID) in the second section.
Name can be any arbitrary text (obviously not containing
|
character)ExclusiveGroup = MyGroup|Form1,Form2
Adding forms to existing Exclusive Group
Similarly, we can later add new forms to the existing Exclusive Group by providing other forms:
ExclusiveGroup = GroupName|Form3
Removing forms from existing Exclusive Group
As Exclusive Groups utilize the same filters parsing we can use
NOT
filter to remove forms from Exclusive Group:ExclusiveGroup = MyGroup|-Form3
Mixing everything together
We can also do mutation at the same time in one entry:
ExclusiveGroup = MyGroup|Form4,-Form2
P.S. This description probably will be converted into an article for SPID page and be the beginning of extensive documentation for SPID 😆