Afterwords it returns that faction to its original owner and clears the temporary faction storage list.
I put it through Cipscis's script validator but all NVSE functions are being read as errors for some reason. Everything else in the script compiles fine.
Related question: does ListGetCount get the total amount of items or the highest index in the FormList?
set iIndex to ListGetCount gcfocMainFactionsList ;gets the current item count
Label 10
if (iIndex >= 0)
set rCurrentFaction to ListGetNthForm gcfocMainFactionsList iIndex ;gets the faction at iIndex
if (rFighterOne.GetInFaction rCurrentFaction)
rCurrentFaction.ListAddReference gcfocFactionStorageListFighter1 ;stores the faction for F1
rFighterOne.RemoveFromFaction rCurrentFaction ;removes that faction temporarily
endif
set iIndex to iIndex - 1 ; go down the list
Goto 10
endif
...
set iIndex to ListGetCount gcfocFactionStorageListFighter1
Label 30
if (iIndex >= 0)
set rCurrentFaction to ListGetNthForm gcfocFactionStorageListFighter1 iIndex
ListRemoveForm gcfocFactionStorageListFighter1 rCurrentFaction ;removes that faction from the list
rFighterOne.AddToFaction rCurrentFaction 0 ;restores that faction to fighter
set iIndex to iIndex - 1 ; go down the list
Goto 30
endif
Label 10
if (iIndex >= 0)
set rCurrentFaction to ListGetNthForm gcfocMainFactionsList iIndex ;gets the faction at iIndex
if (rFighterOne.GetInFaction rCurrentFaction)
rCurrentFaction.ListAddReference gcfocFactionStorageListFighter1 ;stores the faction for F1
rFighterOne.RemoveFromFaction rCurrentFaction ;removes that faction temporarily
endif
set iIndex to iIndex - 1 ; go down the list
Goto 10
endif
...
set iIndex to ListGetCount gcfocFactionStorageListFighter1
Label 30
if (iIndex >= 0)
set rCurrentFaction to ListGetNthForm gcfocFactionStorageListFighter1 iIndex
ListRemoveForm gcfocFactionStorageListFighter1 rCurrentFaction ;removes that faction from the list
rFighterOne.AddToFaction rCurrentFaction 0 ;restores that faction to fighter
set iIndex to iIndex - 1 ; go down the list
Goto 30
endif
