Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname ScavverTriggerVolume extends ObjectReference
- { It just works. }
- ; SCAVVER MOD BY @THORALDGM | THORALDGM AT GMAIL.COM | SCRIPT UPDATED 20160708
- ; -----------------------------------------------------------------------------------------------------------
- ; PROPERTIES
- ; -----------------------------------------------------------------------------------------------------------
- ObjectReference Property pScavver Auto Const Mandatory ; Scavver ObjRef
- Actor Property pScavverActor Auto Const Mandatory ; Scavver ActorRef
- FormList Property pScavverArmorAllowed Auto Const Mandatory ; Outfits allowed to wear
- GlobalVariable Property pgvScavverStatusSniffer Auto Mandatory ; Is dev tracking on?
- GlobalVariable Property pgvScavverCircledBack Auto Mandatory ; Number of times repeating path
- GlobalVariable Property pgvScavverCircleTimer Auto Mandatory ; Timer for window range
- GlobalVariable Property pgvScavverStatTimesCircled Auto Mandatory ; Total incremented number of times
- GlobalVariable Property pgvScavverWasStuck Auto Mandatory ; Was stuck flag
- GlobalVariable Property pgvScavverDoNotLootHere Auto Mandatory ; THE FIVE PACKAGE STACK CONDITIONS
- GlobalVariable Property pgvScavverIsHome Auto Mandatory ; 2nd
- GlobalVariable Property pgvScavverIsInLimbo Auto Mandatory ; 3rd
- GlobalVariable Property pgvScavverLootedArea Auto Mandatory ; 4th
- GlobalVariable Property pgvScavverStartRoute Auto Mandatory ; 5th
- Keyword Property pObjectTypeAmmo Auto Const Mandatory ; Ammo keyword
- Keyword Property pObjectTypeArmor Auto Const Mandatory ; Armor keyword
- Keyword Property pObjectTypeFood Auto Const Mandatory ; Food keyword
- Keyword Property pObjectTypeWeapon Auto Const Mandatory ; Weapon keyword
- Potion Property pRadAway Auto Const Mandatory ; RadAway
- Quest Property pScavverUtilityQuest Auto Const Mandatory ; Utility quest
- ; -----------------------------------------------------------------------------------------------------------
- ; EVENT: ON TRIGGER ENTER
- ; -----------------------------------------------------------------------------------------------------------
- Event OnTriggerEnter(ObjectReference akActionRef)
- If akActionRef == pScavver
- String PluralOrNot = "times"
- Float NumTimes
- If pgvScavverWasStuck.GetValue() == 0
- pgvScavverCircledBack.SetValue(0)
- NumTimes = 0
- CancelTimerGameTime(1)
- pgvScavverCircleTimer.SetValue(0)
- ; If pgvScavverStatusSniffer.GetValue() == 1
- ; Debug.Notification("Scavver volume timer cancelled.")
- ; EndIf
- Else
- pgvScavverCircledBack.Mod(1)
- NumTimes += 1
- EndIf
- If NumTimes == 0 ; If this is the first visit
- ; If pgvScavverStatusSniffer.GetValue() == 1
- ; Debug.Notification("Scavver volume timer started.")
- ; EndIf
- StartTimerGameTime(1.65, 1) ; and start 5 RL minute window (100 gminutes)
- pgvScavverCircleTimer.SetValue(1) ; (0.0165 x 20 gminutes/RLmin x 5 = 1.65)
- EndIf
- If NumTimes == 1
- PluralOrNot = "time" ; time instead of times
- EndIf
- ; If pgvScavverStatusSniffer.GetValue() == 1
- ; Debug.Notification("Scavver triggered volume " + NumTimes + " " + PluralOrNot + ".")
- ; EndIf
- Bool CanLootHere = false ; ADDED 20160708 TO STOP SANCTUARY LOOTING!
- Utility.Wait(1)
- If pgvScavverIsInLimbo.GetValue() == 0
- If (pgvScavverIsHome.GetValue() == 0) || (pgvScavverStartRoute.GetValue() == 1)
- If pgvScavverDoNotLootHere.GetValue() == 0
- If pgvScavverLootedArea.GetValue() == 0
- CanLootHere = true ; ADDED 20160708 TO STOP SANCTUARY LOOTING!
- EndIf
- EndIf
- EndIf
- EndIf
- Utility.Wait(1)
- If (NumTimes > 3) && (CanLootHere == true) ; If this is the 3rd visit AND CAN LOOT HERE!
- If pgvScavverCircleTimer.GetValue() == 1 ; within 5 RL minute window
- ; grab all items he could be trying to access
- ; then reevaluate package so his AI moves him away from this trouble spot
- If pgvScavverStatusSniffer.GetValue() == 1
- Debug.Notification("SCAVVER IS WALKING IN CIRCLES... FIXING")
- EndIf
- ObjectReference[] kAmmoArray = pScavver.FindAllReferencesWithKeyword(pObjectTypeAmmo, 1000)
- ObjectReference[] kArmorArray = pScavver.FindAllReferencesWithKeyword(pObjectTypeArmor, 1000)
- ObjectReference[] kFoodArray = pScavver.FindAllReferencesWithKeyword(pObjectTypeFood, 1000)
- ObjectReference[] kWeaponArray = pScavver.FindAllReferencesWithKeyword(pObjectTypeWeapon, 1000)
- ObjectReference[] kRadArray = pScavver.FindAllReferencesOfType(pRadAway, 1000)
- Int i
- Int ArraySize
- i = 0
- ArraySize = kAmmoArray.Length
- While (i < ArraySize)
- If (kAmmoArray[i].GetContainer() != Game.GetPlayer()) && (kAmmoArray[i].GetContainer() != pScavver)
- If !pScavverActor.WouldBeStealing(kAmmoArray[i]) && !kAmmoArray[i].IsQuestItem() && kAmmoArray[i].IsEnabled()
- pScavver.AddItem(kAmmoArray[i], 1, true)
- EndIf
- EndIf
- i += 1
- EndWhile
- i = 0
- ArraySize = kArmorArray.Length
- While (i < ArraySize)
- If (kArmorArray[i].GetContainer() != Game.GetPlayer()) && (kArmorArray[i].GetContainer() != pScavver)
- If !pScavverActor.WouldBeStealing(kArmorArray[i]) && !kArmorArray[i].IsQuestItem() && kArmorArray[i].IsEnabled()
- pScavver.AddItem(kArmorArray[i], 1, true)
- EndIf
- EndIf
- i += 1
- EndWhile
- i = 0
- ArraySize = kFoodArray.Length
- While (i < ArraySize)
- If (kFoodArray[i].GetContainer() != Game.GetPlayer()) && (kFoodArray[i].GetContainer() != pScavver)
- If !pScavverActor.WouldBeStealing(kFoodArray[i]) && !kFoodArray[i].IsQuestItem() && kFoodArray[i].IsEnabled()
- pScavver.AddItem(kFoodArray[i], 1, true)
- EndIf
- EndIf
- i += 1
- EndWhile
- i = 0
- ArraySize = kWeaponArray.Length
- While (i < ArraySize)
- If (kWeaponArray[i].GetContainer() != Game.GetPlayer()) && (kWeaponArray[i].GetContainer() != pScavver)
- If !pScavverActor.WouldBeStealing(kWeaponArray[i]) && !kWeaponArray[i].IsQuestItem() && kWeaponArray[i].IsEnabled()
- pScavver.AddItem(kWeaponArray[i], 1, true)
- EndIf
- EndIf
- i += 1
- EndWhile
- i = 0
- ArraySize = kRadArray.Length
- While (i < ArraySize)
- If (kRadArray[i].GetContainer() != Game.GetPlayer()) && (kRadArray[i].GetContainer() != pScavver)
- If !pScavverActor.WouldBeStealing(kRadArray[i]) && !kRadArray[i].IsQuestItem() && kRadArray[i].IsEnabled()
- pScavver.AddItem(kRadArray[i], 1, true)
- EndIf
- EndIf
- i += 1
- EndWhile
- CancelTimerGameTime(1)
- pgvScavverCircleTimer.SetValue(0)
- pgvScavverCircledBack.SetValue(0) ; Reset global variable. Important!
- pgvScavverStatTimesCircled.Mod(1)
- pScavverUtilityQuest.UpdateCurrentInstanceGlobal(pgvScavverStatTimesCircled)
- pScavverActor.EvaluatePackage()
- EndIf
- EndIf
- EndIf
- EndEvent
- ; -----------------------------------------------------------------------------------------------------------
- ; EVENT: ON TIMER GAME TIME
- ; -----------------------------------------------------------------------------------------------------------
- Event OnTimerGameTime(int aiTimerID) ; Cancel timer
- pgvScavverCircleTimer.SetValue(0)
- pgvScavverCircledBack.SetValue(0) ; Reset global variable. Important!
- ; Debug.Notification("Scavver volume timer ended.")
- EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement