How do I let players pick between two teams?

0 favourites
  • 4 posts
From the Asset Store
Who wants to be a Millionaire Clone. An educational coding source
  • Creating a multiplayer game and I want there to be two teams, each side has different weapons/health. What is the best way to let players pick a team?

    I'm considering letting there be an option to pick a side as they type in their user on a menu screen. So would I assign the peer a variable based on the side they choose and have the host place them in the correct spawn based on the variable?

  • Have an instance variable for team and when players attack eachother make sure their teams are different

  • Have an instance variable for team and when players attack eachother make sure their teams are different

    Thanks, it took me awhile but I got it thanks to your advice.

    In case anyone else stumbles across this and is curious. I pretty much just set up a local variable called FiringPeerSide similar to FiringPeerID from the Multiplayer example. This was my third parameter for the Function TestHit. As tarik suggested I included an instance variable called 'side'. I also had two global variables Team1 = 0, and Team2 = 1. The host would always be on Team2 and every time a peer connected:

    Team1 <= Team2 : Peer - set side to 2. add 1 to Team 1

    Else : Peer set side to 1. Add 1 to Team 2

    Note: these two events are subevents in the Host group under the 'Multiplayer-On Peer Connected' event from the Multiplayer example.

    I think that was it and so far it's gotten me passed the initial issues I was having.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm glad you figured it out ! I would've responded with more information, but I was using my tiny cell phone, and I really don't like typing on it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)