Jump to content

FO4 Help with contraptions DLC mod scripting


Recommended Posts

Hello readers

The past couple days I have been attempting to create a new builder using assets from the contraptions DLC. The intent is to make a builder for missiles, fusion cores and mini nukes, that I'm calling the "heavy ammo forge." I'm having some issues regarding papyrus scripts. I have considered adding these ammos to the already existing ammo builder, but here's why I'm against it: First, I am trying to avoid editing vanilla scripts so i don't have to reinstall FO4 to fix probable muck ups. Second, the ammo builder makes all items in sets of 10, and I would like the heavy ammo forge to produce individual items. I am not a scripter or modder by any means, but I opened this can of worms and am losing sleep thinking about it. If someone with more experience believes editing the vanilla script is the better option I'm all ears. at the end of the day, I just want to see nukes coming out of a forge.

 

Here's what is working

  • My "heavy ammo forge" shows up if game and is buildable
  • In the CK, crafting recipe has been set up on the forge with perk restrictions for each item
  • It connects to the terminal and shows the correct menu and submenu

Here's what is  not working

  • The forge seems to be hijacking a part of the "builder" item script, and shows New Nuka Cola truck and it's recipe for each ammo in the submenu
  • I cannot get the script I made to compile or show up
  • I do not know how to link the script to my object 

Here's my script. I copied the "Builder" item script and edited the objectreference and number of recipes to match that of my forge (refid is 02001ED1 for my instance of CK)

Spoiler

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
Scriptname DLC05:Fragments:Terminals:TERM_DLC05nativeWorkshopBuil_02001ED1 Extends Terminal Hidden Const

;BEGIN FRAGMENT Fragment_Terminal_01
Function Fragment_Terminal_01(ObjectReference akTerminalRef)
;BEGIN CODE
SetRecipe(0, akterminalRef)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_Terminal_02
Function Fragment_Terminal_02(ObjectReference akTerminalRef)
;BEGIN CODE
SetRecipe(1, akterminalRef)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_Terminal_03
Function Fragment_Terminal_03(ObjectReference akTerminalRef)
;BEGIN CODE
SetRecipe(2, akterminalRef)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

function SetRecipe(int newRecipeIndex, ObjectReference terminalRef)
    ObjectReference[] linkedRefArray = terminalRef.getLinkedRefArray(LinkTerminalKeyword)

    DLC05:WorkshopBuilderScript builderRef

    int i = 0
    while i < linkedRefArray.length
        ObjectReference theObject = linkedRefArray 
        debug.trace(self + " " + i + ": " + theObject)
        if theObject is DLC05:WorkshopBuilderScript
            (theObject as DLC05:WorkshopBuilderScript).SetCurrentRecipeIndex(newRecipeIndex)
            if builderRef == NONE 
                builderRef = (theObject as DLC05:WorkshopBuilderScript)
            endif
        endif
        i += 1
    endWhile
    
    ; set up text replacement data
    if builderRef 
        DLC05Init.SetTextReplacementData(terminalRef, builderRef, newRecipeIndex)
    endif
EndFunction

Keyword Property LinkTerminalKeyword Auto Const

DLC05:DLC05InitScript property DLC05Init auto const mandatory 

The error it gives me is as follows:

Spoiler

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_DLC05nativeWorkshopBu_02001ED1_1"...
C:\Users\borba\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals\TERM_DLC05nativeWorkshopBu_02001ED1_1.psc(8,0): no viable alternative at input 'Scriptname'
C:\Users\borba\AppData\Local\Temp\PapyrusTemp\Fragments\Terminals\TERM_DLC05nativeWorkshopBu_02001ED1_1.psc(0,0): error while attempting to read script Fragments:Terminals:TERM_DLC05nativeWorkshopBu_02001ED1_1: Object reference not set to an instance of an object.
No output generated for Fragments:Terminals:TERM_DLC05nativeWorkshopBu_02001ED1_1, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Fragments:Terminals:TERM_DLC05nativeWorkshopBu_02001ED1_1
 

 

If anyone knows an answer or a resource that might help me find the answer, I'm all ears. Modding isn't a hobby of mine nor do I have the time to make it one, and as such I'm trying to avoid a hundred hours of tutorials and practicing to make this happen. Once it's working I'm more than happy to share it, or if someone with some experience under their belt wants to take this and make it happen, send it. I was considering making one for power amor too until I started getting stonewalled by the CK.

Thanks for reading, Have a good day everyone!

Link to comment
Share on other sites

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...