Skip to content

Plugin API: expose the party leader - #38

Open
NutyoPR wants to merge 1 commit into
absol89:API-playtestfrom
NutyoPR:feature/party-leader-api
Open

NutyoPR wants to merge 1 commit into
absol89:API-playtestfrom
NutyoPR:feature/party-leader-api

Conversation

@NutyoPR

@NutyoPR NutyoPR commented Nov 12, 2026 •

Copy link
Copy Markdown

Plugin API: expose the party leader

Adds SkyrimTogetherGetPartyLeaderId, an optional export next to SkyrimTogetherRegisterScopedChannel, returning the party leader's player ID (0 while not in a party).

Why: the party leader hosts the world's NPCs and quest scenes, so plugins that move NPCs or start scenes need to do it on the leader's client only. Today a plugin can only approximate that (e.g. "lowest player ID"), which picks the wrong client whenever the leader isn't the lowest ID, and changes after a reconnect. Enderal AllTogether https://github.com/NutyoPR/EnderalAllTogether needs this for patched quest scenes that otherwise move the same NPC on both clients and leave it frozen.

How: same pattern as scoped channels, nothing in the V1 vtable changes.

  • SkyrimTogetherAPI.h: GetPartyLeaderId_t and kGetPartyLeaderIdName, documented.
  • PluginAPI.cpp: the export.
  • PluginService: caches PartyService::GetLeaderPlayerId() in the existing per-update snapshot (under m_lock, like m_inParty), so it's callable from any thread.
  • plugin_api/README.md: a short "Party leader" section with a lookup example and fallback.

Older executables simply don't have the symbol, so plugins fall back gracefully. No protocol change.

Tested: not yet in game; needs a build and a two-client check that both clients report the same leader ID and that it follows a leadership change.

Co-authored-by: Claude <noreply@anthropic.com>
@NutyoPR
NutyoPR marked this pull request as ready for review November 12, 2026 22:14
@NutyoPR

NutyoPR commented Nov 14, 2026

Copy link
Copy Markdown
Author

tested in game with 2 clients on 1.7.104: both clients find the export and report the same leader id, and it stays correct when the other player reconnects with a new id. haven’t tested handing leadership over yet, will update if i do

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.

1 participant