TryToAddToFaction - ReferenceAlias

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ReferenceAlias Script

This is a convenient way to add an actor in an alias to a faction without calling GetActorReference() on it. It's mostly useful in cases where you have lots of aliases that may or may not be filled and you want to call AddToFaction() on them without having to test for a reference being present first.

Syntax[edit | edit source]

bool Function TryToAddToFaction(Faction FactionToAddTo)
	Actor ActorRef = GetActorReference()
	if ActorRef
		ActorRef.AddToFaction(FactionToAddTo)
		Return True
	EndIf
	Return False
EndFunction

Parameters[edit | edit source]

  • FactionToAddTo: The faction to add the actor to

Return Value[edit | edit source]

True if the actor was added to the faction, false if no actor existed to be added.

Examples[edit | edit source]

; Try to add the boss to the bandit faction
BossAlias.TryToAddToFaction(BanditFaction)

See Also[edit | edit source]