how to get name-string "Castle Daggerfall" when inside castle daggerfall

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

how to get name-string "Castle Daggerfall" when inside castle daggerfall

Post by Nystul »

I am having a hard time trying to get the correct string for Castle Daggerfall when pc is inside it.

starting conditions are: castle daggerfall not discovered yet, saved the game inside, reloading this save

I tried to use the same mechanism as in PlayerGPS class in function GetBuildingDiscoveryData, something like:

Code: Select all

  BuildingDirectory buildingDirectory = GameManager.Instance.StreamingWorld.GetCurrentBuildingDirectory();
  BuildingSummary buildingSummary;
  buildingDirectory.GetBuildingSummary(buildingKey, out buildingSummary);
  buildingName = BuildingNames.GetName(
    buildingSummary.NameSeed,
    buildingSummary.BuildingType,
    buildingSummary.FactionId,
    buildingDirectory.LocationData.Name,
    buildingDirectory.LocationData.RegionName);
but I lack the buildingKey.

How can I get it, I searched in GameManager.Instance.PlayerGPS as well as in GameManager.Instance.PlayerEnterExit but since ExteriorDoors is empty in there when inside castle daggerfall the door info is not available and thus no buildingKey

need help :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: how to get name-string "Castle Daggerfall" when inside castle daggerfall

Post by Interkarma »

You might need some special handling for these, as they break a few of the normal rules.

Unlike other Palaces, the interiors for Sentinel, Daggerfall, Wayrest are actually normal dungeons. The usual mechanism of storing exterior building data in the doors won't work for them as dungeons don't have this linkage in the first place.

The exterior of Castle Daggerfall is a normal building with a buildingKey, but the interior records are never used. Instead the door textures send player to the dungeon interior for that block. You can't use the usual mechanism here at all.

The best way to handle this is probably just to hardcode those 3 cases (which I'm pretty sure is all classic does). For example, if location is Daggerfall and player inside dungeon, then output can only be Castle Daggerfall.

Let me know if more help needed to implement something and I'll do what I can. :)

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: how to get name-string "Castle Daggerfall" when inside castle daggerfall

Post by Nystul »

ok thanks, if you are fine with this "special handling" I will go for it ;)

Post Reply