Jump to content

Player usable Lumber Mill


aoh125

Recommended Posts

Hi, Im looking for some help figuring out how to make a modded lumber mill that the player gets sawn logs when using via the byoh setup. After watching darkfox127's tutorial here.

I managed to get all the functionality it shows up and running with my mill but noticed it lacked being able to buy lumber from the npc so i started digging into the quests for byoh and noticed i needed to add BYOHLumberVendorFaction to the npc to get that dialogue. Unfortunately this still does not make the lumber mill give the player 10 logs even if the npc is friends and has the dialogue saying they could use a break anyway etc. I tried adding loctype lumbermill to the cell its in and setting the resourceobjectsawmill to havelocationreftype resourcedestructableobject, mimicing what i found the one in riverwood to be setup as. Also have been looking over the script the byoh quest points to for the lumber operators "BYOHhousebuildingscript" but havent noticed anything i've missed in there that needs added ether.

 

this is the section of it that relates to the lumber mill

 

 

; update amount of player's logs
function UpdateLogCount()
;  debug.trace(self + " UpdateLogCount")
int logCount = Game.GetPlayer().GetItemCount(BYOHMaterialLog)
BYOHHouseLogCount.SetValue(logCount)
UpdateCurrentInstanceGlobal(BYOHHouseLogCount)
;  debug.trace(self + " logcount=" + logcount)
; enable/disable log piles as appropriate
int currentElement = 0
while (currentElement < LogPiles.Length)
if houseOwned[currentElement]
if logCount > 0
if LogPiles[currentElement].IsDisabled()
;  debug.trace(self + " enabling logpile " + LogPiles[currentElement])
endif
LogPiles[currentElement].EnableNoWait()
else
if LogPiles[currentElement].IsDisabled() == false
;  debug.trace(self + " disabling logpile " + LogPiles[currentElement])
endif
LogPiles[currentElement].DisableNoWait()
endif
endif
currentElement += 1
endWhile
endFunction
 
; called by startup stage to add lumber vendors to faction
function InitializeLumberVendorFaction()
; add lumber vendors to faction (for dialogue conditions)
int currentElement = 0
while (currentElement < LumberVendors.Length)
(LumberVendors[currentElement] as Actor).AddToFaction(BYOHLumberVendorFaction)
currentElement = currentElement + 1
endWhile
 
endfunction
 
function SetLumbermillOperator(ObjectReference NPC)
; find lumbermill index for this NPC
int lumbermillIndex = LumberVendors.Find(NPC)
if lumbermillIndex >= 0
;ObjectReference marker =  Game.FindClosestReferenceOfTypeFromRef(ResourceObjectSawmill, NPC, 5000)
LumbermillMarker.ForceRefTo(Lumbermills[lumbermillIndex])
LumbermillOperator.ForceRefTo(NPC)
;  debug.trace(self + "LumbermillMarker = " + LumbermillMarker.GetRef() )
;  debug.trace(self + "LumbermillMarker location = " + LumbermillMarker.GetRef().GetEditorLocation() )
;  debug.trace(self + "LumbermillMarker current location = " + LumbermillMarker.GetRef().GetCurrentLocation() )
LumbermillLocation.ForceLocationTo(LumbermillMarker.GetRef().GetEditorLocation())
(NPC as actor).EvaluatePackage()
; register for animation event of log being cut
RegisterForAnimationEvent(Lumbermills[lumbermillIndex], "MillLogIdleReset") ; log cutting animation complete
endif
endFunction
 
function ClearLumbermillOperator()
LumbermillMarker.Clear()
LumbermillOperator.Clear()
LumbermillLocation.Clear()
UnregisterForAnimationEvent(LumbermillMarker.GetRef(), "MillLogIdleReset")
endFunction
 
; watch for animation events
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
; lumber mill cut
if akSource == LumbermillMarker.GetRef() && (asEventName=="MillLogIdleReset")
; give player lumber
Game.GetPlayer().AddItem(BYOHMaterialLog, iLumbermillSawnLogCount)
endif
endEvent

 

 

Anyway my question is has anyone figured out how to make this work or notice what im missing to get it up and running. Thanks for any guidance on this problem in advance.
Edited by aoh125
Link to comment
Share on other sites

  • Recently Browsing   0 members

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