Download

Spawning actors - I need help

I need to spawn BOTs in my level but basically they do nothing when spawned, I’ve made these bots in BP, no behavior tree.
When game starts it opens the main menu, then,after selections, it opens the choosen single player level which contains in the level BP the logic to spawn the human player and the BOTs.
I think the problem is that i need to assign to every BOT a controller, but which one?
Honestly I can’t figure it out.

Keep in mind that a “controller” is really a “player”. So if any other player will use them, then you don’t need asign them a “controller”.

You need give an AI to these bots. If they don’t have anything to do, they do anything.

Are you talking about bots controlled by behavior trees?
The AI I’ve made is “coded” directly in them I’m not using behavior trees, If I put them in the level they just behave rightly but when I spawn them they sit there idle.
These bots are vehicles with basic pathfinding and other stuff, so you say that there’s no need for them to be possessed by any controller?
Thanks for your help by the way. :slight_smile:

Could you post your bot code?

How are you firing off your code? There is a difference between being spawned and begin play.

So guys after banging my head for days on this I stumbled on this thread: How do I assign an AI Controller to a Pawn? - UE4 AnswerHub
Well in the Event Graph I spawned my BOTs by SPAWN ACTOR node, dragged the RETURN VALUE and CASTed TO PAWN.
Spawned AI Controller by SPAWN ACTOR node as well, and dragged its RETURN VALUE and typed “possess”.
Then dragged the AS PAWN output pin into the IN PAWN of the POSSESS node, and that’s it.
It just works fine.
I hope this can help someone else.

Vegetamaker I can it is a bit long though: basically it’s pathfinding based on cooked nav points, aiming and shooting, use pickups.
ZoltanJr: I fire off my code by functions looped and called on BEGIN PLAY.
If you guys have further advice I will more than happy to listen to it. :slight_smile:

Thanks to all of you guys you make the best community in the world, it’s people like you that make this community special.
Most of my progress I owe it to people who has had and has solved, issues before I have, people who know more than me and people willing to help and share their experiences.
And thanks Epic: I’m a long time, devoted, loyal customer, you are making the best engine out there.