Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Here is an example of a custom event sent from one script to any other scripts listening for it.
- ; Papyrus has OnCellLoad() but not OnCellUnload() so I had to create one.
- ; ... in script attached to Scavver NPC / Actor...
- CustomEvent ScavOnCellUnload ; Custom event! (not a property)
- ; ... further down, in a 10-second recurring timer check...
- ElseIf aiTimerID == 3
- float MovedDistance = pScavver.GetDistance(pScavverMarker)
- If !pScavver.GetParentCell() ; If Scavver enters unloaded cell
- If pgvScavverStatusSniffer.GetValue() == 1
- Debug.Notification("SCAVVER IS IN UNLOADED CELL.") ; notify dev tracker
- EndIf
- pgvScavverIsInLimbo.SetValue(1) ; flag Scavver as being in limbo
- SendCustomEvent("ScavOnCellUnload") ; and notify sweep / travel pkg
- EndIf
- ; ... this is a fragment for forum posting
- ; ... and in the travel package script...
- Scavver Property pScavverActor Auto Const ; Script that sends custom event
- ; ... after the property declaration, registration in OnStart (for packages, probably OnInit for others)...
- RegisterForCustomEvent(pScavverActor, "ScavOnCellUnload") ; Scavver sends when in unloaded cell
- ; ... and now the custom event...
- ; -----------------------------------------------------------------------------------------------------------
- ; CUSTOM EVENT: SCAV ON CELL UNLOAD (HANDLE CATASTROPHIC DISRUPTION AS IF PACKAGE ENDED NORMALLY)
- ; -----------------------------------------------------------------------------------------------------------
- Event Scavver.ScavOnCellUnload(Scavver akSender, Var[] arguments)
- ; Debug.Trace("SCAVVER TRAVEL PKG TRACKER: SCAV ON CELL UNLOAD FIRED")
- If pgvScavverStatusSniffer.GetValue() == 1 ; If player is dev tracking
- Debug.Notification("SCAVVER: CELL UNLOAD DISRUPTED TRAVEL.") ; notify pkg terminated by fast travel
- EndIf
- pgvScavverTravelUnloaded.SetValue(1) ; Flag as interrupted by fast travel
- pgvScavverIsInLimbo.SetValue(1) ; Scavver is in unloaded cell!
- EndMyTravelPackage() ; End travel package
- EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement