Difference between revisions of "Talk:AddToFaction - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>PsiSoldier
(Clarification)
 
imported>Lisselli
(Added a function for adding an actor to many factions and optionally changing those faction's reaction.)
 
Line 2: Line 2:


--[[User:PsiSoldier|PsiSoldier]] 09:32, 23 April 2012 (EDT)
--[[User:PsiSoldier|PsiSoldier]] 09:32, 23 April 2012 (EDT)
: Unforunately, it does not. You need to change the factions' reaction to friendly. --[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]])
== AddToFactions ==
This function is for adding the player or an actor to many factions and optionally changing that faction's reaction.<br>
<source lang="papyrus">
Function AddToFactions(Actor akActor, Faction akFaction, Faction[] akFactions, Bool abSetReactions=False, Int aiNewValue=0)
; Adding the actor to many factions first.
Int Index = akFactions.Length
While (Index)
Index -= 1
akActor.AddToFaction(akFactions[Index])
EndWhile
; Setting the faction reactions to be neutral, an enemy, or friendly with the calling faction. (0,1,2,3)
; Note: Adding the player to ,for example, a Wolf Faction will not make them friends. You must change the Wolf faction's faction reaction to 3.
if !abSetReactions
While Index
Index += 1
akFaction.SetReaction(akFactions[Index], aiNewValue)
EndWhile
endif
EndFunction
</source>
#'''Advantages'''
##Don't need to make multiple AddToFaction calls, or make a lot of Faction properties.
##Can choose rather to change reactions or not.
#'''Disadvantages'''
##Cannot be used to remove the actor from all factions at once(yet).

Latest revision as of 06:14, 5 November 2016

Does this make the player friendly with a normally hostile faction if added to it?

--PsiSoldier 09:32, 23 April 2012 (EDT)

Unforunately, it does not. You need to change the factions' reaction to friendly. --Lisselli (talk)

AddToFactions[edit source]

This function is for adding the player or an actor to many factions and optionally changing that faction's reaction.

Function AddToFactions(Actor akActor, Faction akFaction, Faction[] akFactions, Bool abSetReactions=False, Int aiNewValue=0)

	; Adding the actor to many factions first.
	Int Index = akFactions.Length
	While (Index)
		Index -= 1
		akActor.AddToFaction(akFactions[Index])
	EndWhile
	
	; Setting the faction reactions to be neutral, an enemy, or friendly with the calling faction. (0,1,2,3)
	; Note: Adding the player to ,for example, a Wolf Faction will not make them friends. You must change the Wolf faction's faction reaction to 3.
	if !abSetReactions	
		While Index
			Index += 1
			akFaction.SetReaction(akFactions[Index], aiNewValue)
		EndWhile
	endif


EndFunction
  1. Advantages
    1. Don't need to make multiple AddToFaction calls, or make a lot of Faction properties.
    2. Can choose rather to change reactions or not.
  2. Disadvantages
    1. Cannot be used to remove the actor from all factions at once(yet).