I am trying to create a game where each player has a bow that follows them. I want the bow to be the same so I don’t have to make the same bow over and over again but I am having trouble trying to get each instance of the bow to go to the correct player. Player one gets it and player 2 doesn’t even though I have set everything to the correct ID in the Player ID variable that I made.
Player 1 has the bow and player 2 Doesn’t in the picture. I want them both to have a bow and both of them be able to control it separately. I would also like this to be stackable so I can have it work with multiple player like 4 to 6 or something
Welcome. I know new members are limited when it comes to posting pictures but we’re going to need to see your relevant events.
You can use an ID object variable or object linking. I prefer object linking.
https://wiki.gdevelop.io/gdevelop5/all-features/linked-objects/
The key is to make sure the matching instances are picked with conditions. That way only the correct objects get modified by the actions.
My guess is both arrows are following 1 character. Did you check their locations? You can use the debugger or add the locations to a text object.
Thanks! Here is the events by the way, i’ still kinda having some trouble.
I didn’t notice that this was for multi-player. I haven’t used that part yet.
If you have to pick the bow owned by the current player, do you also have to pick the player object owned by the current player before you can place the bow around it? This is just an assumption since I have no experience with multi-player.
Yes. I was trying to get that “point” action to work with the X and Y Coordinate of a specific player with a specific ID. But I can’t figure it out.
I don’t know if you need the ID with multi-player unless the player has multiple bows. I think you use the same condition as the bow.
In the first event try adding object player is owned by current player That way when you use the action that places the bow it will know which player object to get the X, Y from.
I have no idea how you set who owns which object but as long as it’s setup, it seems logical that that is what needs to happen.
Edit: I see in the document that certain objects need the multiplayer behavior and need to be set to the right player. Although, some can be left in control of the host. Again, I’m still not clear about who gets what.
If you’re still stuck, I would look at some of the example projects and the documentation.
I skimmed through the document. I’m still confused a bit by the whole host and player setup.
https://wiki.gdevelop.io/gdevelop5/all-features/multiplayer/
Alright thanks! Ill try this out
Ope, I got it fixed! I just had to place a piece of code that Repeated for each Instance of the bow under when this scene starts and change the variable that I had set to the wrong one. I also did what you had said to have a condition for the player to get the correct player. Now the game works perfectly!
Thanks!
1 Like