Talk:AddToFaction - Actor
Revision as of 06:14, 5 November 2016 by imported>Lisselli (Added a function for adding an actor to many factions and optionally changing those faction's reaction.)
Does this make the player friendly with a normally hostile faction if added to it?
--PsiSoldier 09:32, 23 April 2012 (EDT)
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
- 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).