Jump to content

Conveyor Auto-sellers for Manufacturing


NiftyPower

Recommended Posts

Could someone add, or has someone added something similar to, a version of "Conveyor Workshop Storage" from Manufacturing Extended (https://www.nexusmods.com/fallout4/mods/15429) that auto-sells the items and puts the money value in the workshop instead?  I'm not sure how to get the Creation Kit to work with my GOG copy of Fallout 4, Caprica doesn't seem compatible with FO4SE, so I'm not able to create the mod myself, so I'm passing along the idea.

Another idea was to patch Automated Import and Export Manufacturing (https://www.nexusmods.com/fallout4/mods/36563) so when the exporter sells items, it generates caps stashes with specific cap amounts instead of individual caps (which produces a number of issues).

Link to comment
Share on other sites

I managed to get the Papyrus Compiler setup, although it was a mess to get the paths and files arranged properly.  I basically managed to get the first idea working, and here is the scripting I used (I did base this off of other people's code, and I haven't fully tested it yet):

Spoiler
ScriptName WorkshopConveyorVendorStorageScript Extends DLC05:WorkshopHopperScript

;-- Functions ---------------------------------------

Event OnTriggerEnter(ObjectReference akActionRef)
  If bAllowTriggerInput ; #DEBUG_LINE_NO:4
    If akActionRef.IsDisabled() == False ; #DEBUG_LINE_NO:5
      If akActionRef is Actor == False ; #DEBUG_LINE_NO:6
        If akActionRef.GetBaseObject() is Container ; #DEBUG_LINE_NO:7
          Self.AddContainer(akActionRef) ; #DEBUG_LINE_NO:8
          Self.StartCheckContainersTimer() ; #DEBUG_LINE_NO:9
        Else
          AddItem(akActionRef)
          Int iTotalValue = Self.GetInventoryValue()
          If (iTotalValue > 0)
            Int iResellProfit = ((iTotalValue as Float) * 0.2) as Int
            Int iCommission = ((iTotalValue as Float) * 0.05) as Int
            Int iPayOut = iTotalValue - iResellProfit + iCommission
            If (iPayOut > 0)
              miscobject temp25 = game.GetCaps()
              form temp26 = temp25 as form
              Self.GetLinkedRef(WorkshopItemKeyword).additem(temp26, iPayOut, false) ; #DEBUG_LINE_NO:11
            EndIf		
          EndIf
          Self.RemoveAllItems(NONE, false)
        EndIf
      EndIf
    EndIf
  EndIf
EndEvent

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  Int iTotalValue = akBaseItem.GetGoldValue() * aiItemCount
  If (iTotalValue > 0)
    Int iResellProfit = ((iTotalValue as Float) * 0.2) as Int
    Int iCommission = ((iTotalValue as Float) * 0.05) as Int
    Int iPayOut = iTotalValue - iResellProfit + iCommission
    If (iPayOut > 0)
      miscobject temp25 = game.GetCaps()
      form temp26 = temp25 as form
      Self.GetLinkedRef(WorkshopItemKeyword).additem(temp26, iPayOut, false) ; #DEBUG_LINE_NO:11
    EndIf		
  EndIf
  Self.removeItem(akBaseItem, aiItemCount, False, None) ; #DEBUG_LINE_NO:19
EndEvent

 

 

Edited by NiftyPower
Link to comment
Share on other sites

  • Recently Browsing   0 members

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