Skip to content

[BUG] New custom NPC starts at relationship delta 2.0 instead of the configured delta #375

Closed

Description

@DooDesch

Summary

A custom NPC that is new to an existing save starts at the vanilla relationship delta 2.0 instead of the delta set with NPCRelationshipDataBuilder.WithDelta. The configured delta arrives a few seconds later, when the deferred FinalizeNetworkSpawn applies the relationship defaults. Code that reads the relationship in that window (customer setup, mod UI, a console dump right after load) gets 2.0.

Environment

  • Schedule I 0.4.7f12, IL2CPP, MelonLoader 0.7.3. The code path is shared with Mono.
  • S1API 3.2.1, and stable at c9ac103.

Steps to reproduce

  1. Register a physical customer NPC with WithRelationshipDefaults(r => r.WithDelta(2.5f)), for example a Personnel pack NPC with "relationships": { "delta": 2.5 }.
  2. Load an existing save that has never seen this NPC.
  3. Read npc.RelationData.RelationDelta as soon as the save is loaded.

Expected behavior

2.5 from the first read.

Observed behavior

  • Read at load: relDelta=2 unlockType=Recommendation.
  • Same NPC a few seconds later: relDelta=2.5.

Not the same as #260 (saved values lost on reload). This is the starting value before any save exists.

Cause

NPCRelationData.Init sets RelationDelta = NPCData.Relationship.DefaultRelationshipValue * 5. S1API leaves DefaultRelationshipValue at the vanilla 0.4 and applies the configured delta only in FinalizeNetworkSpawn, which NPCNetworkBootstrap defers. Init runs twice before that:

  1. In the S1API constructor (InitializeRelationshipData).
  2. In native Awake of the spawned instance.

Both start the NPC at 2.0.

Suggested fix

Write delta / 5 into Relationship.DefaultRelationshipValue before both Init calls. Saved relationship data still replaces it during load.

Activity

  1. changed the title [-][BUG] New custom NPC starts at relationship delta 2.0 instead of the configured delta until spawn[/-] [+][BUG] New custom NPC starts at relationship delta 2.0 instead of the configured delta[/+] on Oct 29, 2026
  2. added a commit that references this issue on Oct 30, 2026
    fddbe6c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions