Jump to content

Approaches/mod to disable NPC clothing/armor locking


Recommended Posts

I keep a party of many companions when I play that I like to try various outfits and armor mods on. I also change outfits on other NPCs in the game. I have a couple dozen clothing and armor mods at this point. My workflow in-game is to "bat giveclothing" script a few hundred outfits/armors/accessories to an NPC and then try them on in the openactorcontainer dialog to find what looks best (I also modify their carryweight). Some of the wearable items, when equipped, go into locked status and then don't show up in container inventory anymore so they can't be directly unequiped from the dialog. Some of them lock but then don't logically remove when replaced with a similar item, I'm sure due to the slots used by the mod. Others play nice, usually pieces and not whole outfits, and do not lock at all so you can easily equip them on and off right from the container dialog (I wish they all did that!). Because of the large amount I put in their inventory, "showinventory" from the console is tedious to use to try to find the locked item, sometimes I don't get enough buffer in the developer window to even see it all. Running unequip commands is tedious too, I'd like to see if it is possible to just prevent the items from locking in the first place.

 

Is there a mod to prevent inventory armor/clothing locking? Is that mod-able somehow in the ARMO records of the clothing items themselves or is it better to look at making a script in CK? I'm not sure what the script would be attached to, perhaps the NPCs themselves. Is it even change-able because I have not seen any mods for it? I do small modding through FO4edit and CK so please throw any technical stuff at me. Thanks for any pointers!

 

Link to comment
Share on other sites

The companions lock the armor. The best approach I can think of would be to build a patch that list all companions, both vanilla and modded that you use. There is a keyword, ShowWornItem or ShowWornItems something like that. I'm not where I can look it up right now. Use the patch to add that keyword to each of your companions.

 

The keyword to add to your companions is ShowWornItemsKeyword, I just looked it up.

Edited by Pelgar
Link to comment
Share on other sites

It might worth mentioning that unlike the console command AddKeyword, RemoveKeyword doesn't exist so you won't be able to remove the keyword from the companion in the console. I think ResetKeyword is missing too. If you know how to do that, by applying a keyword through a quest alias (e.g., RefCollectionAlias, linked to Followers quest > ActiveCompanions), this issue can easily be solved.

Link to comment
Share on other sites

The companions lock the armor. The best approach I can think of would be to build a patch that list all companions, both vanilla and modded that you use. There is a keyword, ShowWornItem or ShowWornItems something like that. I'm not where I can look it up right now. Use the patch to add that keyword to each of your companions.

 

The keyword to add to your companions is ShowWornItemsKeyword, I just looked it up.

This is helpful info. I have to research more to completely understand it I have not used keywords yet. My modding has been more script and small cell mods (like player tent locations). There are probably multiple ways to attack it and this might be one of them to make the the worn items at least show up in inventory so there isn't a need to go to the console.

 

When I say "companions" I mean that loosely to include not just companions that work through the game's companion system but including the unlimited companion mod that lets you pick infinite "combat companions", as well as NPCs around that do not become followers. I'm trying to understand this behavior, why it happens. Why sometimes when i load stuff into their inventory sometimes the seem to random equip some gear, sometimes not even what I just gave them. Why certain armors lock while others do not, even if they cover the same areas of the body. i think it's a specific slot that triggers its.

 

Thanks for the help!

 

Update: I can't believe it was just that easy. Selected the NPC from the console, entered: AddKeyword ShowWornItemsKeyword and voila, the disappearing worn items stay in the inventory list and can be undone. I've been using the console a long time and keywords are new, I'll have to check out what can be done with them. I noticed AddKeyword command is not in the fandom page for console commands which I had considered comprehensive. Thanks again!

Link to comment
Share on other sites

 

When I say "companions" I mean that loosely to include not just companions that work through the game's companion system but including the unlimited companion mod that lets you pick infinite "combat companions", as well as NPCs around that do not become followers. I'm trying to understand this behavior, why it happens. Why sometimes when i load stuff into their inventory sometimes the seem to random equip some gear, sometimes not even what I just gave them. Why certain armors lock while others do not, even if they cover the same areas of the body. i think it's a specific slot that triggers its.

 

Thanks for the help!

 

Update: I can't believe it was just that easy. Selected the NPC from the console, entered: AddKeyword ShowWornItemsKeyword and voila, the disappearing worn items stay in the inventory list and can be undone. I've been using the console a long time and keywords are new, I'll have to check out what can be done with them. I noticed AddKeyword command is not in the fandom page for console commands which I had considered comprehensive. Thanks again!

 

The game's .exe starts the main MovieClip in the interface (.swf) file ContainerMenu in different UI modes (with a public variable) depending on the inventory target. If the target reference is a "player teammate" (GetPlayerTeammate > 0), the MovieClip is running in "teammate mode". For teammates, equipped oufits (it's Biped Slot 33 if I'm remembering right) are not visible because the .exe does not add them to the inventory items array. It's probably for the "Take All" button (to prevent the player from accidentally undressing the NPC). The keyword disables this "exclude if equipped" feature, it's referenced by a Default Object.

 

I haven't seen an online source that truly contains all console commands. The only comprehensive list can only be seen by examinating the .exe.

Edited by LarannKiar
Link to comment
Share on other sites

  • 2 weeks later...

It might worth mentioning that unlike the console command AddKeyword, RemoveKeyword doesn't exist so you won't be able to remove the keyword from the companion in the console. I think ResetKeyword is missing too. If you know how to do that, by applying a keyword through a quest alias (e.g., RefCollectionAlias, linked to Followers quest > ActiveCompanions), this issue can easily be solved.

 

O wow! Do you know of anyone who has attempted to make a RemoveKeyword or ResetKeyword command??? Because that's just...ooooof...weird. This makes me think that the game possibly removes keywords people aren't supposed to have over time. I'm gonna have to test this on my playthrough rn. I gotta know how long it is, because I just can't believe that there's no way the game doesn't reset or remove keywords itself if there's no commands for it, but then again...it is a weird engine.

Link to comment
Share on other sites

O wow! Do you know of anyone who has attempted to make a RemoveKeyword or ResetKeyword command??? Because that's just...ooooof...weird. This makes me think that the game possibly removes keywords people aren't supposed to have over time. I'm gonna have to test this on my playthrough rn. I gotta know how long it is, because I just can't believe that there's no way the game doesn't reset or remove keywords itself if there's no commands for it, but then again...it is a weird engine.

 

You can create a custom pseudo-command using Macros and a global function

 

To register the macro, enter:

 

Macro RemoveKeyword cgf "MyScript.ForceRemoveKeyword"

 

And in MyScript you create the global ForceRemoveKeyword function with matching parameters (it can't be called "RemoveKeyword" because that's already defined in ObjectReference-script) and optionally a notification function that prints to console.

 

Function ForceRemoveKeyword(int KeywordID) Global
ObjectReference ref = Game.GetCurrentConsoleRef()
Keyword kw = Game.GetForm(KeywordID) as Keyword
; usually GetFormFromFile is better but in this case it would entail also entering the master/mod name. This is more conformant with console syntax.
If (ref.HasKeyword(kw))
ref.RemoveKeyword(kw)
EndIf
string success = "Removal of keyword " + kw.GetName() + " from " + ref.GetDisplayName() + " "
If (ref.HasKeyword(kw))
success += "failed."
Else
success += "succeded."
EndIf
Notify(success)
EndFunction

Function Notify(string cMsg) Global
var[] arguments = new var[1]
arguments[0] = (cMsg + "\n") as string
UI.Invoke("Console", "root1.AnimHolder_mc.Menu_mc.AddHistory", arguments)
EndFunction

 

PS: One improvement to the above would be to allow input of hex string for the ID instead of decimal, which it only accepts now. You would then make these changes:

 

Function ForceRemoveKeyword(string KeywordIDHex) Global
Var[] args = new Var[2]
args[0] = KeywordIDHex
args[1] = 16
Var res = Invoke("Console", "parseInt", args)
int KeywordID = res as int....
Link to comment
Share on other sites

 

It might worth mentioning that unlike the console command AddKeyword, RemoveKeyword doesn't exist so you won't be able to remove the keyword from the companion in the console. I think ResetKeyword is missing too. If you know how to do that, by applying a keyword through a quest alias (e.g., RefCollectionAlias, linked to Followers quest > ActiveCompanions), this issue can easily be solved.

O wow! Do you know of anyone who has attempted to make a RemoveKeyword or ResetKeyword command??? Because that's just...ooooof...weird. This makes me think that the game possibly removes keywords people aren't supposed to have over time. I'm gonna have to test this on my playthrough rn. I gotta know how long it is, because I just can't believe that there's no way the game doesn't reset or remove keywords itself if there's no commands for it, but then again...it is a weird engine.

 

 

Here's a custom script.

 

Source code:

 

 

; Removes 'theKeyword' from 'targetRef'
Function RemoveKeywordCustom(ObjectReference targetRef, Keyword theKeyword) Global
	If !(targetRef as ObjectReference)
		Debug.Notification("RemoveKeywordCustom :: ERROR: parameter 'targetRef' is not a valid Object Reference. Aborting.")
		Return None
	EndIf
	If !(theKeyword as Keyword)
		Debug.Notification("RemoveKeywordCustom :: ERROR: parameter 'theKeyword' is not a valid Keyword. Aborting.")
		Return None
	EndIf
	If targetRef.HasKeyword(theKeyword) == False
		Debug.Notification("RemoveKeywordCustom :: ERROR: the specified 'targetRef' does not have the specified 'theKeyword' attached to it. Aborting.")
		Return None
	EndIf
	targetRef.RemoveKeyword(theKeyword)
	If targetRef.HasKeyword(theKeyword) == False
		Debug.Notification("RemoveKeywordCustom :: SUCCESS: the specified 'theKeyword' has been successfully removed from 'targetRef'.")
	Else
		Debug.Notification("RemoveKeywordCustom :: ERROR: the specified 'theKeyword' could not be removed from 'targetRef'.")
	EndIf
EndFunction

; Resets 'theKeyword' on 'targetRef' to their vanilla state
Function ResetKeywordCustom(ObjectReference targetRef, Keyword theKeyword) Global
	If !(targetRef as ObjectReference)
		Debug.Notification("ResetKeywordCustom :: ERROR: parameter 'targetRef' is not a valid Object Reference. Aborting.")
		Return None
	EndIf
	If !(theKeyword as Keyword)
		Debug.Notification("ResetKeywordCustom :: ERROR: parameter 'theKeyword' is not a valid Keyword. Aborting.")
		Return None
	EndIf
	bool HadKeyword = targetRef.HasKeyword(theKeyword)
	targetRef.ResetKeyword(theKeyword)
	bool HasKeyword = targetRef.HasKeyword(theKeyword)
	Debug.Notification("ResetKeywordCustom :: SUCCESS: the specified 'theKeyword' has been successfully reset on 'targetRef'. 'targetRef' previously had 'theKeyword' = [" + HadKeyword + "]. Currently (after resetting) has 'theKeyword' = [" + HasKeyword + "].")
EndFunction

 

 

 

Place them in these folders:

 

'Fallout 4\Data\Scripts\CustomGlobalFunctions.pex'

'Fallout 4\Data\Scripts\Source\User\CustomGlobalFunctions.psc'

 

.pex file: the compiled script that the game can read

.psc file: the source code of the script, human readable format, not necessary for the game

 

Use with the commands:

CGF "CustomGlobalFunctions.RemoveKeywordCustom" targetRef theKeyword

CGF "CustomGlobalFunctions.ResetKeywordCustom" targetRef theKeyword

Example: CGF "CustomGlobalFunctions.RemoveKeywordCustom" 2F1F ShowWornItemsKeyword ( this would remove 'theKeyword' (ShowWornItemsKeyword) from 'targetRef' (Piper, her RefID is 2F1F) )
Edited by LarannKiar
Link to comment
Share on other sites

It might worth mentioning that unlike the console command AddKeyword, RemoveKeyword doesn't exist so you won't be able to remove the keyword from the companion in the console. I think ResetKeyword is missing too. If you know how to do that, by applying a keyword through a quest alias (e.g., RefCollectionAlias, linked to Followers quest > ActiveCompanions), this issue can easily be solved.

You should be able to remove KW from NPCs with this console cmd:

 

cf "actor.removeKeyword" "KW"

HasKeyword cmd will return "0"

Edited by lee3310
Link to comment
Share on other sites

  • Recently Browsing   0 members

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