Jump to content

GetWorldSpace of Interior Cell's Exterior Location?


ThoraldGM

Recommended Posts

My Google-Fu appears to be weak today. I need to discern by script if an indoor object is in the Commonwealth, Far Harbor, or Nuka-World. GetWorldSpace only seems to work if the object is outdoors. Is there a way to check which exterior an interior "belongs to" so GetWorldSpace catches everything? I know interior cells don't really have a "location" but aren't they linked to the outside world somehow?

Link to comment
Share on other sites

Test 1: Teleport from Drumlin Diner Concord to Vault111Ext (Exterior to Exterior)

Method flagged as: Fast Travel

Target WorldSpace: Found

 

Test 2: Teleport from Vault111Ext to Vault81Secret (Exterior to Interior)

Method flagged as: CenterOnCell

Target WorldSpace: NONE

 

Papyrus.0.log:

TEST 1:

[01/10/2018 - 12:01:55PM] Hitchhiker: Started hitching...
[01/10/2018 - 12:02:02PM] Hitchhiker: Checking IsInFarHarbor.
[01/10/2018 - 12:02:02PM] Hitchhiker: Checking IsInNukaWorld.
[01/10/2018 - 12:02:02PM] Hitching to Vault111Ext
Category: 12
TargetID: 7
Hex2Dec: 418357
HH Go_File: Fallout4.esm
[01/10/2018 - 12:02:02PM] Hitchhiker
TargetObject: [ObjectReference < (00066235)>]
TargetWS: [WorldSpace <Commonwealth (0000003C)>]
[01/10/2018 - 12:02:02PM] HITCHHIKER: FAST TRAVEL CALLED.

TEST 2:

[01/10/2018 - 12:03:20PM] Hitchhiker: Started hitching...
[01/10/2018 - 12:03:29PM] Hitchhiker: Checking IsInFarHarbor.
[01/10/2018 - 12:03:29PM] Hitchhiker: Checking IsInNukaWorld.
[01/10/2018 - 12:03:29PM] Hitching to Vault81Secret
Category: 12
TargetID: 4
Hex2Dec: 2035848
HH Go_File: Fallout4.esm
[01/10/2018 - 12:03:29PM] Hitchhiker
TargetObject: [ObjectReference < (001F1088)>]
TargetWS: None
[01/10/2018 - 12:03:29PM] HITCHHIKER: CENTER ON CELL CALLED.

Screenshots:

 

DTMgG7bXcAA1WoF.jpg

 

DTMgKjaW4AA-rlL.jpg

 

DTMggwoXcAAivo5.jpg

 

DTMgjHgW4AA_4R1.jpg

 

DTMgutkXcAA0pbc.jpg

 

 

Script: https://pastebin.com/rTkzV1R8

Link to comment
Share on other sites

Interior cells aren't linked to anything. They "contact" with other interior and exterior cells via doors, and even doors are optional since player can be teleported by a script in and out.

 

Drats. I was hoping builders were setting some keyword or flag that says "Hey, this interior is in the Commonwealth | Far Harbor | etc."

 

When I was only using FastTravel / MoveTo, my DLC teleports had erratic success depending on the (origin vs destination worldspace)? But now that CenterOnCell is there as a safety net, it's catching quite a bit of the teleports (DLC or interior targets). That's fine for PC users (which code checks for now), but was hoping to make it less erratic for console users.

 

Thanks for looking.

Link to comment
Share on other sites

I don’t know if it will help for what you’re trying to do, but the Location of an interior cell (or any cell I suppose) can have the Location of an exterior cell set as its Parent Location. You can do this in the WorldSpace>Location entry for the cell(s) in question. There is also an option assign an exterior map marker to the cells Location from here. I think this is how the world map on the Pip-Boy knows where to put the player location icon when you view the map from an interior cell. It may also be how weather effects from the exterior can be seen/heard in an interior if the cell is set up to replicate them. A least this has been my experience since I started setting my interiors up this way. I'm guessing the Parent Location setting is more important for the map/weather stuff because all that worked before I started assigning map markers in the Location entry.

 

Not sure if this helps at all, but it’s the only way I know of that the game “links” interiors and exteriors, for lack of a better term.

 

EDIT: Also don't know if it will help, but you can assign LocationType keywords to a Location: LocationTypeInterior, LocationTypeClearable for example. Not overly familiar with them beyond the few that I've used, but though tit worth mentioning since you brought up keywords. Maybe there is something there you could use.

Link to comment
Share on other sites

The only two things physically linking exteriors and interiors together is locations, and teleport doors. This would be real easy with GetTeleportCell, but that is restricted to work only with elevators. So all you have is the less reliable locations. Not every interior will have a location assigned, and not every exterior will have one assigned either. And even if they do, there's no guarantee they will have a parent location assigned. This was a problem I ran into with Skyrim. What helps a little though is that world spaces might have locations assigned to them.

 

 

 

Bool Function IsInWorldSpace(ObjectReference akRef, Location akParentLoc) Global
    ; returns true if the parent location of the object matches the location assigned to a worldspace. Requires F4SE

    Location currentLoc = akRef.GetCurrentLocation()
    Location getParentLoc

if akRef.IsInInterior()
    if currentLoc
        getParentLoc = currentLoc.GetParent()
        if getParentLoc
            if getParentLoc == akParentLoc
                return true
            else
                return false
        else
            return false
        endif
    else
        return false
    endif
endif
return false
EndFunction

 

 

 

Not completely tested, just did a quick test in Root Cell in Sactuary Hills. Requires F4SE to make a little easier. Working with locations takes a lot of research. I did a ton of that with Skyrim, and applied a bit of it to Fallout 4. Basically those three worldspaces you listed should have locations assigned to them. I don't have Nuka World or Far Harbour, but the Commonwealth worldspace does have CommonwealthLocation assigned to it. So if you pass in for example CommonwealthLocation, and it returns true, that interior/exterior undoubtedly be in the worldspace. This function takes in account for none locations and locations that don't have parents, and if you're in an interior.

Edited by Rasikko
Link to comment
Share on other sites

I don’t know if it will help for what you’re trying to do, but the Location of an interior cell (or any cell I suppose) can have the Location of an exterior cell set as its Parent Location ...

This is good info, thanks. I don't know if it's part of a "best practices for builders" list but it should be. I can check interiors for this info, but only if it was assigned on creation. The link to weathers is interesting too, reminds me of Immersive Interiors in Skyrim.

 

 

... This function takes in account for none locations and locations that don't have parents, and if you're in an interior.

I see. F4SE because of GetParent(). Are F4SE function contents open source? I was planning a MCM version of the mod, and an alternative file for non-F4SE users. I think what you posted or a close variant is going to be the way forward.

 

Unfortunately, I'm on night 5 of 8 (12-hour shifts), so it's going to be a few days before I can mod.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...