Jump to content

Courier not associating with crime faction


Recommended Posts

Hi all,

I'm working on a mod to improve the courier and while integrating fixes from the unofficial patch, I realized the courier didnt seem to be affected by crime. I've modified the script below to use IsChild since holds themselves are not the primary location of the cells the courier spawns in, which is likely the cause of the lack of crime association.

Scriptname WECrimeFactionAliasScript extends ReferenceAlias  
{Based on the HoldLocationAlias property, puts the actor in this alias in the correct crime Faction}

LocationAlias Property myHoldLocation Auto

Location Property HaafingarHoldLocation Auto
Location Property ReachHoldLocation Auto
Location Property HjaalmarchHoldLocation Auto
Location Property WhiterunHoldLocation Auto
Location Property FalkreathHoldLocation Auto
Location Property PaleHoldLocation Auto
Location Property WinterholdHoldLocation Auto
Location Property EastmarchHoldLocation Auto
Location Property RiftHoldLocation Auto

Faction Property CrimeFactionHaafingar Auto
Faction Property CrimeFactionReach Auto	
Faction Property CrimeFactionHjaalmarch Auto
Faction Property CrimeFactionWhiterun Auto
Faction Property CrimeFactionFalkreath Auto
Faction Property CrimeFactionPale Auto
Faction Property CrimeFactionWinterhold Auto
Faction Property CrimeFactionEastmarch Auto	
Faction Property CrimeFactionRift Auto

Event OnLoad()
	Location myHold = myHoldLocation.GetLocation()
	Faction myCrimeFaction = GetCrimeFactionForHold(myHold)
	Actor selfActor = GetActorReference()
	
; 	debug.trace(self + "OnLoad() myHoldLocation: " + myHold + " means I should get the crime Faction: " + myCrimeFaction)
	selfActor.SetCrimeFaction(myCrimeFaction)
EndEvent

Faction Function GetCrimeFactionForHold(Location HoldLocation)
	{Returns the normal crime Faction for the hold}

	Faction ReturnFaction
	
	If HaafingarHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionHaafingar
	ElseIf ReachHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionReach
	ElseIf HjaalmarchHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionHjaalmarch
	ElseIf WhiterunHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionWhiterun
	ElseIf FalkreathHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionFalkreath
	ElseIf PaleHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionPale
	ElseIf WinterholdHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionWinterhold
	ElseIf EastmarchHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionEastmarch
	ElseIf RiftHoldLocation.IsChild(HoldLocation)
		returnFaction = CrimeFactionRift
	Else

	EndIf
	
	return ReturnFaction

EndFunction

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...