Fix graves spawning at stale instance exit tiles - #1179
Merged
Conversation
`instance_logout_tile` was set when entering an instance and never cleared, so after Blood Pact or any random event every later death sent the gravestone and dropped items back to that old exit tile - dying in God Wars Dungeon left the grave outside Lumbridge church. Only use the instance exit tile while the player is actually inside an instance, clear the var in clearInstance() (which also fixes instanceOrigin() teleporting to a long-gone tile on a later instance exit), and clear it on spawn so existing saves recover.
HarleyGilpin
marked this pull request as ready for review
August 17, 2026 10:44
GregHib
approved these changes
Aug 17, 2026
This file contains hidden or 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
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.
Problem
instanceLogout()reads the player varinstance_logout_tile, which is set when entering an instance (LumbridgeCatacombs,HuntForSurok,Edmond,PollnivneachDungeon, and every random event viarandom_event_origin) and was never cleared —clearInstance()removedinstanceandinstance_offsetbut not this one. The var is persisted in the save's[variables], so a single Blood Pact run or random event permanently redirected every later death, anywhere in the game, to that old exit tile.instanceOrigin()has the same latent flaw: entering a later instance that doesn't set its own logout tile would teleport the player to the stale one on exit.Fix
PlayerDeathonly uses the instance exit tile while the player is actually inside an instance.clearInstance()clearsinstance_logout_tilealongsideinstance_offset.InstanceLogoutclears it on spawn when not in an instance, so saves that already carry a stale value recover on next login.Testing
New
GravestonesTestcase: with a stale logout tile set, die in the Bandos chamber and assert the grave and dropped items are at the death tile and nothing lands on the logout tile. Full:game:testsuite passes.