Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ------------------------------------------------------------------------------------------------------------
- ; EVENT: ON INIT
- ; ------------------------------------------------------------------------------------------------------------
- Event OnInit()
- ; ********************************************************************************************************
- ; ASSIGN PLAYER'S CHOICE (LOCKER, DESK, OR CABINET) AS GUARD GEAR CONTAINER
- ; ********************************************************************************************************
- Int PlayerChoice = gvGearContainerChoice.GetValue() as Int ; Did player choose 1, 2, or 3
- If PlayerChoice == 3
- raGearContainer.ForceRefTo(raCabinet.GetReference()) ; If 3, assign cabinet
- ElseIf PlayerChoice == 2
- raGearContainer.ForceRefTo(raDesk.GetReference()) ; If 2, assign desk
- Else
- raGearContainer.ForceRefTo(raLocker.GetReference()) ; Else assign locker (default)
- EndIf
- ; ********************************************************************************************************
- ; IF CHOICE HAS BEEN SCRAPPED BY PLAYER OR OTHERWISE MISSING, REASSIGN GUARD GEAR CONTAINER
- ; ********************************************************************************************************
- Int RedirectAttempts = 0 ; How many ref changes attempted?
- String strFoundRef = "NONE" ; Placeholder string for dev tracker
- While (raGearContainer.GetReference() == None) && RedirectAttempts < 3 ; Make 3 attempts if scrapped
- RedirectAttempts += 1 ; Increment number of attempts
- PlayerChoice += 1 ; Select the next available choice
- If PlayerChoice == 4 ; If choice is out of bounds,
- PlayerChoice = 1 ; next choice is the first option
- EndIf
- If PlayerChoice == 3
- raGearContainer.ForceRefTo(raCabinet.GetReference()) ; If 3, assign cabinet
- strFoundRef = "cabinet"
- ElseIf PlayerChoice == 2
- raGearContainer.ForceRefTo(raDesk.GetReference()) ; If 2, assign desk
- strFoundRef = "desk"
- Else
- raGearContainer.ForceRefTo(raLocker.GetReference()) ; Else assign locker (default)
- strFoundRef = "locker"
- EndIf
- EndWhile
- ; ********************************************************************************************************
- ; ANNOUNCE RESULTS AND WARN IF ALL THREE OPTIONS WERE SCRAPPED BY PLAYER OR NOT FOUND
- ; ********************************************************************************************************
- ; Mod requires guard gear container to be accessible by player. If no accessible container, can't use mod.
- ; Replace message box debug with message box show. Critical message should display on all platforms!
- If raGearContainer.GetReference() == None
- Debug.MessageBox("Diamond City SWAT: No containers found! Uninstall mod and contact ThoraldGM asap.")
- Else
- If gvDevTracking.GetValue() == 1
- Debug.Notification("DCS: Guard gear is in " + strFoundRef + ".")
- EndIf
- EndIf
- ; ********************************************************************************************************
- ; SET OWNERSHIP OF GUARD GEAR CONTAINER SO PLAYER DOESN'T STEAL ITEMS AND GET ATTACKED
- ; ********************************************************************************************************
- obGearContainer = raGearContainer.GetReference() ; Grab ObjRef of the RefAlias
- Cell GearContainerCell = obGearContainer.GetParentCell() ; Grab parent cell of the ObjRef
- GearContainerCell.SetFactionOwner(pPlayerFaction) ; Remove stolen flag from cell/container
- ; This method makes everything in Security Office belong to the player, including the jail key.
- ; I would rather change flag on the container only, but obGearContainer.SetActorOwner(NONE) didn't work.
- ; I may also look into making player ownership of the Security Office a MCM option that can be toggled.
- ; Note that choosing Arturo's "All Others Pay Caps" cabinet changes Market, not Security Office!
- ; ********************************************************************************************************
- ; WARN PLAYER IF CONTAINER IS STILL DANGEROUS
- ; ********************************************************************************************************
- Bool bPlayerOwns = (GearContainerCell.GetFactionOwner() == pPlayerFaction)
- If !bPlayerOwns
- ; This first notification is a critical warning, so display even if player doesn't want dev messages.
- ; Criticals are rare. Dev messages are spammy. Dev messages default to off in final version.
- Debug.Notification("DCS: SET FACTION FAILED!") ; Show notice on top left screen corner
- Debug.Trace("DIAMOND CITY SWAT: SET FACTION FAILED!") ; Write warning in log file
- Else
- If gvDevTracking.GetValue() == 1 ; If player wants developer messages
- Debug.Notification("DCS: Player owns cell.") ; inform player that faction updated
- EndIf
- EndIf
- [ .... THIS IS A FRAGMENT .... REST OF ONINIT FOLLOWS IN ORIGINAL FILE ... ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement