Difference between revisions of "AddToFaction - Actor"
→Examples: Added a nice little example code for changing reactions to multiple factions using an array.
imported>Terra Nova2 m |
imported>Lisselli (→Examples: Added a nice little example code for changing reactions to multiple factions using an array.) |
||
Line 30: | Line 30: | ||
PlayerFaction.SetReaction(FalmerFaction, 3) | PlayerFaction.SetReaction(FalmerFaction, 3) | ||
</source> | </source> | ||
<br> | |||
<source lang="papyrus"> | |||
Faction property PlayerFaction auto | |||
Faction[] property EnemyFactions auto | |||
; BanditFaction, CreatureFaction, FalmerFaction, as examples in the array. | |||
Function SetFactionReactions(Faction akFaction, Faction[] akFactionReactionToChange, Int iReaction=0) | |||
Int iIndex = akFactionReactionToChange.Length | |||
While iIndex | |||
iIndex -= 1 | |||
akFaction.SetReaction(akFactionReactionToChange[iIndex], iReaction) | |||
EndWhile | |||
EndFunction | |||
; Use this like so: | |||
SetFactionReactions(PlayerFaction, EnemyFactions, 3) | |||
</source> | |||
== Notes == | == Notes == | ||
*For faction members of factions normally an enemy to the player, simply adding the player to the faction will not make them friendly to the player if their [http://www.creationkit.com/AI_Data_Tab Aggression] level is "Very Aggressive". Therefore when you add the player to such factions, you must also change their reaction accordingly through [[SetReaction - Faction]] and make them a "friend". | *For faction members of factions normally an enemy to the player, simply adding the player to the faction will not make them friendly to the player if their [http://www.creationkit.com/AI_Data_Tab Aggression] level is "Very Aggressive". Therefore when you add the player to such factions, you must also change their reaction accordingly through [[SetReaction - Faction]] and make them a "friend". |