Hello
I am struggling with figuring out the following problem:
Game starts, player chooses a team (just a widget button that sets a boolean in the player controller blueprint). Player chooses an ai from another widget button which determines which AI bot to spawn (actor class).
When I run the test with 2 clients there is a following problem:
One of the actors never moves towards the other actor (moving logic is in the actor’s blueprint). They should find each other through “Get all actors with tag” function.
Works fine when they are both placed into the world.
However, when I first spawn just a spawning point (with the same widget system) from which the Ai actors spawn, they do actually find each other and walk towards each other, but one of them always spawns 2 actors.
Spawn events are run on server (I tried other opptions too).
This is beyond confusing.
Is it because I actually have to create teams and assign player controllers in a proper way?
Any guidance is highly appreciated!
If you add a print right after the server spawn, how many prints do you have in total?
Add also “has authority” for sanity before any spawning actor.
@MayhemMirror
Hi,
I really appreciate you taking time to read my question and respond!
Server prints a string for both spawns. Also client 1 prints a string when spawning an actor and client 2 prints a string when spawning an actor. All 3 prints are visible on both clients.
When I run spawn events on “owning client” then 1 actor doesn’t spawn, but both clients can see the second actor.
When I put “switch has authority” before the spawn events, no actor spawns and no strings printed.
But if I plug it into “remote” then both actors spawn, or more specifically 1 of them spawns 2 actors - the same way as if there is no switch. Both clients can see all the spawned actors.
To be clear I tested this with a spawning point that spawns the actors and the switch has authority was placed in the player controller blueprint before the spawn event of the spawn points.
When spawning actors directly without the spawn point, there is only 1 actor spawning on 1 client and that actor doesn’t move, but turns against the other actor as intended. The other actor spawns, moves and turns as intended.
Also when spawning ai actors directly without a spawning point, the print string only prints on server, neither client print the string. The only thing which is changed in the spawn event in the player controller blueprint is the actor class from spawn point actor to the ai bot actor.