Compare commits
4 Commits
4dd2be9c28
...
fe9971362f
Author | SHA1 | Date |
---|---|---|
|
fe9971362f | 3 months ago |
|
50ec2d17aa | 3 months ago |
|
8bb7765856 | 3 months ago |
|
df07b65145 | 3 months ago |
26 changed files with 160 additions and 175 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,111 @@ |
|||||||
|
Scriptname _00E_MQ12b_NPCControl extends Quest Hidden |
||||||
|
|
||||||
|
; 2.1, Eddoursul: Moved disabling NPCs to a separate quest |
||||||
|
|
||||||
|
Actor[] RegisteredDisabledNPCs |
||||||
|
Int nRegisteredDisabledNPCs |
||||||
|
Bool bDisabledNPCsLocked |
||||||
|
Actor[] RegisteredGhostedNPCs |
||||||
|
Int nRegisteredGhostedNPCs |
||||||
|
Bool bGhostedNPCsLocked |
||||||
|
|
||||||
|
function OnInit() |
||||||
|
RegisteredDisabledNPCs = New Actor[128] |
||||||
|
nRegisteredDisabledNPCs = 0 |
||||||
|
RegisteredGhostedNPCs = New Actor[128] |
||||||
|
nRegisteredGhostedNPCs = 0 |
||||||
|
endfunction |
||||||
|
|
||||||
|
; Queue an NPC |
||||||
|
Function PrepareNPC(Actor akMoveActor, Bool bOnlyGhost = False) |
||||||
|
If MQ12b.bArkUnderAttackPrelude == False |
||||||
|
Return |
||||||
|
EndIf |
||||||
|
|
||||||
|
; Validate akMoveActor, could receive "nullptr form" instead of a valid actor from the packages |
||||||
|
If akMoveActor == None || akMoveActor.GetActorBase() == None |
||||||
|
Return |
||||||
|
EndIf |
||||||
|
|
||||||
|
If bOnlyGhost == False && RegisteredDisabledNPCs.Find(akMoveActor) < 0 |
||||||
|
If akMoveActor.IsDisabled() |
||||||
|
Return |
||||||
|
EndIf |
||||||
|
|
||||||
|
if SKSE.GetVersion() |
||||||
|
if akMoveActor.GetEnableParent() == None |
||||||
|
akMoveActor.DisableNoWait() |
||||||
|
_RegisterDisabledNPC(akMoveActor) |
||||||
|
return |
||||||
|
endif |
||||||
|
else |
||||||
|
akMoveActor.Disable() |
||||||
|
if akMoveActor.IsDisabled() |
||||||
|
_RegisterDisabledNPC(akMoveActor) |
||||||
|
return |
||||||
|
endif |
||||||
|
endif |
||||||
|
EndIf |
||||||
|
|
||||||
|
If RegisteredGhostedNPCs.Find(akMoveActor) < 0 && akMoveActor.IsGhost() == False && ! akMoveActor.IsDisabled() |
||||||
|
akMoveActor.SetGhost(True) |
||||||
|
_RegisterGhostedNPC(akMoveActor) |
||||||
|
EndIf |
||||||
|
EndFunction |
||||||
|
|
||||||
|
Function _RegisterDisabledNPC(Actor akMoveActor) |
||||||
|
if nRegisteredDisabledNPCs + 1 <= 128 |
||||||
|
RegisteredDisabledNPCs[nRegisteredDisabledNPCs] = akMoveActor |
||||||
|
nRegisteredDisabledNPCs += 1 |
||||||
|
Debug.Trace("Registered disabled " + akMoveActor.GetBaseObject().GetName() + " " + (akMoveActor as String)) |
||||||
|
else |
||||||
|
; Added overflow to the ghosted |
||||||
|
_RegisterGhostedNPC(akMoveActor) |
||||||
|
endif |
||||||
|
EndFunction |
||||||
|
|
||||||
|
Function _RegisterGhostedNPC(Actor akMoveActor) |
||||||
|
if nRegisteredGhostedNPCs + 1 <= 128 |
||||||
|
RegisteredGhostedNPCs[nRegisteredGhostedNPCs] = akMoveActor |
||||||
|
nRegisteredGhostedNPCs += 1 |
||||||
|
Debug.Trace("Registered ghosted " + akMoveActor.GetBaseObject().GetName() + " " + (akMoveActor as String)) |
||||||
|
else |
||||||
|
; oh well |
||||||
|
endif |
||||||
|
EndFunction |
||||||
|
|
||||||
|
Function ReEnableNPCs() |
||||||
|
MQ12b.bArkUnderAttackPrelude = false |
||||||
|
bool bSKSE = SKSE.GetVersion() as bool |
||||||
|
|
||||||
|
int Index = RegisteredDisabledNPCs.length |
||||||
|
While Index > 0 |
||||||
|
Index -= 1 |
||||||
|
Actor akActor = RegisteredDisabledNPCs[Index] |
||||||
|
if akActor != None && ( ! bSKSE || akActor.GetEnableParent() == None ) |
||||||
|
akActor.EnableNoWait() |
||||||
|
Debug.Trace("Re-enabled: " + akActor.GetActorBase().GetName()) |
||||||
|
RegisteredDisabledNPCs[Index] = None |
||||||
|
endif |
||||||
|
EndWhile |
||||||
|
|
||||||
|
RegisteredDisabledNPCs = New Actor[1] |
||||||
|
|
||||||
|
Index = RegisteredGhostedNPCs.length |
||||||
|
While Index > 0 |
||||||
|
Index -= 1 |
||||||
|
Actor akActor = RegisteredGhostedNPCs[Index] |
||||||
|
if akActor != None |
||||||
|
if akActor.IsDisabled() && ( ! bSKSE || akActor.GetEnableParent() == None ) |
||||||
|
akActor.EnableNoWait() |
||||||
|
endif |
||||||
|
akActor.SetGhost(False) |
||||||
|
Debug.Trace("Unghosted: " + akActor.GetActorBase().GetName()) |
||||||
|
RegisteredGhostedNPCs[Index] = None |
||||||
|
endif |
||||||
|
EndWhile |
||||||
|
|
||||||
|
RegisteredGhostedNPCs = New Actor[1] |
||||||
|
EndFunction |
||||||
|
|
||||||
|
_00E_MQ12b_Functions Property MQ12b Auto |
Loading…
Reference in new issue