Mods that add nearby NPCs to Aliases that break quests

Post » Sat Jul 18, 2015 9:52 pm

Force Greet packages breaks when actors are added to Aliases
Ok, here's the reason why Force Greet packages in the Forsworn Conspiracy quest lines sometimes works (e.g. the guard that intimidates you outside the inn after acquiring Margret's journal) and sometimes fails (e.g. Dryston who starts a brawl with you after acquiring Weylin's note outside The Warrens and the guard that ambushes you in Talos' shrine when you return to Eltrys).

Actors' Force Greet packages may fail if they are added to an Alias - even if that Alias has no attached packages. Adding actors to an Alias forces them to evaluate their AI. This is what's making the actors in this quest (and possibly others constructed similarly) to not Force Greet the player. Eventually the actors will re-acquire those failed Force Greet packages when they next evaluate their AI.

HOWEVER, some actors (e.g. intimidating guard outside of the inn, Dryston, Nepos' maid, the ambushing guard in Talos' shrine) in the Forsworn Conspiracy need to Force Greet the player immediately after entering and exiting an interior cell. Because these actors may move away (and they actually do) from their intended locations, they may not reacquire the failed Force Greet package. Regardless, actors Force Greeting the player much later in time may eventually get the quest running again, it is not usually ideal.

Here's my test https://sites.google.com/site/kuertee/testForswornConspiracyWetAndCold.zip with Wet and Cold. The save-file contains only the DLCs, unofficial patches, Live Another Life, and Wet and Cold. And here's my http://forums.nexusmods.com/index.php?/topic/844188-wet-and-cold/page-349#entry26917759 of the test in Wet and Cold's thread. I've already notified, Isoku, via PM of this.

Unaffected Actors
Anyway...Actors who don't need to move to the player (immediately after an interior-exterior cell-change) to enact their Force Greet on the player works because the player is immediately "there" and the package triggers immediately. The intimidating guard outside of the inn (after you acquire Margret's journal) is an example of these actors. He never fails to Force Greet the player because his package triggers immediately BEFORE any of my mods add him to any Aliases.

Affected Actors
Actors who do need to move to the player (immediately after an interior-exterior cell-change) to enact their Force Greet on the player fails because mods that adds their effects on NPCs by adding them to Aliases would have added them to their Aliases. Examples of these actors are Dryston, Nepos' maid and the ambushing guard in Talos' shrine. These actors are added to Aliases before they could Force Greet the player - which breaks their Force Greet package. Again, they may eventually reacquire these failed Force Greet packages but its unlikely due to other Conditions (e.g. location, Quest stage, etc.).

Note that the owning Quests' Priorities don't matter in this case. My mod's quests that finds NPCs all have a priority of 0 while most of the quests in the Forsworn Conspiracy have a priority of 60. Also, it doesn't matter whether the Alias they are getting added to have a Package or not. The simple event of adding them to the Alias fails these Force Greet packages. Again, actors may reacquire these failed Force Greet packages when they re-evaluate their AI in regards to their attached Quests' Priorities. But by then, other conditions may have removed those Force Greet packages already.

Affected mods
Mods that forces these actors to fail their Force Greet are mods that finds actors by adding them to aliases. My mods that are affected by these are: http://www.nexusmods.com/skyrim/mods/13241/, http://www.nexusmods.com/skyrim/mods/15223/, http://www.nexusmods.com/skyrim/mods/13248/, http://www.nexusmods.com/skyrim/mods/65243/, http://www.nexusmods.com/skyrim/mods/34569/, http://www.nexusmods.com/skyrim/mods/21828/, http://www.nexusmods.com/skyrim/mods/45654/. I'm sure there are other mods out that will similarly break these types of quests. One of them is, as described above, Wet and Cold. It adds its effects to NPCs by adding actors near the player to Aliases.

The fix
And this is how to fix these mods.

In the Aliases' Conditions for finding the actors, add three conditions:
  • IsInScene == 0 (e.g. Nepos' maid's Force Greet package is attached to a scene. My mods have already done this since their first releases.)
  • GetDistance (Player) > 1500 (This is the important Condition. It ensures that actors nearby has a chance to enact their Packages.)
  • GetDistance (Player) < 10000 (Use whatever distance you normally use to find actors.)
For combat mods (e.g. Battle Fatigue and Injuries, Fight or Fly, Useful Potions, Skill-based Damage Multipliers), I modify the distance Conditions above. These Conditions will add the NPC already in combat. Their attached Scenes and Packages would not matter in this case. And they will reacquire those when they re-evaluate their AI after combat anyway.
  • IsInCombat == 1 OR
  • GetDistance (Player) > 1500 AND
  • IsInCombat == 1 OR
  • GetDistance (Player) < 10000
NPC Reactions has an added layer of protection - because NPC Reactions have actual Packages that may interfere with other packages. If an actor in an NPC Reaction Alias is added to a Quest that has a Priority of more than 0, it is removed from that NPC Reaction Alias. The code is a bit more intricate, of course. It requires saving a list of Quests (that have a Priority of more than 0) and constantly checking if they are added to another.
Spoiler

      Int numAliases = actorRef.GetNumReferenceAliases ()      ; If (actorRef.GetDistance (kuNPCRQ.playerRef) > 1000000 && !isReactedToPlayer) || (lastNumAliases && numAliases > lastNumAliases)      ; If actorRef.GetDistance (kuNPCRQ.playerRef) > 1000000 && !isReactedToPlayer      If _npcReaction > 0 && lastNumAliases && numAliases > lastNumAliases && !actorRef.HasKeywordString("kuNPCRFoundNearbyNPCKW")         ;hasn't reacted to player or was added to a new aliases by another quest         ;remove from this alias         ; debugTrace ("OnUpdate " + actorRef + " moved away isReactedToPlayer " + isReactedToPlayer + " numAliases " + numAliases + " lastNumAliases " + lastNumAliases)         ; debugTrace ("OnUpdate " + actorRef + " moved away isReactedToPlayer " + isReactedToPlayer)         ; debugTrace ("OnUpdate " + actorRef + " numAliases " + numAliases + " lastNumAliases " + lastNumAliases)         Int i = 0         Int max = numAliases         ReferenceAlias refAlias         Quest refQuest         Int priority         While i < max && !isClearAtNextUpdate && !kuNPCRQ.loading && kuNPCRQ.uninstalling            refAlias = actorRef.GetNthReferenceAlias (i) as ReferenceAlias            refQuest = refAlias.GetOwningQuest ()            priority = refQuest.GetPriority ()            If priority && attachedQuests.Find (refQuest) == -1               debugTrace ("OnUpdate " + actorRef + " refQuest " + refQuest + " " + priority)               isClearAtNextUpdate = True            EndIf            i += 1         EndWhile      Else         ;----------SNIPPED----------      EndIf      If !actorRef.HasKeywordString("kuNPCRFoundNearbyNPCKW")         lastNumAliases = numAliases         Int i = 0         Int max = numAliases         ReferenceAlias refAlias         Quest refQuest         Int priority         Int emptyI         While i < max && !kuNPCRQ.loading && kuNPCRQ.uninstalling            refAlias = actorRef.GetNthReferenceAlias (i) as ReferenceAlias            refQuest = refAlias.GetOwningQuest ()            priority = refQuest.GetPriority ()            If priority && attachedQuests.Find (refQuest) == -1               emptyI = attachedQuests.Find (None)               If emptyI > -1                  attachedQuests [emptyI] = refQuest               EndIf            EndIf            i += 1         EndWhile      EndIf


I've fixed my affected mods now and will slowly re-release them.
User avatar
M!KkI
 
Posts: 3401
Joined: Sun Jul 16, 2006 7:50 am

Return to V - Skyrim