TryToAddToFaction - ReferenceAlias
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
EndFunctionParameters[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.
Notes:[edit | edit source]
- True is a reflection that the actor reference existed -> and AddToFaction() was called on it
- AddtoFaction() is an external call to the actor script, which does not wait, or return a value.
- Consquently, add to faction can still be queued or processing by the time this function returns true.
- False behaves as expected, no reference in alias, no actions performed
Examples[edit | edit source]
; Try to add the boss to the bandit faction
BossAlias.TryToAddToFaction(BanditFaction)