In the “First 60 mins with Mass” article a State Tree is setup such that each entity can wander around a NavMesh using the “Find Reachable Point” and “Follow Path” tasks.
My question is how would you go about giving each target a location to head towards, rather than select a random point?
The “Follow Path” task expects a FMassTargetLocation input, which is bound to something else it would seem, but I can’t seem to find a way to do that?
My first thought was “use an Event to pass the location across?” - which you can set FMassTargetLocation as the payload type, the outputs are the content and thus it can’t be bound to FMassTargetLocation.
Next, I figured I’d make a wrapper struct in the game plugin, use that to pass the payload over, and hopefully be able to bind that as the input - that just resulted in compile errors, as even after I added “MassAIBehavior” to the plugin build dependencies it was still giving my unresolved symbol errors for FMassTargetLocation ( __declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FMassTargetLocation ).
Finally, I figured “ok, maybe not optimal but what about just bouncing via a BP Task?” - but it seems you can’t create a variable of FMassTargetLocation type, so providing an output to bind too might well be impossible?
At this point I’m thinking it might just be easier to write my own version of the movement code and go from there, but wanted to check here in case I missed something obvious/non-obvious about this setup?
I encountered that exact problem last year. What I did, was creating a simple task to convert FVector to FMassTargetLocation. I just place it before the move task and use the output to feed the move task.
You’re very close — the key is that FMassTargetLocation is meant to be written via fragments, not passed like a regular variable/event payload.
Short answer:
Don’t try to pass FMassTargetLocation through events or BP. Instead, write to the Target fragment directly in a custom Mass processor or StateTree task.
Store your desired destination in a custom fragment (e.g. FMyMoveTarget)
Then have a processor/task copy it → FMassTargetLocation
Bottom line:
Mass AI expects movement data via fragments, not event payloads or BP variables — so the correct path is a custom task/processor that writes to FMassTargetLocation.
Seems like I was going down the right path, but your posts both confirmed that - they also made me realise that I was including the wrong plugin as a dependency which is why I couldn’t reference FMassTargetLocation properly (I was pulling in MassAI, not MassNavigation )
So, fixed that and now have a path forward, thanks