Pyroteknics Posted October 31, 2022 Share Posted October 31, 2022 Hi all, I'm trying to make a new manufacturing machine mod that outputs various items (for example Nuka Cola bottles) but having problems in game with the terminal not showing the required items when you select it and only builds the first item in the list no matter which option is picked. Everything else (the menu placement, model, name in build menu etc) appears to work fine. I based it from an existing machine as a reference - the Food Processor from official Contraptions Workshop. Not seen/found any tutorials online on how to make a manufacturing machine mod so had to reverse engineer an existing one. The Setup (Creation Kit Form Types)A construction object (COBJ) with basic build information and what object to create (below, a container).A container (CONT) again with basic information, a native terminal (linked to below), keywords including a unique one to link the terminal. This also has 2 papyrus scripts copied over from the Food Processor. Screenshot.Screenshot of script 'dlc05:workshopbuilderscript). The only items I have changed in here are the 'RecipeList' and the 'RecipeItems' and placed in a specific order.Keywords (KYWD) for terminals to link. Doesn't seem to be any data to set in here anyway.Terminal (TERM) screenshot and Terminal Sub Menu screenshot. The terminal points to the correct sub menu and the sub menu points to 'DLC05nativeWorkshopBuilderTerminalSubmenuDisplayRecipe' like it does with the Food Processor and even other mods.In GameI can see the new machine in the correct category (Resources > Power > Manufacturing > Machinery) and able to place it no problem, can power it and snap to other conveyors etc and powered up OK.Connecting a terminal to the machine it shows the first menu OK (screenshot),Selecting menu item loads sub menu (screenshot) that lists the available items to build.When picking what I want to build it doesn't show the build items (screenshot) and only builds the first item that should be there even if you pick something else.I am honestly not sure what I am missing here? The only thing I have seen comparing back and forth with something like the Food Processor and other mods is that a terminal sub menu has a 'Papyrus Fragment' section but always comes up with 'Failed to load code for fragment Fragment_Terminal_01' while I don't have one in mine, maybe this is the problem? Any help/pointers would be greatly appreciated. Link to comment Share on other sites More sharing options...
iqoniq Posted November 1, 2022 Share Posted November 1, 2022 The issue with the fragments and source missing is basically just that. The source code for most of the base game scripts was included in the CK, but I don't think they did the same with DLC. You can decompile it with Champollion ( https://www.nexusmods.com/fallout4/mods/3742 ) though, and then make sure the source files are in the correct place. Link to comment Share on other sites More sharing options...
Pyroteknics Posted November 1, 2022 Author Share Posted November 1, 2022 (edited) Thanks for the reply! The only PEX files I can see that sound like they belong to manufacturing and have similar names are in Fallout 4\Data\Scripts\DLC05\Fragments\Terminals where there are 4 files each starting with 'TERM_DLC05nativeWorkshopBuil_xyz' where xyz is a unique 8 character ID. I have used Champollion to extract the files from .pex to .pcs to make them readable (copied them to a different folder before decompiling) and loaded the 4 files up and each one seems identical? They all contain references to DLC05Init.SetRecipeXX where the last number varies with some going up to 15 recipes and another going up to 7. Bellow is an extract of the smallest one that refers to 7 recipe items: ;/ Decompiled by Champollion V1.0.6 PEX format v3.9 GameID: 2 Source : C:\Users\samrd\AppData\Local\Temp\PapyrusTemp\DLC05\Fragments\Terminals\TERM_DLC05nativeWorkshopBuil_01000A72.psc Modified : 2017-05-10 12:25:52 Compiled : 2017-05-10 12:25:53 User : samrd Computer : WINDOWS-JORQT6J /; ScriptName DLC05:Fragments:Terminals:TERM_DLC05nativeWorkshopBuil_01000A72 extends Terminal Const hidden ;-- Properties -------------------------------------- dlc05:dlc05initscript Property DLC05Init Auto Const mandatory Keyword Property LinkTerminalKeyword Auto Const ;-- Variables --------------------------------------- ;-- Functions --------------------------------------- Function Fragment_Terminal_03(ObjectReference akTerminalRef) DLC05Init.SetRecipe(2, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_01(ObjectReference akTerminalRef) DLC05Init.SetRecipe(0, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_02(ObjectReference akTerminalRef) DLC05Init.SetRecipe(1, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_07(ObjectReference akTerminalRef) DLC05Init.SetRecipe(6, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_04(ObjectReference akTerminalRef) DLC05Init.SetRecipe(3, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_06(ObjectReference akTerminalRef) DLC05Init.SetRecipe(5, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_05(ObjectReference akTerminalRef) DLC05Init.SetRecipe(4, akTerminalRef, LinkTerminalKeyword) EndFunction At least this part now seems to make sense as this seems to match (on a Food Processor example) when looking at the container object, papyrus script and 'dlc05:workshopbuilderscript' and setting each item (recipe) to build. But still no reference to the script name anywhere and its unique 8 character ID. Now the question is, what do I need to add to the terminal sub menu item under papyrus fragment? I'm guessing it's not as easy as copying the decompiled code and pasting it into the window? Edited November 1, 2022 by Pyroteknics Link to comment Share on other sites More sharing options...
iqoniq Posted November 1, 2022 Share Posted November 1, 2022 The bit that would need dropping in the fragment is one of the lines between the functions. However, notice the properties. One of these is referencing a script, which you also need, but some good news. I've found out that there is indeed the source code buried in the source folders. I didn't realise this before, and it was only when I noticed the properties, and it made me think of something else (it's referencing a separate script which is in the zip). Anyway, go to Scripts\Source\DLC05 and if the source files aren't there then there should be a zip called DLC05.zip. Just drag the contents of that into the source folder and let it merge the DLC05 folders and overwrite or whatever it wants to do. That zip appears to be all the scripts related to the machines so you should be able to find what you want in there. If you don't have this file then let me know in a PM and I'll see if I can get it to you somehow. The file you really need to be paying attention to now, appears to be DLC05InitScript.psc. This contains all the functions, that the fragment is calling on. DLC05Init.SetRecipe is calling a function in the DLC05InitScript so you'll need to have a look at what it's doing and how it's doing it. I also think (not sure) it's referencing another script (WorkshopBuilderScript.psc) at some point (line 134 - DLC05:WorkshopBuilderScript builderRef) so it might be worth checking that one out as well. I'll be honest, this is starting to get above where I'm at as far as scripting goes, and while I kind of understand what it's doing, I probably won't be able to help much further regarding it (although I may surprise myself). Link to comment Share on other sites More sharing options...
Pyroteknics Posted November 1, 2022 Author Share Posted November 1, 2022 (edited) Nice find on those zipped scripts, I have found them in the path you listed and extracted them to the same location. Trying both the contents of DLC05InitScript.psc and WorkshopBuilderScript.psc unsurprisingly comes up with errors when copying and pasting into the papyrus fragments section in terminal sub menu object... Papyrus Compiler Version 2.8.0.4 for Fallout 4 Copyright (C) ZeniMax Media. All rights reserved. Starting 1 compile threads for 1 files... Compiling "Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57"... C:\Users\Pyro\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals\TERM_DLC05Workshop_EvenMoreM_04004C57.psc(7,0): no viable alternative at input 'Scriptname' C:\Users\Pyro\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals\TERM_DLC05Workshop_EvenMoreM_04004C57.psc(0,0): error while attempting to read script Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57: Object reference not set to an instance of an object. No output generated for Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57 So looks like it is giving the papyrus fragment file its own unique 8 character reference in the compiler and trying to dump it into C:\Users\UserName\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals but failing. Still, like you said, there are references in DLC05InitScript that point to WorkshopBuilderScript (7 references) but there are no references in WorkshopBuilderScript that point to DLC05InitScript (but there is 1 reference of just DLC05Init on line 99 but the rest of it is DLC05Init.IncrementBuilderAchievement() ). I will play around with it more tomorrow after work, already taken hours to decipher just this much! Edited November 1, 2022 by Pyroteknics Link to comment Share on other sites More sharing options...
iqoniq Posted November 1, 2022 Share Posted November 1, 2022 Now that's something I didn't know it could do. In the Terminal fragment section, what does it say the script should be called in the advanced section? It could be that the fragment is expecting it to be called script_a1b2c3d4 or something like that, but the Scriptname header is different. You can click edit to go into the source of the terminal so you could check the header matches the filename. Link to comment Share on other sites More sharing options...
RaidersClamoring Posted November 2, 2022 Share Posted November 2, 2022 Trying both the contents of DLC05InitScript.psc and WorkshopBuilderScript.psc unsurprisingly comes up with errors when copying and pasting into the papyrus fragments section in terminal sub menu object... Did you pencil in whatever properties the script/functions you intend to use might be pointing at? Link to comment Share on other sites More sharing options...
Pyroteknics Posted November 2, 2022 Author Share Posted November 2, 2022 In the Terminal fragment section, what does it say the script should be called in the advanced section?Looking in the terminal sub menu, each menu item just says 'no fragment' in the papyrus fragment advanced section. Each menu item can be assigned a script so maybe something needs to be trimmed down per recipe item. If I type a bit of rubbish in the fragment section for a menu item, click another menu item and come back to the same one so it refreshes only then the Advanced tab shows up with the following info: Script Name - TERM_DLC05Workshop_EvenMor_04004C57_2Namespace - Fragments:Terminals Interestingly, that 8 character ID matches the output from the compiler before. I have tried a few short snippets in here but still the same compiler output error as previous post. RaidersClamoring, on 02 Nov 2022 - 8:17 AM, said:Did you pencil in whatever properties the script/functions you intend to use might be pointing at? Looking at the contents of WorkshopBuilderScript.psc is the only references I can see that refers to the recipe list (snippet below) that is in this screenshot when looking at the container attached script 'dlc05:workshopbuilderscript'. group recipeList recipeComponent[] property recipe00 Auto const recipeComponent[] property recipe01 Auto const recipeComponent[] property recipe02 Auto const ... recipeComponent[] property recipe13 Auto const recipeComponent[] property recipe14 Auto const recipeComponent[] property recipe15 Auto const Unfortunately even trying to pick and choose what I need isn't brining any luck. E.g. in the terminal sub menu, menu index and ID 1, the sub menu option here like other manufacturing machines (official DLC and mods) is set to DLC05nativeWorkshopBuilderTerminalSubmenuDisplayRecipe per menu item. I'm assuming then there is something to do with the script that links this menu item to the container script where you define each item recipe and the total list of items. While I am still playing around (without much luck), I have messaged a mod author of a manufacturing machine to ask for help on this to see how they did it and sent a link to this post - hopefully I get a reply. Link to comment Share on other sites More sharing options...
Pyroteknics Posted November 12, 2022 Author Share Posted November 12, 2022 I have been playing with this again lately and had a reply from 'wrathmaniac' (author of Better Manufacturing) after messaging him and has given some useful information though he admits its been a while since he's done anything like this. Using FOEdit I have seen that a terminal sub menu needs to have some properties to it with one being DLC05Init (mentioned above a few times above) as well as adding a link terminal keyword which I have now added - screenshot. Wrathmaniac also advised scripts need to be saved as PSC files and put in Fallout 4\Data\Scripts (or Fallout 4\Data\Scripts\Source\User\Fragments\Terminals) and, based off his example in his mod, I now have my external PCS file like this (9 entries for 9 items to build): ScriptName Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57 extends Terminal Const hidden ;-- Properties -------------------------------------- Keyword Property LinkTerminalKeyword Auto Const dlc05:dlc05initscript Property DLC05Init Auto Const mandatory ;-- Variables --------------------------------------- ;-- Functions --------------------------------------- Function Fragment_Terminal_01(ObjectReference akTerminalRef) DLC05Init.SetRecipe(0, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_02(ObjectReference akTerminalRef) DLC05Init.SetRecipe(1, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_03(ObjectReference akTerminalRef) DLC05Init.SetRecipe(2, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_04(ObjectReference akTerminalRef) DLC05Init.SetRecipe(3, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_05(ObjectReference akTerminalRef) DLC05Init.SetRecipe(4, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_06(ObjectReference akTerminalRef) DLC05Init.SetRecipe(5, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_07(ObjectReference akTerminalRef) DLC05Init.SetRecipe(6, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_08(ObjectReference akTerminalRef) DLC05Init.SetRecipe(7, akTerminalRef, LinkTerminalKeyword) EndFunction Function Fragment_Terminal_09(ObjectReference akTerminalRef) DLC05Init.SetRecipe(8, akTerminalRef, LinkTerminalKeyword) EndFunction It would seem the CK gave the script name as TERM_DLC05Workshop_EvenMoreM_04004C57 which I have also put into the file above. The unique ID at the end of the file matches the refID of the terminal sub menu object in the CK. I am now not sure how to get the script in CK to look at this 'external' PCS file as I have tried both the first line only (ScriptName Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57 extends Terminal Const hidden) in the compiler as well as the entire contents of the PCS file (above) and comes up with the following error now: Papyrus Compiler Version 2.8.0.4 for Fallout 4 Copyright (C) ZeniMax Media. All rights reserved. Starting 1 compile threads for 1 files... Compiling "Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57"... C:\Users\Pyro\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals\TERM_DLC05Workshop_EvenMoreM_04004C57.psc(47,0): missing EndOfFile at 'Scriptname' No output generated for Fragments:Terminals:TERM_DLC05Workshop_EvenMoreM_04004C57, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. I'm assuming it temporarily puts the script used in the CK into C:\...\AppData\Local\Temp but the actual PCS file is in a different drive (D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\Fragments\Terminals) but I can't work out the actual error missing EndOfFile at 'Scriptname' - Looking at other scripts it appears to be the same with formatting etc? Not sure what else I am missing now, seems to be quite close to working but now this error isn't helping - anyone else come across this before? Link to comment Share on other sites More sharing options...
GlorfindelCotton Posted October 18, 2023 Share Posted October 18, 2023 Hi mate it looks like you managed to get this done, as I see you popped an article on the nexus. I've been trying to follow it, but cannot get it to work - the terminal entry for my machine simply does not appear on the terminal. I also found out that when I start fresh I am able to edit workshopbuilderscript properties, as soon as I save the esp and load ck again I cannot edit those properties anymore as if the script was no longer there. Any hint? Should a copy of that script be saved somewhere else?Thanks Link to comment Share on other sites More sharing options...
Recommended Posts