Create account / Log in

Assign a Number to the players maybe from a dropdown

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Assign a Number to the players maybe from a dropdown

Postby kerkael » September 29th, 2019, 9:41 pm

Hi, here is my issue today :)

When the game is launched I have a MultiBoard map asking for the number of players in that game.
I want then the identified players to be assigned a number, from 1 to 5, in addition to their color.
How can I make this proposed from a dropdown list, or even from a random assignment?

What about the number of players in the game? Is there a predefined property for that or do I need to create it as a GP, or from the Map Question I asked?
I know $PlayerSide$ & $PlayerName$, but that's for the current player. How can I create a loop to assign a GP for each of them, based on the choice at start for the number of players?

Thanks all for your help
kerkael
 
Posts: 111
Joined: December 1st, 2017, 3:03 pm

Re: Assign a Number to the players maybe from a dropdown

Postby DrNostromo » September 30th, 2019, 4:25 pm

What I would do is create a Initialization button for each player. Once they've picked a player side and entered the game, they would click this button to set themselves up. You can include a trait to update a Global Property by one. This not only counts the number of players in the game as they initialize but you can also include a trait to set a Global property for that playerside to be given that number.
User avatar
DrNostromo
 
Posts: 1028
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Assign a Number to the players maybe from a dropdown

Postby DrNostromo » September 30th, 2019, 5:12 pm

Here's a sample for using initialization buttons to set up a player side. (change the .zip to .vmod)

You have three sides: red, blue & green

You'll see three buttons, one for each color. You'll only be able to click the button for your color unless you change sides.

When you click a button, it will increase a global property that tracks the number of players and it will also assign that player a number that will be reported in the chat window.
Attachments
InitSample.zip
(8.05 KiB) Downloaded 9 times
User avatar
DrNostromo
 
Posts: 1028
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Assign a Number to the players maybe from a dropdown

Postby kerkael » September 30th, 2019, 7:30 pm

Thx for the idea. As I'd like to make it as automatic as possible, I found a way for the Number of Players, but will investigate how I can do for the playerId. Maybe letting each player roll a dice to define who plays first .... which in fact could be your initialization button, by the way ...

For the number of players, I'm now using a Select Board option when we launch the game ... and a startup GKC which will trigger a Set Global Property trait from an At-Start piece present in the board.
It does this : Global Property Name : NP / Key Command : runatstart / set value directly : {If($CurrentBoard$=~"5 Players",5,If($CurrentBoard$=~"2 Players",2,If($CurrentBoard$=~"3 Players",3,If($CurrentBoard$=~"4 Players",4,1))))}
I will then be able to use this GP in my formulas.


...; I just realized I should name my boards 1,2,3,4 and 5 ! and just use the $CurrentBoard$ as the value for my GP :D
Last edited by kerkael on September 30th, 2019, 7:39 pm, edited 1 time in total.
kerkael
 
Posts: 111
Joined: December 1st, 2017, 3:03 pm

Re: Assign a Number to the players maybe from a dropdown

Postby kerkael » September 30th, 2019, 7:36 pm

My previous answer was before I saw your InitSample.zip answer. I just tested it. Ok, it's quite obvious : you join, you click your color, you get an Id.
Thanks; I will adapt that to my module.
kerkael
 
Posts: 111
Joined: December 1st, 2017, 3:03 pm

Re: Assign a Number to the players maybe from a dropdown

Postby kerkael » October 2nd, 2019, 8:26 pm

Great ! Thank you DrNostromo. The idea is very good, indeed. The sample module is fine.
I could adapt to what I exactly needed.
kerkael
 
Posts: 111
Joined: December 1st, 2017, 3:03 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 1 guest