Jump to content

Cell/Bed ownership


Recommended Posts

So I've been having this problem that's been bugging me. I'm running Wartimes a daughter's tale. In this mod you're given a home and a bed. All was fine when I started a new game. I could wait in the home and sleep in the bed. Now I get notifications:

 

"Better not. I'm only get myself caught doing that." when trying to wait there and

"Better not. I'll only get myself in unnecessary trouble..." when trying to sleep in the bed. 

 

My thoughts was it was some kind of ownership problem. So I set out and added a whole bunch of ownership debugging functionality to SLS. Thing is, I can find no issue with ownership and yet I still can not wait or sleep in the cell.

 

Cell info: 

Spoiler

1.jpg.5fbda6bae6eae2d12330568a23548d1f.jpg

 

Bed info: 

 

Spoiler

2.jpg.91a0fa42f8f4b7fdf004350dbbe071be.jpg

 

DB1 = PlayerFaction

F2073 = PlayerBedOwnership

 

I also added options to SLS to set cell and object ownership but for some reason nothing works for the wartimes cell. I was able to use the same functions to take over whiterun stables and wait/sleep in that cell. So I've no idea what's blocking me. If I could trace the source of the notifications I could check the exact conditions but I haven't been able to find them. 

 

I've tried: 

setting cell owner to none / To the Player base. 

Setting cell owning faction to none / To PlayerFaction

Setting cell public/private. 

 

Nothing seems to help. It feels like a trespassing issue but the flag says false...

 

Perhaps this is unrelated. Perhaps not but the wartimes home is obviously a duplicate of whiterun stables. Now the oddness is that if you have an npc following you and you enter the wartimes home the Npc will end up in the whiterun stables and not in the wartimes home. When you leave the home the npc will appear over and the stables and run over. Not sure how this is happening. The player will enter/leave the cell at the right place....

 

Any ideas?

Link to comment

If the game doesnt want you to use a Bed it just puts "Owned" behind the bed name, there is no functionality to set this sort of behavior on the Engines side, so it should be a Script that this mod attached to this Bed that cancels out this sort of Behavior, non? 

 

Have you loaded up the Cell in the CK and checked if theres a Script attached to it?

Checked the messages in the esp if one of them matches what you see? if not, the message is probably done by Debug.Messagebox() which means its noted somewhere within this mods Scripts, so just Ctrl F the folder of those scripts in your text editor I guess

Link to comment
1 hour ago, Scrab said:

If the game doesnt want you to use a Bed it just puts "Owned" behind the bed name, there is no functionality to set this sort of behavior on the Engines side

Sure about that? 

Haven't been playing the game all that much lately but I'm fairly sure that you can't wait somewhere while trespassing and it's very much a vanilla thing. And like I said I was able to take ownership of the stables using built in functionality. There is no 'owned' next to the wartimes bed. There was 'owned' on the stables bed before I took over. Then there wasn't. 

 

1 hour ago, Scrab said:

Have you loaded up the Cell in the CK and checked if theres a Script attached to it?

Nope. No scripts attached to any beds. 

1 hour ago, Scrab said:

Checked the messages in the esp if one of them matches what you see? if not, the message is probably done by Debug.Messagebox() which means its noted somewhere within this mods Scripts, so just Ctrl F the content of those scripts  (proper text editors usually have that functioanlity build in)

It's a Debug.Notification.

There are no matches in wartimes scripts for 'Better not'. The mod doesn't contain translations. 

 

It's also feels too.... 'fast' to be scripted. If it's anything it's a perk (or probably just some built-in vanilla code more likely) because it's blocking activation (The menu doesn't come up at all). And there are no perks in wartimes. 

Link to comment
22 minutes ago, Monoman1 said:

I'm fairly sure that you can't wait somewhere while trespassing and it's very much a vanilla thing

Well I have to admit, I dont know a single instance where youre owning a bed in a cell that youre not allowed in. I dont think something like that even exists in the Vanilla Game

 

1 hour ago, Monoman1 said:

Now the oddness is that if you have an npc following you and you enter the wartimes home the Npc will end up in the whiterun stables and not in the wartimes home. When you leave the home the npc will appear over and the stables and run over. Not sure how this is happening. The player will enter/leave the cell at the right place....

That here sounds like a Navmesh issue

If I remember correctly, NPCs dont actually use doors the way the player does and instead have the navmesh tell them when there doors are to be used and where they lead to

Now the Navmesh saves a bunch of data: Coverage, Water, Preferred Pathing, etc. One of those things is the Location of Doors and where they port to. The Navmesh links those 2 Locations together, its essentially the NPCs doormarker and the doormarker you set in the CK for the Player is just to tell the Navmesh where the doors are supposed to be. You could check if fixing the Navmesh in that Cell fixes that but in anyway, that sounds unlikely be the issue as the player isnt using the Navmesh whatsoever

 

22 minutes ago, Monoman1 said:

It's also feels too.... 'fast' to be scripted. If it's anything it's a perk (or probably just some built-in vanilla code more likely) because it's blocking activation (The menu doesn't come up at all). And there are no perks in wartimes. 

Did you check if this Bed Reference is used somewhere - and where? Maybe its used in an Alias somewhere that has a Keyword that enables a Vanilla Perk or something? 

 

I scammed through my own mods Folder & all Vanilla Scripts, there are no lines with "better not" either, thats really interesting. Make sure to let me know if you find something, maybe it can be forced in some instances for enhance story telling \o/

 

Link to comment
1 hour ago, Scrab said:

Well I have to admit, I dont know a single instance where youre owning a bed in a cell that youre not allowed in. I dont think something like that even exists in the Vanilla Game

Well I'm talking more about waiting right now. I strongly believe that if I can fix waiting then sleeping will follow suit.

1 hour ago, Scrab said:

That here sounds like a Navmesh issue

Ok. It's probably unrelated then. Dunno if I could be bothered fixing it as it's not a big deal. 

1 hour ago, Scrab said:

I scammed through my own mods Folder & all Vanilla Scripts, there are no lines with "better not" either, thats really interesting. Make sure to let me know if you find something, maybe it can be forced in some instances for enhance story telling \o/

Ok so for the lolz and because this is bugging me a lot I deactivated all mod files in MO except alternate start (because fuck that cart ride). Waited til 1:00am. coc WhiterunBelethorsGeneralGoods. And tried waiting and:

3.jpg.cda30e87c2f3eab840bdb4969415d6d0.jpg

 

So something is changing the wording of the message at least from vanilla. I'll try scanning through vanilla scripts and see if it turns up something. 

Link to comment
37 minutes ago, Monoman1 said:

So something is changing the wording of the message at least from vanilla. I'll try scanning through vanilla scripts and see if it turns up something.

Ok so good news/bad news

 

Good news is I've tracked the message change to Requiem by enabling/disabling it's esp. The string itself is a vanilla override. GameSetting - sNoWaitWarnToLeave [GMST:00101CDA]

 

Unfortunately, there are no references to this string in TesEdit. Did a find on various forms of 'sNoWaitTrespass' in vanilla source scripts to see if I can find out the exact bloody conditions on this but no results! :(

 

So still no wiser as to the why of it all.

Link to comment

You won't get any matches for sNoWaitWarnToLeave on scripts because it's a game settings and game settings are engine parameters. Only time you would be getting those is if you were dynamically setting their values with SKSE functions.

 

Your problem seems to be related to an old engine bug where certain flags of a cell doesn't get reset properly.

You can try going outside, calling Cell.Reset(), saving and reloading and checking whether the problem is gone.

Link to comment
3 hours ago, jmf890 said:

You won't get any matches for sNoWaitWarnToLeave on scripts because it's a game settings and game settings are engine parameters. Only time you would be getting those is if you were dynamically setting their values with SKSE functions.

Aye. I suspected. 

 

Tried a cell reset there but made no difference unfortunately. Seems there's no way to fix the cell.

Damned annoying. 

Link to comment
On 3/23/2021 at 4:37 PM, Monoman1 said:

So as a workaround I got the ref for the hidden cellar door, enabled it and I'll sleep down there instead....

Kind of appropriate I guess. Hope it doesn't break something else :O

I don't play LE, but I keep a vanilla copy of it for comparing things like that.

Here is the result of my reverse engineering on the matter.

 

When waiting in a cell, the engine checks the bitflag 0x00001000 at g_thePlayer->flags2, and if the flag is set, you will get the notification from above.

 

To fix it, you want to clean that flag and you can do it through any program that allows you to change the memory of the game or you can write a SKSE plugin and call it via Papyrus or something.

 

Papyrus and SKSE plugin approach...

registry->RegisterFunction(
    new NativeFunction0<StaticFunctionTag, SInt32>("ClearPlayerTrespassFlag", "CustomFixes", [](StaticFunctionTag*)
    {
        return InterlockedAnd(&(*g_thePlayer)->flags2, 0xFFFFEFFF);
    },
    registry)
);

 

Memory editing program:

Get the address (player reference pointer) by looking at the address 0x01B2E8E4 (static pointer).

Get the actual location of the player reference object by looking at where the address you just got points to.

Add 0x138 to the real location address and you now have the address of flags2.

Look up the current value of flags2 and change it for the result of (flags2 & 0xFFFFEFFF). Example: flags2 with the value 0x00003104 will prevent you from waiting, but cleaning it by setting it to 0x00002104 will allow you to wait.

See whether the wait menu now opens. If it does, save, quit the game, reload this save and see if the issue is permanently fixed.

If not, let me know and I'll see from where that bitflag is being set.

Link to comment
1 hour ago, jmf890 said:

Here is the result of my reverse engineering on the matter.

Wow. Wasn't expecting a response like this. Thanks very much :)

 

I haven't got a c development environment. Worse I've no experience in creating SKSE plugins. Would be interested in learning though and this might be a good place to start maybe. But for the moment I'm looking at the memory editing side. Never really done this either so I've used the only app I've got. Cheat engine, which I've used in the past to fix MGS widescreen (honest). This probably isn't even a very good app to use for this but I got this result from punching in 0x01B2E8E4. But I'm stuck at step:

1 hour ago, jmf890 said:

Get the actual location of the player reference object by looking at where the address you just got points to.

 

This is a screen grab: 

Untitled.jpg.c38634b0e53a12da65e6beea983198f9.jpg

 

If this doesn't mean anything to you I can grab an app you recommend and take a look again. 

Link to comment
11 minutes ago, jmf890 said:

Is this the value you are getting inside the cell that doesn't allow you to wait? 0x00042104 doesn't have the 13th bit set (lsb to msb) and should not display the nofication.

Wartimes home (can't wait) -> 00042104

Wartimes cellar (can wait) -> 00042104

Belethor's shop (can wait) -> 00042104

Belethors shop (after hours, can't wait) -> 00043104

Warmaidens (can wait) -> 00042104

Warmaidens (after hours, can't wait) -> 00043104

Bleak falls barrow (can wait) -> 00042104

Bleak falls barrow (sneak detected, can't wait) -> 00042104

Bleak falls barrow (in combat, can't wait) -> 00042104

Outside cell (can wait)-> 00042104

 

So seems like something else is blocking wait in the wartimes home cell....? Weird.

Interesting that sneak detected and in combat are the same as allowing wait in other instances. But then the message is different so it's probably as expected. 

Link to comment
42 minutes ago, Monoman1 said:

Belethors shop (after hours, can't wait) -> 00043104

Warmaidens (after hours, can't wait) -> 00043104

 

Both of these have the 13th bit in flags2 set, which means the player is trespassing.

In your case, it's clearly not a trespassing issue as the bit isn't set.

 

I need you to find all the game settings with that same message and create an override plugin with a different message for each and then tell me which game setting is the one being shown on the cell with the issue.

 

Here is an xEdit script to find all game settings with a specific message.

unit SettingFromText;

var
    text: string;

function Initialize: integer;
begin
    result := 1;
    if not InputQuery('Game Setting', 'Text', text) then
        exit;
    text := Trim(text);
    if text = '' then
        exit;
    result := 0;
end;

function Process(e: IInterface): integer;
var
    data: IwbElement;
    dataText: string;
begin
    result := 0;
    if Signature(e) <> 'GMST' then
        exit;
    data := ElementByPath(e, 'DATA\Name');
    if not Assigned(data) then
        exit;
    dataText := GetEditValue(data);
    if SameText(dataText, text) then
        AddMessage('[' + EditorID(e) + '] ' + dataText);
end;

function Finalize: integer;
begin
    result := 0;
end;

end.

 

Just select all of your plugins and apply this script.

Link to comment
59 minutes ago, jmf890 said:

Just select all of your plugins and apply this script.

Sorry but it's returning no results (nothing being printed to the log). No errors either though.

 

Tried searching (without quotes):

'Better not. I'm only get myself caught doing that.'

'Better not'

'the'

'a'

Link to comment

Works for me with the vanilla message.

 

Text: You cannot wait while trespassing.

[00:00] Start: Applying script "<new script>"
[sNoWaitTrespass] You cannot wait while trespassing.
[00:26] Done: Applying script "<new script>", Processed Records: 1160843, Elapsed Time: 00:26

 

The case doesn't matter, but the text you input must be exactly like it's on Data/Name of the setting.

Also, it takes a while to finish because it will have to go through every single form from all of your plugins. Just make sure you select all of your loaded plugins.

Link to comment
1 hour ago, jmf890 said:

Works for me with the vanilla message.

Sorry sorry. You're spot on. I copied the text from my OP but there was a mistake in it. This is the exact line for the record: 

1.jpg.af41263e9f10f164983ce90d40866a7a.jpg

 

So I got these results:

Applying script...
[sNoWaitWarnToLeave] Better not. I'm only going to get myself caught by doing that.
[sNoWaitTrespass] Better not. I'm only going to get myself caught by doing that.
[Apply Script done]  Processed Records: 1746834, Elapsed Time: 00:46

 

and created this plugin:

2.jpg.076cd1a734f9db583205b8f286670c0d.jpg

 

3.png.8f5b26b3ce4a8d84786391f1c977fb66.png

 

4.png.cd9ceb58de6a04bd7dc228d09e4b263c.png

 

And this is what I got in game when trying to wait in the wartimes home cell:

5.jpg.9869d62f1f8db31f37fabf67ff63a116.jpg

 

So it seems to be gamesetting: 101CDA

 

 

Link to comment

Since you already have Cheat Engine installed, this is how you reset this specific cell flag.

  1. Launch the game, attach CE and get inside the problematic cell.
  2. On CE, click Memory View.
  3. On the top pane (instructions pane), right-click and select Go to address and input "TESV.exe+339B19".
  4. Once on that instruction "mov dx,[ecx+2C]", right-click it and select Toggle breakpoint. It should now be highlighted green.
  5. Go back to the game and press the key to wait. This should freeze the game as the breakpoint triggers.
  6. Go back to CE and you now have the pointer to the current cell's object in the register ecx.
  7. Click ECX on the top-right corner of the instruction pane and copy the address.
  8. Go back to the main CE window and Add Address Manually.
  9. Address should be what you just copied + 0x2C (example: 0xAABBCCDD+0x2C), type should be 2 bytes and DON'T toggle pointer this time.
  10. Ok, you now have access to the cell's flags... or at least part of it. The bitflag you want to clear is the one at the 10th bit (lsb to msb). The engine checks if the bitflag 0x0200 is set, and if it's, it prevents you from waiting/sleeping and sends the sNoWaitWarnToLeave notification.
  11. Simply do (flags & 0xFDFF) then write the result to the flags value (example: 0x0210 & 0xFDFF = 0x0010).
  12. Remove the breakpoint by right-clicking the instruction and selecting Toggle breakpoint again.
  13. Select Debug -> Run.

Tested on my end by setting the bitflag instead of clearing it at Whiterun and I was no longer able to wait, instead getting the same message as you, cleared it and I was again able to wait.

 

Fixing via Papyrus and SKSE plugin.

registry->RegisterFunction(
    new NativeFunction1<StaticFunctionTag, SInt32, TESObjectCELL*>("ClearCellWarnToLeave", "CustomFixes", [](StaticFunctionTag*, TESObjectCELL* cell) -> SInt32
    {
        if (cell == nullptr)
            return -1;
        return (UInt16)InterlockedAnd16(&cell->unk2C, 0xFDFF);
    },
    registry)
);

 

Link to comment
47 minutes ago, jmf890 said:

this is how you reset this specific cell flag.

Ah ok. Wow. I don't know how you do this black magic my friend but that worked! :)

Really appreciate your effort and er... patience ;)

 

Spoiler

7.jpg.024d42ff47f8737ab3d64fda5928e191.jpg

 

 

Maybe you should consider posting a SKSE plugin yourself ?

I realize it's such a small problem and not many people are going to be affected but still. It's a pretty annoying bug. 

 

Link to comment

I don't even know why I went through the trouble of guiding you on breakpoints when all ObjectReferences already have a pointer to their current cell, including the player reference object which is a derived class of Actor, which in turn is a derived class of ObjectReference.

 

This is all that was needed for you to access those flags...

98fdn347j57sbd36.PNG.b03ce1125c0d0b9122d13c489d6e4432.PNG

 

It's too warm and I am tired, so pardon me.

 

EDIT: Also edited the SKSE plugin examples as to make the clearing atomic.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use