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
SUMMARY: Bugfixes "Fix Dissappearing travelling NPCs"
Purpose of change
Fixes #39712
Describe the solution
The cause was that when assigned to travelling, NPCS are given a "companion mission"
companion missions are meant to be offscreen, so they arent loaded into reality bubble.
( except when the mission is travelling ) - this special case check was everywhere.
When you told them to follow you again, after telling them to travel somewhere their npc_mission variable changed to NULL, but they still had the companion mission, hence when the game loaded, or they went offscreen, then subsequently, they were not loaded back in.
The solution is 3-fold.
I have no idea why I originally made them use the companion mission framework, when they are travelling they dont need to go into the invisible aether, I cant think of any reason why this is beneficial to use that system, I may have missed some reason I took that decision way back when, but as of now I cant think of one, so I have just removed the assignation of a companion mission when asking them to travel, that way - there will be no problems loading them into the reality bubble, no matter what other series of events happen to them.
in the npc talk functions, I have ensured that when telling an NPC to follow you, if they still have a companion mission, it is reset.
in the faction NPC summary window, if they are on a mission, ive added a button to press to emergency recall them ( like the faction camp ) if they get stuck in off-screen limbo. - This could potentially be problematic ( if they are doing important stuff ) but less problematic than lost NPCs.
Describe alternatives you've considered
N/A
Testing
Told NPC to travel to camp, then told them to follow, then saved and reloaded game.
Before this fix : they dissappeared
after this fix : they didnt.
After this fix : could recall the stuck NPC in the city , in the attached savegame in linked issue, they then became visible when teleporting there.
Travelling on the overmap scale still occured.
Additional context
N/A