FindAllReferencesWithKeyword - ObjectReference
Jump to navigation
Jump to search
Member of: ObjectReference Script
Finds all references with any required keywords in the loaded area within the given radius of the calling ref.
Syntax[edit | edit source]
ObjectReference[] Function FindAllReferencesWithKeyword(Form arKeywordOrList, float afRadius) native
Parameters[edit | edit source]
- arKeywordOrList: Keyword to look for or form list of keywords which ref must have all of
- afRadius: Maximum distance from ref to look for a reference
Return Value[edit | edit source]
An array of references with the required keywords within the radius, empty if none was found.
Examples[edit | edit source]
; 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
Notes[edit | edit source]
- 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)
See Also[edit | edit source]
- ObjectReference Script
- Game Script
- FindAllReferencesOfType - ObjectReference
- FindClosestReferenceOfAnyTypeInList - Game
- FindClosestReferenceOfAnyTypeInListFromRef - Game
- FindClosestReferenceOfType - Game
- FindClosestReferenceOfTypeFromRef - Game
- FindRandomReferenceOfAnyTypeInListFromRef - Game
- FindRandomReferenceOfType - Game
- FindRandomReferenceOfTypeFromRef - Game