Jump to content

Change faction / NameIncludes or CompareName


JustChill

Recommended Posts

Hey there,

 

I've two questions and I hope someone has the time to give me a response. :smile:

 

First of all, I would like to change the faction of various creatures via script (so I don't have to add the base records into my own mod), but "SetFactionRank" only accepts references, but no base records.

Even if I save a base record into a reference variable it doesn't work. :sad:

 

So is there any way to add creatures into a faction, but by using it's base record as reference?

 

 

 

Second thing are the functions NameIncludes and CompareName. Both functions are present in OBSE (which is hilarious, as they do the same), but none of them is in NVSE or JIP available. :sad:

Is there any equivalent for that command? It's very useful as for asking about a special part of a string for example.

 

 

 

 

My current solution to add creatures to respective factions is to use GetFirstRef and GetNextRef and then using GetModelPath. This works pretty well so far, but I have to compare the whole model path.

For example:

string_var strCreaModelPath
Ref CreaRef
[...]
Begin GameMode
Set CreaRef to GetFirstRef 43 1 0
 
While CreaRef != 0
Set iCompare to -2
Set strCreaModelPath to CreaRef.GetModelPath
Set iCompare to sv_compare "Creatures\Dog\Skeleton.nif", strCreaModelPath
if iCompare == 0
[... Set CreatureRef as part of a specific faction.]
Endif
Set CreaRef to GetNextRef
Loop
[...]
End

It would be much easier to use NameIncludes for searching just for "Dog", instead of the whole path, even though it already works in that case either (I don't know if NameIncludes would have more performance impact than comparing the whole string with the expected model path. But one for sure: If I have one letter wrong in the comparison string, it won't work. So using "NameIncludes" would be much, much easier).

 

However, I would prefer a function with which I easily can add new factions to a base record, without having the need of a reference, but direcly accessing the base record of said creature.

Since I could spare that whole scanning for creature references nearby the player, which has a performance impact. :sad:

Furthermore with the scanning, I've to check for special creatures by asking for the BaseObject and comparing the EditorID of the base object then, since not EVERY creature with the dog model should be added to the faction. Which is an additional impact on the performance in such a loop. :sad:

 

 

I appreciate any help. :smile:

 

Cheers

Link to comment
Share on other sites

  • 4 years later...

So I went back into this whole thing with factions...

This time my approach is to have form lists which contain the respective base forms and use SetBaseFactionRank as before.

 

 

HOWEVER, it turns out that starting a game and then loading a savegame where the player is in fron of dynamic factions seems not to be a good idea.

As upon loading these turn out hostile, even if the player has the correct perk.

 

 

scn DHMoperationalSetFactionsScript

short sAnimalListCountOP
short sAnimalListIndexOP
ref rAnimalListFormOP
short sEvaluateAllyEnemy

Begin Function{sEvaluateAllyEnemy}
    if sEvaluateAllyEnemy
        if Player.HasPerk DHMAnimalFriend
            SetEnemy PlayerFaction DHMMammalFriendFaction 1 1
        endif
        if Player.HasPerk DHMReptileFriend
            SetEnemy PlayerFaction DHMReptileFriendFaction 1 1
        endif
        if Player.HasPerk DHMInsectFriend
            SetEnemy PlayerFaction DHMInsectFriendFaction 1 1
        endif
        if Player.HasPerk DHMAbomiFriend
            SetEnemy PlayerFaction DHMAbomiFriendFaction 1 1
        endif
    endif

    if DHMMCMQuest.DHMAlsoBosses
        Let sAnimalListCountOP := ListGetCount DHMMammalBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMMammalBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMMammalFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMGeckoBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMGeckoBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMReptileFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMArthopodBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMArthopodBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMInsectFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMAbominationBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMAbominationBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
    else
        Let sAnimalListCountOP := ListGetCount DHMMammalBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMMammalBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMGeckoBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMGeckoBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMReptileFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMArthopodBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMArthopodBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMInsectFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMAbominationBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMAbominationBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAlsoCyber
        Let sAnimalListCountOP := ListGetCount DHMCyberdogListDlcOWB
        if sAnimalListCountOP
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMCyberdogListDlcOWB sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction 0 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMCyberdogBossListDlcOWB
            if sAnimalListCountOP
                While sAnimalListIndexOP < sAnimalListCountOP
                    Let rAnimalListFormOP := ListGetNthForm DHMCyberdogBossListDlcOWB sAnimalListIndexOP
                    if isFormValid rAnimalListFormOP
                        SetBaseFactionRank DHMMammalFriendFaction 0 rAnimalListFormOP
                    endif
                    Let sAnimalListIndexOP += 1
                Loop
            endif
        else
            Let sAnimalListCountOP := ListGetCount DHMCyberdogBossListDlcOWB
            if sAnimalListCountOP
                While sAnimalListIndexOP < sAnimalListCountOP
                    Let rAnimalListFormOP := ListGetNthForm DHMCyberdogBossListDlcOWB sAnimalListIndexOP
                    if isFormValid rAnimalListFormOP
                        SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP
                    endif
                    Let sAnimalListIndexOP += 1
                Loop
            endif
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMCyberdogListDlcOWB
        if sAnimalListCountOP
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMCyberdogListDlcOWB sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMCyberdogBossListDlcOWB
        if sAnimalListCountOP
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMCyberdogBossListDlcOWB sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddDClawsToReptile
        Let sAnimalListCountOP := ListGetCount DHMDeathClawList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMDeathClawList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMReptileFriendFaction 0 rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMDeathClawBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMDeathClawBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMReptileFriendFaction 0 rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMDeathClawBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMDeathClawBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMReptileFriendFaction -1 rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMDeathClawList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMDeathClawList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                SetBaseFactionRank DHMReptileFriendFaction -1 rAnimalListFormOP            
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMDeathClawBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMDeathClawBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                    SetBaseFactionRank DHMReptileFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMDeathClawBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMDeathClawBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                    SetBaseFactionRank DHMReptileFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddGhoulToAbom
        Let sAnimalListCountOP := ListGetCount DHMGhoulList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMGhoulList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMGhoulBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMGhoulBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMGhoulBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMGhoulBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMGhoulList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMGhoulList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMGhoulBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMGhoulBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddSuperMuToAbom
        Let sAnimalListCountOP := ListGetCount DHMSupermutantList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMSupermutantList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMSupermutantBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMSupermutantBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMSupermutantBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMSupermutantBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMSupermutantList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMSupermutantList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMSupermutantBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMSupermutantBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddNightkinToAbom
        Let sAnimalListCountOP := ListGetCount DHMNightkinList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMNightkinList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMNightkinBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightkinBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMNightkinBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightkinBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMNightkinList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMNightkinList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        Let sAnimalListCountOP := ListGetCount DHMNightkinBossList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMNightkinBossList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
            endif
            Let sAnimalListIndexOP += 1
        Loop
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddGhostPeopToAbomDLC
        Let sAnimalListCountOP := ListGetCount DHMGhostPeopleListDlcDM
        if sAnimalListCountOP
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMGhostPeopleListDlcDM sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
            Let sAnimalListIndexOP := 0
        endif
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMGhostPeopleBossListDlcDM
            if sAnimalListCountOP
                While sAnimalListIndexOP < sAnimalListCountOP
                    Let rAnimalListFormOP := ListGetNthForm DHMGhostPeopleBossListDlcDM sAnimalListIndexOP
                    if isFormValid rAnimalListFormOP
                        SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                    endif
                    Let sAnimalListIndexOP += 1
                Loop
            endif
        else
            Let sAnimalListCountOP := ListGetCount DHMGhostPeopleBossListDlcDM
            if sAnimalListCountOP
                While sAnimalListIndexOP < sAnimalListCountOP
                    Let rAnimalListFormOP := ListGetNthForm DHMGhostPeopleBossListDlcDM sAnimalListIndexOP
                    if isFormValid rAnimalListFormOP
                        SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                    endif
                    Let sAnimalListIndexOP += 1
                Loop
            endif
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMGhostPeopleListDlcDM
        if sAnimalListCountOP
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMGhostPeopleListDlcDM sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                endif
                Let sAnimalListIndexOP += 1
            Loop
            Let sAnimalListIndexOP := 0
            Let sAnimalListCountOP := ListGetCount DHMGhostPeopleBossListDlcDM
            if sAnimalListCountOP
                While sAnimalListIndexOP < sAnimalListCountOP
                    Let rAnimalListFormOP := ListGetNthForm DHMGhostPeopleBossListDlcDM sAnimalListIndexOP
                    if isFormValid rAnimalListFormOP
                        SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                    endif
                    Let sAnimalListIndexOP += 1
                Loop
            endif
        endif
    endif
    Let sAnimalListIndexOP := 0
    if DHMMCMQuest.DHMAddNStalkerToMammal
        Let sAnimalListCountOP := ListGetCount DHMNightStalkerList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMMammalFriendFaction 0 rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMNightStalkerBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction 0 rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMNightStalkerBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    else
        Let sAnimalListCountOP := ListGetCount DHMNightStalkerList
        While sAnimalListIndexOP < sAnimalListCountOP
            Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerList sAnimalListIndexOP
            if isFormValid rAnimalListFormOP
                SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP            
            endif
            Let sAnimalListIndexOP += 1
        Loop
        Let sAnimalListIndexOP := 0
        if DHMMCMQuest.DHMAlsoBosses
            Let sAnimalListCountOP := ListGetCount DHMNightStalkerBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction 0 rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        else
            Let sAnimalListCountOP := ListGetCount DHMNightStalkerBossList
            While sAnimalListIndexOP < sAnimalListCountOP
                Let rAnimalListFormOP := ListGetNthForm DHMNightStalkerBossList sAnimalListIndexOP
                if isFormValid rAnimalListFormOP
                    SetBaseFactionRank DHMAbomiFriendFaction -1 rAnimalListFormOP
                    SetBaseFactionRank DHMMammalFriendFaction -1 rAnimalListFormOP            
                endif
                Let sAnimalListIndexOP += 1
            Loop
        endif
    endif
    Let sAnimalListIndexOP := 0

    if sEvaluateAllyEnemy
        if Player.GetPerkRank DHMAnimalFriend == 1
            SetAlly PlayerFaction DHMMammalFriendFaction
        elseif Player.GetPerkRank DHMAnimalFriend == 2
            SetAlly PlayerFaction DHMMammalFriendFaction 1 1
        endif
        if Player.GetPerkRank DHMReptileFriend == 1
            SetAlly PlayerFaction DHMReptileFriendFaction
        elseif Player.GetPerkRank DHMReptileFriend == 2
            SetAlly PlayerFaction DHMReptileFriendFaction 1 1
        endif
        if Player.GetPerkRank DHMInsectFriend == 1
            SetAlly PlayerFaction DHMInsectFriendFaction
        elseif Player.GetPerkRank DHMInsectFriend == 2
            SetAlly PlayerFaction DHMInsectFriendFaction 1 1
        endif
        if Player.GetPerkRank DHMAbomiFriend == 1
            SetAlly PlayerFaction DHMAbomiFriendFaction
        elseif Player.GetPerkRank DHMAbomiFriend == 2
            SetAlly PlayerFaction DHMAbomiFriendFaction 1 1
        endif
    endif
End

 

 

This function evaluates the faction. It's working normally, except when loading a game after booting the game, as said.

Funnily, when loading a game again the factions get correct.

 

But this doesn't sound like a proper solution... "Load the game once more to fix faction issues". oO

 

 

The funny thing is, the boss (Den Mother --> Nightstalker) in that cave is always correct, but the spawned ones seem to have issues with getting grouped into the correct faction initially.

While they don't when the save is loaded again.

 

 

 

 

Is it possible that the script is too heavy?

The function only get triggered upon loading, or when changing settings in MCM.

And these spawned Nightstalkers always seem to have issues realizing that they should not be hostile. Somehow they do not want to get into the faction (or out of it) easily. :/

Link to comment
Share on other sites

Alright... So interestingly, they don't load up hostile upon start when all the creatures are added into the list in

Menu Mode 4

and then added into the respective animal friend faction.

 

However, as that's the main menu it's not possible to gather variables (from a savegame) that change the faction of just some specific creatures.

 

So I assume that the change of faction is performed at a point upon loading a recently started game, where the script fails to do so.

Funnily reloading the very same save once more fixes it.

 

So one attempt would be to make the mod static (creatures are added to faction upon main menu) or to find a method to apply faction changes while loading a save, as otherwise it seems they do not get applied. :(

 

Even more weird the Nightstalkers load up as allies but then turn hostile. But having them being corrected upon reloading is even weirder. oO

Link to comment
Share on other sites

Alright... I've updated the scanning version of the mod (for the english version) at least.

Additionally, I've recorded my issues with the "advanced" version and sent the video to jazzisparis in hope he can somewhat find out what's wrong with SetBaseFactionRank. :(

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...