Created
July 5, 2017 01:31
-
-
Save fireundubh/0e78a7050c3c4ec79753adbef4a36f94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScriptName dubhTrueNeutralWhiterunGuards Extends Quest | |
Formlist dubhWhiterunGuards Auto | |
Faction CWImperialFaction Auto | |
Faction CWImperialFactionNPC Auto | |
Faction CrimeFactionImperial Auto | |
Quest CWSiegeObj Auto | |
Bool Function CheckWhiterunBattle() | |
If CWSiegeObj.IsRunning() | |
If CWSiegeObj.GetStage() <= 1 | |
Return True | |
EndIf | |
EndIf | |
If CWSiegeObj.GetStageDone() >= 8999 | |
Return False | |
EndIf | |
If CWSiegeObj.IsCompleted() | |
Return False | |
EndIf | |
EndFunction | |
Bool Function ClearFaction(Actor akActor, Faction akFaction) | |
If akActor.IsInFaction(akFaction) == True | |
akActor.RemoveFromFaction(akFaction) | |
EndIf | |
Return akActor.IsInFaction(akFaction) | |
EndFunction | |
Function ResetGuards() | |
Int i = 0 | |
While i < dubhWhiterunGuards.GetSize() | |
Actor currentGuard = dubhWhiterunGuards.GetAt(i) | |
ClearFaction(currentGuard, CWImperialFaction) | |
ClearFaction(currentGuard, CWImperialFactionNPC) | |
ClearFaction(currentGuard, CrimeFactionImperial) | |
i += 1 | |
EndWhile | |
EndFunction | |
Bool Function ResetFaction(Actor akActor, Faction akFaction) | |
If akActor.IsInFaction(akFaction) == False | |
akActor.AddToFaction(akFaction) | |
EndIf | |
Return akActor.IsInFaction(akFaction) | |
EndFunction | |
Function MakeGuardsNeutral() | |
Int i = 0 | |
While i < dubhWhiterunGuards.GetSize() | |
Actor currentGuard = dubhWhiterunGuards.GetAt(i) | |
ResetFaction(currentGuard, CWImperialFaction) | |
ResetFaction(currentGuard, CWImperialFactionNPC) | |
ResetFaction(currentGuard, CrimeFactionImperial) | |
i += 1 | |
EndWhile | |
EndFunction | |
Event OnInit() | |
GoToState("Active") | |
EndEvent | |
Event OnPlayerLoadGame() | |
GoToState("Active") | |
EndEvent | |
State Active | |
Event OnBeginState() | |
RegisterForSingleUpdate(1.0) | |
EndEvent | |
Event OnUpdate() | |
If CheckWhiterunBattle() | |
MakeGuardsNeutral() | |
Else | |
ResetGuards() | |
EndIf | |
RegisterForSingleUpdate(1.0) | |
EndEvent | |
EndState | |
State Dead | |
EndState |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment