Jump to content

New auto-cleanup mod, need tips for scripting.


TwilightOne

Recommended Posts

Hello! I want to learn about making a little mod that looks like the settlers are cleaning up their environment when some time passes, and some conditions are passed to disable static trash objects references.

Basically my script looks like this, but I'm not a new scripter and I do not know how to call variables from other scripts and the Creation Wiki gives me connection errors or the tutorials are not clear enough for me to understand.

---

Scriptname TO_SettlementImmersiveCleaning extends ObjectReference
;Does it need a quest property? What does that serve?
;Quest Property SettlementCleaningQuest Auto
;Which stage to set in that quest, if it needs one?
;Int Property StageToSet Auto
;Will only run when daily update routine starts, everyday.
WorkshopParentScript Property WorkshopDailyUpdate Auto Const
;Current Workshop ref
Object Property akTargetRef Auto
Event OnInit()
; Registers to get the custom event from DailyUpdate routine
RegisterForCustomEvent(WorkshopParentScript, "WorkshopDailyUpdate")
EndEvent
Event WorkshopParentScript.WorkshopDailyUpdate(WorkshopParentScript)
;This is supposed to get the current workshop ref to check on its related values
WorkshopScript CurrentWorkshop = WorkshopParent.GetWorkshopFromLocation(akTargetRef.GetCurrentLocation())
;Searches the current workshop reference in the workshops array
Int Index = WorkshopParent.Workshops.Find(CurrentWorkshop)
If (WorkshopParent.Workshops[index].OwnedByPlayer == True)

;Now is this the way to get the workshop happiness value?
;(WorkshopParentScript.WorkshopRatingHappiness)

;This will then disable trash objects in that settlement.
startRef.DisableLinkChain


I'm not sure how to go about this. Then I want to check for last days since raider attacks for cleaning up if they happened to sack the place. Then if happiness drops too low, I want to reenable refs.

How can I run this script on a custom "disabler" reference in every workshop when dailyupdate runs so that it disables all trash objects manually linked to it, or better from a form list for each settlement!


Thank you so much for your help! I appreciate mods like Spring Cleaning but sometimes you delete stuff you weren't supposed too, I plan on using the CK to check what could be disabled automatically by the settlers so the lone wanderer doesn't have to look for every trash pile.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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