Background for Fallout 4
Member of the ObjectReference script
ObjectReference[]functionFindAllReferencesWithKeyword(FormakKeywordOrList, floatafRadius)Native

Description

Wiki Description

Finds all ObjectReference with any required keywords in the loaded area within the given radius of the calling ref.

Documentation Comment

Finds all references with the given keyword(s) in the loaded area within the given radius of the calling
ref and returns an array of them


Caveats

CK Wiki - Notes

  • If wanting to grab all actors in the loaded area using the keywords, ActorTypeNPC or ActorTypeHuman, the player will also be added to the array as its race contains both of those keywords. If having the player be in the array is not intended, you can remove it via Find - Array and then Remove - Array:
Actor Player = Game.GetPlayer()
ObjectReference[] kActors = Player.FindAllReferencesWithKeyword(ActorTypeNPC, 2048.0)

int playerIndex = kActors.Find(Player as Actor)
kActors.Remove(playerIndex)

Parameters

FormakKeywordOrList

CK Wiki Description

Keyword to look for or form list of keywords which ref must have all of

floatafRadius

CK Wiki Description

Maximum distance from ref to look for a ObjectReference


Examples

; Find all references with the ActorTypeAnimal keyword within 200 distance units of the player
ObjectReference[] kActorArray = Game.GetPlayer().FindAllReferencesWithKeyword(ActorTypeAnimal, 200.0)

; Find all references that match ALL keywords in the actor type formlist within 200 distance units of the player
ObjectReference[] kActorArray = Game.GetPlayer().FindAllReferencesWithKeyword(ActorTypeFormlist, 200.0)

; Find all references that match ANY keyword in the actor type formlist within 200 distance units of the player
Int i = 0
While i < ActorTypeFormlist.GetSize()
    ObjectReference[] kActorArray = Game.GetPlayer().FindAllReferencesWithKeyword(ActorTypeFormlist.GetAt(i), 200.0)
    i += 1
EndWhile

Auto-Generated Example

Form myForm__akKeywordOrList
float myFloat__afRadius

ObjectReference[] returnedValue = myObjectReference__toCallFunctionOn.FindAllReferencesWithKeyword(myForm__akKeywordOrList, myFloat__afRadius)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.