ForceRefIfEmpty - ReferenceAlias

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ReferenceAlias Script

Forces this alias to use the specified reference, but only if the alias is currently empty

Syntax[edit | edit source]

bool Function ForceRefIfEmpty(ObjectReference akNewRef)
	if (GetReference())
		return False
	else
		ForceRefTo(akNewRef)
		return True
	endif
EndFunction

Parameters[edit | edit source]

Return Value[edit | edit source]

True if the alias now holds the passed reference, false if it was already filled.

Examples[edit | edit source]

; Force the alias to use the random person as the reference, but only if the alias is currently empty
Alias_JohnDoe.ForceRefIfEmpty(RandomPerson)

Notes:[edit | edit source]

Return value is NOT a true reflection of (AliasReference == ExpectedForcedResult)

  • It IS a reflection that the alias met the criteria to have ForceRefTo() called on it
  • ForceRefTo does not yield and wait for the alias's reference to reflect the that of the new forced value
  • ForceRefTo may be queued or in progress by the time this function returns true.
  • False means cannot be filled, alias is already occupied

See Also[edit | edit source]