Jump to content

Need help - attaching keyword to cockpit but it never registers


COCayneT

Recommended Posts

As the title says.

More info: I need to attach a keyword to the cockpit furniture. I can do this successfully, from a created reference (workshop object) with my script attached to it. The problem is, the keyword never gets recognized by the game. I have traced my code and the keyword applies fine, but the game never adjusts it's behavior as intended because it's still running the code as if the keyword doesn't exist.

The game seems to hold the cockpit in a persistent state, including whatever scripts are running on it. Changing ships, loading the game, nothing works. I have tried adding the keyword to all cockpits manually and that works fine, because the keyword is there when the game boots.

I think you can imagine why I don't want to do it that way though, since I can think of a thousand ways that could cause problems later on in the game, and with other mod authors mods.

If anyone has any suggestions, I really need some help on this one.

Link to comment
Share on other sites

Is it a hardcoded Keyword, linked to a Default Object or a "regular" Keyword? Vanilla or mod added? What is the intended behavior of this keyword? Only checking whether the reference has it (e.g. Papyrus scripted HasKeyword or Quest Alias >> Fill Conditions >> HasKeyword) or something else like FurnitureUse3rdPersonRigInFirstPerson [KYWD:0020FF95].

Link to comment
Share on other sites

Posted (edited)

Edit: As far as I can tell, the keyword (below) is linked to only one object in the game by default, and that's the StarbornPuzzleAbsorbPower furniture. It's attached the the DO of the same name: FurnitureAllowZeroGravityUse_DO. Keyword is described as "Keyword to ignore zero-gravity restrictions on non-terminal furniture activation." Without this keyword attached (and recognized by the game during furniture activation) the player cannot use furniture in zero gravity.

 

Its a vanilla keyword FurnitureAllowZeroGravityUse . I can add it manually in CK to all the base vendor cockpit furniture objects, and then the intended behavior (literally what the keyword says) works fine, but adding it with my script doesn't work. I am assuming the behavior is something hard coded because the message displayed to the player when they attempt to use furniture in zero gravity is something like "You cannot use this in ZeroG" and I have not been able to find that message in any kind of form after hours of pouring through forms. Most messages are either message objects or text replacements and I can't find it in either one.

I even tried looking through quests and quest scripts to see if it was being sent there. Wherever that message is stored, I believe it is being displayed by the "PilotSeatFurnitureScript" that is attached to all pilot seat base objects, and is set (somewhere) to the property variable "PilotSeatNotAuthorizedMessage." Something is overriding this behavior, and it doesn't appear to be part of the source scripts. I hope I am wrong, or that there is some other method to attach that keyword dynamically so I don't have to release my mod with modified vanilla records in case someone else ever modifies the PilotSeat object.

If you are able to find anything I would appreciate a heads up, or if you are aware of a way to debug through the functions that are causing this. Any 3rd party tool  you know of that can help me step through where this is being set, or am I limited to the papyrus logs that I am writing myself, cause that seems impossible.

Either way, thanks for responding. After hours and hours of scripting and debugging, this is the last issue I need to resolve before I can release a (very much) improved Gravity Switch update, or else I have to release a potentially conflicting mod, or just disable fast travel in Zero Gravity to prevent locking players into the pilot seat when they arrive at their destinations. The mod is a lot more fun when you can enter/exit the seat regardless of gravity, and a lot more cumbersome otherwise.

Edited by COCayneT
Link to comment
Share on other sites

Well, just took the starfield exe into the hex editor and realized the message I was looking for is right there in plaintext... So, any way to work around hard coded behavior without adding a DO keyword to vanilla base forms? 

Link to comment
Share on other sites

Maybe the vanilla code checks HasKeyword FurnitureAllowZeroGravityUse like activatedRef.GetBaseObject().HasKeyword(FurnitureAllowZeroGravityUse) so attaching the Keyword at runtime doesn't work.

Update: I made a simple patch (SFSE) to bypass the keyword check globally. Yes, it seems you need to edit the base form.

Link to comment
Share on other sites

5 hours ago, LarannKiar said:

Maybe the vanilla code checks HasKeyword FurnitureAllowZeroGravityUse like activatedRef.GetBaseObject().HasKeyword(FurnitureAllowZeroGravityUse) so attaching the Keyword at runtime doesn't work.

Update: I made a simple patch (SFSE) to bypass the keyword check globally. Yes, it seems you need to edit the base form.

The message that is displayed from that check is actually set in the gameplay options in CK which I discovered after finding it in the exe. So, I guess I will just release it with the base forms edited, and do some safety checks to make sure fast travel is blocked if the keywords isn't on the furniture in case my mod gets overridden by another mod on that form. What a bummer. Every other instance of blockactivation is triggered by some script in the  source code, of course this one is something I can't change dynamically for absolutely no reason.

Link to comment
Share on other sites

5 hours ago, LarannKiar said:

Maybe the vanilla code checks HasKeyword FurnitureAllowZeroGravityUse like activatedRef.GetBaseObject().HasKeyword(FurnitureAllowZeroGravityUse) so attaching the Keyword at runtime doesn't work.

Update: I made a simple patch (SFSE) to bypass the keyword check globally. Yes, it seems you need to edit the base form.

Actually, would you mind sharing how you used SFSE to bypass the keyword check? Why wouldn't I be able to duplicate that in papyrus in the ck?

Link to comment
Share on other sites

9 minutes ago, COCayneT said:

Actually, would you mind sharing how you used SFSE to bypass the keyword check? Why wouldn't I be able to duplicate that in papyrus in the ck?

I can think of 3 ways to bypass it.

       - force the keyword check function's return value to always 1 (that's what I did; "dirty hack" and it could be considered as quite an overkill for a mod, depending on what the desired result of course)

       - alter the behavior (mostly rewrite) the keyword check function (would require more decoding)

       - force add/remove the keyword to/from the target base form at runtime through SFSE (problem is that this would interfere with Starfield's New Game Plus code which is basically handled by a huge function that resets game data; in short, changes to base forms should be reverted to their "vanilla" state by the time the native code is about to perform the reset otherwise the vanilla process would crash the game).

I can upload the plugin to Google Drive folder if you're interested. Note that it simply makes the game ignore this keyword for all base forms (supposedly, haven't tested it that much) and make the code always allow the player to interact with any furniture in zero g. (It can be done with SFSE, in Visual Studio after decoding the affected functions).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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