Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname DCS_Laundry_Script extends Quest
- { It just works. }
- ; DIAMOND CITY SWAT VERSION 2.0: https://www.nexusmods.com/fallout4/mods/10893/
- ; A FALLOUT 4 MOD BY @THORALDGM | THORALDGM.COM | SCRIPT UPDATED 20170923
- ;
- ; This script makes washers functional in Diamond City security office. Max compatibility with other mods.
- ;
- ; PERMISSIONS:
- ;
- ; - Do not repost my mod. If you want to tweak minor changes, send me the esp and I will post it in Files.
- ; - Language translations are allowed only on same platforms where I posted mod. Please mail link when done.
- ; - This mod may not be folded entirely into a larger work without my written permission and collaboration.
- ; - Please ask if you want to use parts of my code to improve other mods. Must be unique and credit source.
- ;
- ; - If you have any questions, or see a better way to do something, please let me know.
- ;
- ; SCRIPT SECTIONS:
- ;
- ; LINE 039: PROPERTIES
- ; LINE 059: ON INIT
- ; LINE 078: ON ITEM ADDED
- ;
- ; WARNINGS:
- ;
- ; - ANYTHING PLACED IN WASHER WILL BE STRIPPED OF ARMOR/WEAPON MODS DURING TRANSFER TO DRYER!
- ; - WEAPONS PLACED IN WASHER WILL GENERATE SMALL AMOUNTS OF AMMO IN DRYER. THIS CAN BE FARMED/REPEATED.
- ; - THIS SCRIPT DOES NOT CURRENTLY CHECK TO SEE IF WASHERS HAVE BEEN SCRAPPED BY PLACE WORKBENCH/SCRAP MODS.
- ;
- ; This does not create working washers/dryers in workshops. For that functionality, check out these mods:
- ; - Functional Washer: https://www.nexusmods.com/fallout4/mods/14402/
- ; - Laundry Day: https://www.nexusmods.com/fallout4/mods/9042/
- ;
- ; Other laundromats in game that could benefit from this method:
- ; - http://fallout.wikia.com/wiki/Charlestown_laundry
- ; - http://fallout.wikia.com/wiki/Faded_Glory_laundromat
- ; ------------------------------------------------------------------------------------------------------------
- ; PROPERTIES
- ; ------------------------------------------------------------------------------------------------------------
- FormList Property flCleanClothes Auto Const Mandatory ; FormList of clean clothes
- FormList Property flDirtyClothes Auto Const Mandatory ; FormList of dirty clothes
- ReferenceAlias Property raWasher1 Auto Const ; Left washer
- ReferenceAlias Property raWasher2 Auto Const ; Center washer
- ReferenceAlias Property raWasher3 Auto Const ; Right washer
- ReferenceAlias Property raDryer1 Auto Const ; Left dryer
- ReferenceAlias Property raDryer2 Auto Const ; Center dryer
- ReferenceAlias Property raDryer3 Auto Const ; Right dryer
- Sound Property pFXHumanCannibalGush Auto Const Mandatory ; Gurgling sound for washers
- Sound Property pDRSFacilityXBlastOpenEBuzzer Auto Const Mandatory ; Buzzer sound for dryers
- GlobalVariable Property gvDevTracking Auto Mandatory ; Are dev messages turned on
- ; ------------------------------------------------------------------------------------------------------------
- ; EVENT: ON INIT
- ; ------------------------------------------------------------------------------------------------------------
- Event OnInit()
- ; ********************************************************************************************************
- ; REGISTER (START LISTENING) FOR REMOTE EVENTS, SO SCRIPT CAN REACT
- ; ********************************************************************************************************
- AddInventoryEventFilter(None) ; Required filter for OnItemAdded
- Utility.Wait(0.1) ; Let stack apply filter before registrations
- RegisterForRemoteEvent(raWasher1, "OnItemAdded") ; Listen for left washer event
- RegisterForRemoteEvent(raWasher2, "OnItemAdded") ; Listen for center washer event
- RegisterForRemoteEvent(raWasher3, "OnItemAdded") ; Listen for right washer event
- EndEvent
- ; ------------------------------------------------------------------------------------------------------------
- ; EVENT: ON ITEM ADDED
- ; ------------------------------------------------------------------------------------------------------------
- Event ReferenceAlias.OnItemAdded(ReferenceAlias akSender, Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
- ; ********************************************************************************************************
- ; PAIR INCOMING WASHER WITH OUTGOING DRYER
- ; ********************************************************************************************************
- Form LaunderedItem = akBaseItem ; Store item for pending transfer
- ObjectReference obSender = akSender.GetReference() ; Get objref of the washer refalias
- ObjectReference ClothesDestination ; Prepare to assign a dryer
- String GoWhere ; String for assigned dryer
- If akSender == raWasher1
- ClothesDestination = raDryer1.GetReference() ; Left washer targets left dryer
- GoWhere = "1"
- ElseIf akSender == raWasher2
- ClothesDestination = raDryer2.GetReference() ; Center washer targets center dryer
- GoWhere = "2"
- Else
- ClothesDestination = raDryer3.GetReference() ; Right washer targets right dryer
- GoWhere = "3"
- EndIf
- If gvDevTracking.GetValue() == 1
- Debug.Notification("DCS: Destination is dryer " + GoWhere + ".") ; Inform optional dev tracker
- EndIf
- ; ********************************************************************************************************
- ; REMOVE ITEM FROM WASHER, ADD CLEAN ITEM TO DRYER, PLAY GURGLING & BUZZER SOUNDS
- ; ********************************************************************************************************
- If flDirtyClothes.HasForm(akBaseItem) ; If item is on dirty clothes list
- Int index = flDirtyClothes.Find(akBaseItem) ; get exact position on the list
- LaunderedItem = flCleanClothes.GetAt(index) ; Replace transfer item with clean version
- EndIf
- ClothesDestination.AddItem(LaunderedItem, 1, true) ; Silently add item to dryer
- obSender.RemoveItem(akBaseItem, 1, true) ; Silently delete item from washer
- Bool bInstanceID = pFXHumanCannibalGush.PlayAndWait(akSourceContainer) ; Assign & play gurgling sound. When finished,
- Int iInstanceID = pDRSFacilityXBlastOpenEBuzzer.Play(akSourceContainer) ; assign & play buzzer sound
- EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement