This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi everyone, i'm learning some Godot and GDScript and i'm using Multiplayer Bomber one scripts but for a custom 3D game, i want to spawn 2 players but i can't achieve it. How can i achieve spawn that players on multiple Position3D node in the scene ?

Here is the code from Multiplayer Bomber where players spawns:

remote func pre_start_game(spawn_points):
# Change scene.
var world = load("res://world.tscn").instance()


var player_scene = load("res://player.tscn")

for p_id in spawn_points:
    var spawn_pos = world.get_node("SpawnPoints/" + str(spawn_points[p_id])).position
    var player = player_scene.instance()

    player.set_name(str(p_id)) # Use unique ID as node name.
    player.set_network_master(p_id) #set unique id as master.

    if p_id == get_tree().get_network_unique_id():
        # If node for this peer id, set name.
        # Otherwise set name from peer.


# Set up score.
world.get_node("Score").add_player(get_tree().get_network_unique_id(), player_name)
for pn in players:
    world.get_node("Score").add_player(pn, players[pn])

if not get_tree().is_network_server():
    # Tell server we are ready to start.
    rpc_id(1, "ready_to_start", get_tree().get_network_unique_id())
elif players.size() == 0:

Thanks in advance for the help !

Godot version 3.3.2
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.