CheckLocationAgainstArray - CommonArrayFunctions

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: CommonArrayFunctions Script

Checks to see if the specified location is in the array, or optionally is a child of one of the locations in the array.

Syntax[edit | edit source]

bool Function CheckLocationAgainstArray(Location ObjectToCheck, Location[] ArrayToCheck, \
  bool returnValueIfArrayIsEmpty = false, bool matchIfChildLocation = false) global

Parameters[edit | edit source]

  • ObjectToCheck: The Location we are looking for
  • ArrayToCheck: The Location array we are looking in
  • returnValueIfArrayIsEmpty: If the array is empty, return this.
    • Default: False
  • matchIfChildLocation: If true, will check each location to see if ObjectToCheck is a child of the location
    • Default: False

Return Value[edit | edit source]

  • True: If the ObjectToCheck is one of the locations in ArrayToCheck (or a child, if matchIfChildLocation)
  • False: If the ObjectToCheck has not one of the locations in ArrayToCheck (and not a child, if matchIfChildLocation)
  • False: If ObjectToCheck is None
  • returnValueIfArrayIsEmpty: If ArrayToCheck is Empty/None

Examples[edit | edit source]

if CommonArrayFunctions.CheckLocationAgainstArray(PlayerLocation, DiamondCityLocations, matchIfChildLocation = true)
   Debug.Trace("Player is in a diamond city location! (or a child thereof)")
endIf

See Also[edit | edit source]