Jump to content

Finding the "Workbench Keyword" of a Workbench in xEdit


pra

Recommended Posts

I had this idea for a Fo4Edit script which would group workbenches by type. I have a lot of mods which add workbenches, with custom workbenches as well (AWKCR and Horizon), and I'd like to end up with a menu looking like: Crafting -> Weapons -> [Weapon workbench A, Weapon Workbench B, ...] and Crafting -> Ammo Workbench -> [ammo WB A, ammo WB B, ...].

 

I think I can pull off most of the parts of this, my only problem is: a workbench has various keywords in it's KYWD, one of which is the one which defines it's type, but I don't see any way to telling which one it is programmatically.

 

My current idea is to try to look into COBJs and see if the keyword in question appears there, but, this probably isn't very reliable, or performant.

 

I guess I could try doing it the other way round, by blacklisting keywords like Workbench_General or FurnitureForce3rdPerson, but that isn't too reliable either..

 

 

So, does anyone know if there is any better way?

Link to comment
Share on other sites

I have a mod that map marks workbenches by type as they are used, but it uses a formlist of Workbench base furniture to match known indexes as I couldn't find keywords that cover all of them:

Furniture ThisWorkBenchType = akWorkBench.GetBaseObject() as Furniture
Int iIndex = 0
While iIndex < pSKK_QSWorkbenchList.GetSize()
	If ThisWorkBenchType == pSKK_QSWorkbenchList.GetAt(iIndex) as Furniture
 		If iIndex == 0
			Alias_FoundArmorWorkbench.AddRef(akWorkBench)
		ElseIf iIndex == 1 || iIndex == 2
			Alias_FoundChemistryWorkbench.AddRef(akWorkBench)
		ElseIf iIndex == 3 || iIndex == 4 || iIndex == 5 || iIndex == 6  || iIndex == 7  
			Alias_FoundCookingWorkbench.AddRef(akWorkBench)	
		ElseIf iIndex == 8 || iIndex == 9
			Alias_FoundPowerArmorWorkbench.AddRef(akWorkBench)	
		ElseIf iIndex == 10  || iIndex == 11
			Alias_FoundWeaponsWorkbench.AddRef(akWorkBench)	
		Else
			Alias_FoundUnknownWorkbench.AddRef(akWorkBench)
		Endif
	Endif
	iIndex +=1
Endwhile
Link to comment
Share on other sites

Neither of these is what I meant, but I think I made it work well enough.

 

I try to explain it another way: This is about F4Edit's .pas scripts, not CreationKit's .psc Scripts.

Constructible Objects (COBJ) have a "Bench Name" keyword (BNAM). This means, that this COBJ will appear in any workbench which has this keyword, in it's normal list of keywords. My question was, if I have a workbench and it's list of keywords, how can I tell which of those is the one used in BNAMs.

 

I ended up logging the BNAMs in any COBJ the script is called on, and storing them in a file.

 

Now the only problem is that I can't get my new custom menu to work with SMM, but that's a different issue.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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