FindCreativeObjectsWithTag return nothing

Despite 2 devices with the tag are in the map I got 0 devices with this code :

# This function runs when the NPC is spawned in the world and ready to follow a behavior.
    OnBegin<override>()<suspends>:void =

        if:
            # Get the Agent (the NPC).
            Agent := GetAgent[]

            # Gets the Fortnite Character interface, which gets you access to its gameplay data 
            # including its AI module for navigation and focus.
            Character := Agent.GetFortCharacter[]

            # Get the Navigatable Interface, this allows you to tell it to move.
            Navigatable := Character.GetNavigatable[]

            # Get the Focus Interface, this allows you to tell it to look at something or somewhere.
            Focus := Character.GetFocusInterface[]
        then:


            TagGenerator := FindCreativeObjectsWithTag(PADTag{})

            for(Element:TagGenerator, PAD:=player_light_device[Element]):
                Print("Adding player_light_device")
                set PlayerAttachmentDevices = PlayerAttachmentDevices + array{PAD}
            
            Print("player_light_device count = " + ToString(PlayerAttachmentDevices.Length))
1 Like

You sure you’re even trying to fetch them here ? Does the final print show ?

It prints “player_light_device count = 0”

1 Like

Assuming player_light_device is a creative_device, are you sure you added the tags on them

100% sure.

in (InNPCBehavior:npc_behavior).FindCreativeObjectsWithTag extension | Unreal Editor for Fortnite Documentation | Epic Developer Community
they say :

Blockquote
Generates a creative_object_interface for every creative object that has been marked with the specified Tag. Will not find anything if called on an npc_behavior that is not simulating.
Blockquote

Does it simulate in OnBegin ?

Does it work when you try to access those devices outside of the NPC behavior using the (:creative_device_base).FindCreativeObjectsWithTag(:tag) method instead

The behavior method was just added during last update maybe it’s broken idk :person_shrugging:

It work in the player_light_device := class(creative_device):
So it’s a bug in the npc_behavior class.

1 Like

haha great, can you try to add a delay before fetching from the NPC maybe ? Otherwise you’ll need to come up with a custom solution like this

1 Like

Unknown identifier ‘GameManagerMap’ in npc_behavior, which looks logic.

1 Like

Got it. The GameManagerMap var must be defined outside the class.

Thank you.

1 Like