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.

The API itself has no fallback: it returns 0 when the leader is unknown (not in a party / offline), and older executables don't have the symbol at all. Any fallback (e.g. lowest player ID) is up to the plugin. No protocol change.

Tested: in game with 2 clients on 1.7.104. Both clients find the export, report the same leader ID, and it stays correct when the other player reconnects with a new ID. Not yet tested: handing leadership over, and the leader ID going back to 0 after a disconnect.

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