Welcome to the AFK Mods bug tracker. In order to report an issue, please select a project from the drop down menu below. Select “Open New Issue” and fill out the form with as many details as possible.

An account will be required to submit an issue, so if you need one and are unable to register, please contact us via the forums at https://afkmods.iguanadons.net/

Issue Data
Status: New
Issue Type: Bug Report
Project: Unofficial Fallout 4 Patch
Component: Fallout 4: Vanilla
Category: Papyrus
Assigned To: Nobody
Platform: All
Severity: Low
Votes: 0
Watching: N/A
Opened By KernalsEgg on Jul 7, 2018 1:47 pm

Issue #24775: WorkshopFloraHarvestTime Actor Value Not Set on Workshop Flora Creation

There appears to be a bug with newly created workshop plants (mutfruit, tatos, corn, etc.) being SetHarvested(False) when they first reload. For instance, if I create a mutfruit plant, unload and reload the workshop, the mutfruit plant will suddenly have fruit on it. This occurs because the Actor Value WorkshopFloraHarvestTime is only set when the plant is activated (through the OnActivate() event in WorkshopObjectScript), and not when it is created.

Therefore, when the plant is first placed, WorkshopFloraHarvestTime defaults to 0. So, when the game checks whether a day has elapsed in the HandleWorkshopReset() function (as per the WorkshopObjectScript), it will always return true. That is, assuming that the player is at least 1 in-game day into the save.

I call this a bug because the HandleCreation() function goes out of it's way to ensure that there won't be any fruit on any newly created plant. So, it doesn't make much sense that the plant could then instantly grow fruit on reload, given that it would otherwise take a full day.

A simple fix would be to run SetValue(WorkshopParent.WorkshopFloraHarvestTime, Utility.GetCurrentGameTime()) where HandleCreation() has SetHarvested(True). I had a quick look over the UFO4P WorkshopObjectScript (with the find feature) and I didn't come across anything addressing this issue. Additionally, installing UFO4P doesn't appear to fix this issue in-game.

This section of code appears to work as a solution, and can be implemented into an external script. It's just something that I've included in my mod in absence of another fix.

Event OnInit()
	Self.RegisterForCustomEvent(akSender = WorkshopParent, asEventName = "WorkshopObjectBuilt";)

Event WorkshopParentScript.WorkshopObjectBuilt(WorkshopParentScript akSender, Var[] akArgs)
	If ((akArgs[0] As WorkshopObjectScript).GetBaseObject() As Flora)
		If (!(akArgs[0] As WorkshopObjectScript).GetValue(akAV = WorkshopParent.WorkshopFloraHarvestTime))
			(akArgs[0] As WorkshopObjectScript).SetValue(akAV = WorkshopParent.WorkshopFloraHarvestTime, afValue = Utility.GetCurrentGameTime())