TryToSetValue - ReferenceAlias

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ReferenceAlias Script

This is a convenient way to set the actor value of an actor in an alias 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 SetValue() on them without having to test for an actor being present first.

Syntax[edit | edit source]

bool Function TryToSetValue(ActorValue akAV, float afValue)

Parameters[edit | edit source]

  • akAV: the Actor Value name you want to set
  • afValue: the value you want to set

Return Value[edit | edit source]

True if the alias contained an actor, false if the alias didn't contain an actor.

Examples[edit | edit source]

MyAlias.TryToSetActorValue(AggressionAV, 0)

Notes[edit | edit source]

Even though SetValue works on references, this function only works with actors, and so will fail and return false if the alias contains a reference, but not an actor.

See Also[edit | edit source]