Remade ToArray() formlist loops to vanilla

This commit is contained in:
Eddoursul 2024-02-08 04:01:22 +01:00
parent 90a5a2868e
commit 810ded0020
20 changed files with 102 additions and 59 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.

View File

@ -17,10 +17,10 @@ EndFunction
Function RemoveCombatSoundtracks()
int nItems = _00E_MUS_AllCombatSoundtracks.GetSize()
Int iIndex = 0
Form[] tracks = _00E_MUS_AllCombatSoundtracks.ToArray()
While iIndex < tracks.Length
(tracks[iIndex] as MusicType).Remove()
While iIndex < nItems
(_00E_MUS_AllCombatSoundtracks.GetAt(iIndex) as MusicType).Remove()
iIndex += 1
EndWhile

View File

@ -119,9 +119,9 @@ Function VisionEffectNoTimestop(Formlist RefsInvolved, Formlist ActorsToFreeze =
if RefsInvolved != None
Int iIndex = 0
Form[] actors = RefsInvolved.ToArray()
While iIndex < actors.Length
Actor VisionREF = actors[iIndex] as Actor
int nItems = RefsInvolved.GetSize()
While iIndex < nItems
Actor VisionREF = RefsInvolved.GetAt(iIndex) as Actor
if VisionREF.IsDisabled()
VisionREF.EnableNoWait()
EndIf
@ -165,10 +165,10 @@ Function VisionEffectNoTimestopStop(Formlist RefsInvolved, Formlist ActorsToFree
EndIf
if RefsInvolved != None
int nItems = RefsInvolved.GetSize()
Int iIndex = 0
Form[] actors = RefsInvolved.ToArray()
While iIndex < actors.Length
Actor VisionREF = actors[iIndex] as Actor
While iIndex < nItems
Actor VisionREF = RefsInvolved.GetAt(iIndex) as Actor
MS04MemoryFXBody01VFX.Stop(VisionREF)
VisionRef.SetAlpha(1)
iIndex += 1

View File

@ -26,7 +26,7 @@ Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldCo
If akNewContainer == PlayerREF
; Take All, no need to check for equipped items
If UI.IsMenuOpen("ContainerMenu") == False
If SKSE.GetVersion() > 0 && UI.IsMenuOpen("ContainerMenu") == False
return
EndIf
@ -43,9 +43,31 @@ EndEvent
Function UpdateSpells()
Int iIndex = 0
bool bSKSE = (SKSE.GetVersion() > 0)
Int iIndex
Int nEquippedPieces = 0
Form[] setPieces = __Config_SetList.ToArray()
Form[] setPieces
if bSKSE
setPieces = __Config_SetList.ToArray()
else
int nPieces = __Config_SetList.GetSize()
if nPieces == 4
setPieces = new Form[4]
elseif nPieces == 5
setPieces = new Form[5]
else
setPieces = new Form[6]
endif
iIndex = 0
while iIndex < nPieces
setPieces[iIndex] = __Config_SetList.GetAt(iIndex)
iIndex += 1
endwhile
endif
iIndex = 0
While iIndex < setPieces.Length
If PlayerREF.IsEquipped(setPieces[iIndex] as Armor)
nEquippedPieces += 1
@ -59,8 +81,26 @@ Function UpdateSpells()
Int nBonusSpells = nEquippedPieces - 1
Bool bSpellRemoved = False
Bool bSpellAdded = False
Form[] bonusSpells
Form[] bonusSpells = __Config_SetBonusesList.ToArray()
if bSKSE
bonusSpells = __Config_SetBonusesList.ToArray()
else
int nSpells = __Config_SetBonusesList.GetSize()
if nSpells == 4
bonusSpells = new Form[4]
elseif nSpells == 5
bonusSpells = new Form[5]
else
bonusSpells = new Form[6]
endif
iIndex = 0
while iIndex < nSpells
bonusSpells[iIndex] = __Config_SetBonusesList.GetAt(iIndex)
iIndex += 1
endwhile
endif
iIndex = 0
While iIndex < bonusSpells.Length
Spell bonusSpell = bonusSpells[iIndex] as Spell

View File

@ -3,12 +3,12 @@ Scriptname _00E_Func_GetPointsInClass Hidden
int Function Run(Formlist akClassPerkformlist) Global
Actor PlayerREF = Game.GetForm(0x14) as Actor
Form[] perkForms = akClassPerkformlist.ToArray()
int PointsSpentInClass
int iClassIndex = 0
While iClassIndex < perkForms.Length
Perk iPerk = perkForms[iClassIndex] as Perk
int nItems = akClassPerkformlist.GetSize()
While iClassIndex < nItems
Perk iPerk = akClassPerkformlist.GetAt(iClassIndex) as Perk
If iPerk && PlayerREF.HasPerk(iPerk)
PointsSpentInClass += 1
EndIf

View File

@ -20,6 +20,10 @@ Float Property IdleUpdatePeriod = 30.0 AutoReadOnly
Event OnEffectStart(Actor akTarget, Actor akCaster)
if SKSE.GetVersion() == 0
return
endif
LockEquipUpdates()
CooldownShouts = New Shout[128]

View File

@ -431,10 +431,10 @@ Function StartCer()
MQ06_SC05_JorekBench.SetFactionOwner(MQ06_SC05_JorekBenchFaction)
Form[] idleMarkers = MQ06_SC05_IdleMarkerList.ToArray()
int nItems = MQ06_SC05_IdleMarkerList.GetSize()
Int iIndex = 0
While iIndex < idleMarkers.Length
(idleMarkers[iIndex] as ObjectReference).Disable()
While iIndex < nItems
(MQ06_SC05_IdleMarkerList.GetAt(iIndex) as ObjectReference).Disable()
iIndex += 1
EndWhile
@ -508,11 +508,11 @@ EndFunction
Function FillSpectators()
Form[] spectators = MQ06_SC05_RitualList.ToArray()
int nItems = MQ06_SC05_RitualList.GetSize()
Int iIndex = 0
While iIndex < spectators.Length
Actor akSpectator = (spectators[iIndex] as Actor)
If akSpectator.IsDead() == False
While iIndex < nItems
Actor akSpectator = (MQ06_SC05_RitualList.GetAt(iIndex) as Actor)
If ! akSpectator.IsDead()
akSpectator.MoveTo(CaliaRitualMarker)
SC05_SpectatorArray[iIndex].ForceRefTo(akSpectator)
EndIf
@ -542,10 +542,10 @@ Function UnfillSpectators()
MQ06_SC05_JorekBench.SetFactionOwner(None)
Form[] idleMarkers = MQ06_SC05_IdleMarkerList.ToArray()
int nItems = MQ06_SC05_IdleMarkerList.GetSize()
iIndex = 0
While iIndex < idleMarkers.Length
(idleMarkers[iIndex] as ObjectReference).Enable()
While iIndex < nItems
(MQ06_SC05_IdleMarkerList.GetAt(iIndex) as ObjectReference).Enable()
iIndex += 1
EndWhile

View File

@ -477,14 +477,14 @@ EndFunction
Function EnableEnemiesInFormlist(Formlist formlistToProcess, GlobalVariable counterGlobal)
Int Index
Form[] enemies = formlistToProcess.ToArray()
int nItems = formlistToProcess.GetSize()
counterGlobal.SetValueInt(enemies.Length)
counterGlobal.SetValueInt(nItems)
bDoneBattleFailsave = True
Index = 0
While Index < enemies.Length
Actor enemyRef = (enemies[Index] as Actor)
While Index < nItems
Actor enemyRef = (formlistToProcess.GetAt(Index) as Actor)
enemyRef.Enable()
enemyRef.SetAlpha(0.0)
Index += 1
@ -494,7 +494,7 @@ Function EnableEnemiesInFormlist(Formlist formlistToProcess, GlobalVariable coun
Utility.Wait(1)
MQ07a_EnemiesLeft.SetValueInt(enemies.Length)
MQ07a_EnemiesLeft.SetValueInt(nItems)
UpdateCurrentInstanceGlobal(MQ07a_EnemiesLeft)
If MQ07a_CurrentWave.GetValueInt() == 1
@ -768,11 +768,11 @@ Function EnableSigilStone()
MQ07a_SC14_SigilstoneFX.EnableNoWait()
MQ07a_SC14_SigilStoneLight2.EnableNoWait()
Form[] refsToDisable = MQ07a_SC14_FurnitureToDisable.ToArray()
ActorBase dummyOwner = PlayerREF.GetActorBase()
int nItems = MQ07a_SC14_FurnitureToDisable.GetSize()
Int Index = 0
While Index < refsToDisable.Length
(refsToDisable[Index] as ObjectReference).SetActorOwner(dummyOwner)
While Index < nItems
(MQ07a_SC14_FurnitureToDisable.GetAt(Index) as ObjectReference).SetActorOwner(dummyOwner)
Index += 1
EndWhile
@ -813,10 +813,10 @@ EndFunction
Function EndSC14()
Form[] refsToDisable = MQ07a_SC14_FurnitureToDisable.ToArray()
int nItems = MQ07a_SC14_FurnitureToDisable.GetSize()
Int Index = 0
While Index < refsToDisable.Length
(refsToDisable[Index] as ObjectReference).SetActorOwner(None)
While Index < nItems
(MQ07a_SC14_FurnitureToDisable.GetAt(Index) as ObjectReference).SetActorOwner(None)
Index += 1
EndWhile

View File

@ -191,12 +191,11 @@ EndFunction
Function DisableWolfPack() ; Disable Wolf pack if still alive, to make sure they don't interrupt the scene
Form[] wolfRefs = MQ11a_SC6_WolfPackGates.ToArray()
Int iIndex = wolfRefs.Length
Int iIndex = MQ11a_SC6_WolfPackGates.GetSize()
While iIndex > 0
iIndex -= 1
Actor WolfToDisable = wolfRefs[iIndex] as Actor
If WolfToDisable.IsDead() == False
Actor WolfToDisable = MQ11a_SC6_WolfPackGates.GetAt(iIndex) as Actor
If ! WolfToDisable.IsDead()
WolfToDisable.DisableNoWait()
EndIf
EndWhile
@ -1620,10 +1619,10 @@ Function StartTrackingFight(Int fightId, Int postFightQuestStage, FormList enemy
EndFunction
Function RaiseDeadServants(Formlist corpseList, ObjectReference corpseActivatorRef)
Form[] corpses = corpseList.ToArray()
int nItems = corpseList.GetSize()
Int Index = 0
While Index < corpses.Length
(corpses[Index] as ObjectReference).Activate(corpseActivatorRef)
While Index < nItems
(corpseList.GetAt(Index) as ObjectReference).Activate(corpseActivatorRef)
index += 1
EndWhile
EndFunction
@ -1652,18 +1651,18 @@ Function RegisterFightEnd(Int fightId, Int postFightQuestStage)
EndFunction
Function GiveKeyToEnemies(FormList enemyList, Key keyToGive)
Form[] enemies = enemyList.ToArray()
int nItems = enemyList.GetSize()
Int Index
Index = 0
While Index < enemies.Length
(enemies[Index] as ObjectReference).AddItem(keyToGive)
While Index < nItems
(enemyList.GetAt(Index) as ObjectReference).AddItem(keyToGive)
Index += 1
EndWhile
Index = 0
While Index < enemies.Length
_00E_Questshader.Play(enemies[Index] as ObjectReference)
While Index < nItems
_00E_Questshader.Play(enemyList.GetAt(Index) as ObjectReference)
Index += 1
EndWhile
EndFunction

View File

@ -42,11 +42,11 @@ Function PostFightCleanup()
If EnemyList
; Kill'em all as a safeguard!
Form[] enemies = EnemyList.ToArray()
int nItems = EnemyList.GetSize()
Int Index = 0
While Index < enemies.Length
Actor enemyRef = (enemies[Index] as Actor)
If enemyRef.IsDead() == False
While Index < nItems
Actor enemyRef = (EnemyList.GetAt(Index) as Actor)
If ! enemyRef.IsDead()
enemyRef.Kill(enemyRef) ; "Suicide" -> no XP for the player, hehe
EndIf
Index += 1
@ -57,10 +57,10 @@ Function PostFightCleanup()
EndFunction
Bool Function CheckEnemiesAreDead()
Form[] enemies = EnemyList.ToArray()
int nItems = EnemyList.GetSize()
Int Index = 0
While Index < enemies.Length
If (enemies[Index] as Actor).IsDead() == False
While Index < nItems
If (EnemyList.GetAt(Index) as Actor).IsDead() == False
Return False
EndIf
Index += 1

View File

@ -255,10 +255,10 @@ Function EnterCombat()
MQ13c_SC04_SpiderParent.Enable()
; Activate all spiders to get them released into the room
Form[] enemies = MQ13c_Nexushall_Spiders.ToArray()
int nItems = MQ13c_Nexushall_Spiders.GetSize()
Int index = 0
While index < enemies.Length
Actor enemy = enemies[index] as Actor
While index < nItems
Actor enemy = MQ13c_Nexushall_Spiders.GetAt(index) as Actor
if enemy != MQ13c_SC04_CenturionREF
enemy.Activate(akCompanionRomance)
EndIf