Article #3 in a 4-part series.


In Fallout 4 by Bethesda Game Studios, Diamond City decorates for just two holidays: Halloween and Christmas. And on those days. Let’s say we’d like to see the nice folk of Diamond City keep their Christmas decorations up a bit longer. It’s a simple adjustment to a Papyrus script, DmndHolidayHandlerScript.

requirements

  • Creation Kit
  • Notepad++ (optional)

You may edit the script in a text editor like Notepad++ or edit within Creation Kit. I find it easier to use Notepad++ setup to compile Papyrus. After installing Creation Kit, find the Base.zip file within the folder Data\Scripts\Source\Base and unpack the contents directly into that folder. If editing the script within Creation Kit then in Cell View select World Space: DiamondCity and look for the editor ID: DmndHolidayHandler (0004408D) and right-click to edit. Find the script within the Scripts tab, right-click, and select Edit Source.

If new to Papyrus, see the introduction at www.creationkit.com/fallout4/index.php?title=Papyrus_Introduction.

what does the script do?

Basically if the date is October 31st then it enables (turns on so visible in game) the Halloween decorations, if December 25th then enable Christmas decorations, and any other day disable decorations. The “OnLoad” event means that it runs when that object it’s attached to loads. Since this object is within Diamond City then we’ll assume it loads when the city data loads. The decoration objects are children of the two markers so they’ll enable when the marker enables. Our goal is to edit the script to include more days for decorations to remain enabled.

original script source:

original DmndCityHolidayHandlerScript.psc
Scriptname DmndHolidayHandlerScript extends ObjectReference Const
ObjectReference Property DmndChristmasEnableMarker Auto Const
ObjectReference Property DmndHalloweenEnableMarker Auto Const
GlobalVariable Property GameMonth Auto Const
GlobalVariable Property GameDay Auto Const
Event OnLoad()
;enable Halloween markers on the 31st
If GameMonth.GetValueInt() == 10
If GameDay.GetValueInt() == 31
DmndHalloweenEnableMarker.Enable()
EndIf
EndIf
;disable Halloween markers any other time
If GameMonth.GetValueInt() != 10
If GameDay.GetValueInt() != 31
DmndHalloweenEnableMarker.Disable()
EndIf
EndIf
;enable christmas markers on tyhe 25th
If GameMonth.GetValueInt() == 12
If GameDay.GetValueInt() == 25
DmndChristmasEnableMarker.Enable()
EndIf
EndIf
If GameMonth.GetValueInt() != 12
If GameDay.GetValueInt() != 25
DmndChristmasEnableMarker.Disable()
EndIf
EndIf
EndEvent

note the bad logic

Read over the script above or open the script, DmndHolidayHandlerScript.psc, and take a look at the code. Can you spot the logic error and potential bug? I don’t mean to pick on the developers, because I’ve seen this same beginner error before. Anyone comfortable with writing code, working with mathematics, or a good reader should spot the problem immediately.

What happens if the player enters Diamond City on October 31st and then doesn’t return until December 31st?

If on last load of the attached object DmndHalloweenEnableMarker is enabled then if next load is on December 31st the marker will not disable. Without knowing how the game engine functions we can’t say for certain there is a bug here, however a good writer should write good code to limit potential bugs.

Let’s fix Halloween disable. Below I’ve made three small edits. I changed the “!=” (not equal) to a positive equal-to 10 and is-less-than 31, and added an else for when it’s not October.

"Halloween disable fix"
;disable Halloween markers any other time
If GameMonth.GetValueInt() == 10
If GameDay.GetValueInt() < 31
DmndHalloweenEnableMarker.Disable()
EndIf
else
DmndHalloweenEnableMarker.Disable()
EndIf

more Christmas decoration days

Let’s make the decorations remain up for the final 10 days of the month, and also fix the logic so decorations disable on the other days.

updated DmndCityHolidayHandlerScript.psc
Scriptname DmndHolidayHandlerScript extends ObjectReference Const
ObjectReference Property DmndChristmasEnableMarker Auto Const
ObjectReference Property DmndHalloweenEnableMarker Auto Const
GlobalVariable Property GameMonth Auto Const
GlobalVariable Property GameDay Auto Const
Event OnLoad()
;enable Halloween markers on the 31st
If GameMonth.GetValueInt() == 10
If GameDay.GetValueInt() == 31
DmndHalloweenEnableMarker.Enable()
EndIf
EndIf
;disable Halloween markers any other time
If GameMonth.GetValueInt() == 10
If GameDay.GetValueInt() < 31
DmndHalloweenEnableMarker.Disable()
EndIf
else
DmndHalloweenEnableMarker.Disable()
EndIf
;enable christmas markers on tyhe 25th
If GameMonth.GetValueInt() == 12
If GameDay.GetValueInt() >= 22
DmndChristmasEnableMarker.Enable()
EndIf
EndIf
If GameMonth.GetValueInt() == 12
If GameDay.GetValueInt() < 22
DmndChristmasEnableMarker.Disable()
EndIf
else
DmndChristmasEnableMarker.Disable()
EndIf
EndEvent

Compile the updated script and your character will enjoy more days of festivity.


Article #3 in a 4-part series.



Fallout 4 is a trademark of Bethesda Softworks LLC. All other trademarks belong to their respective owners.