Page 1 of 1

onEnteringState() vs setAllPlayersMultiactive() in action

Posted: 17 August 2020, 08:38
by HumanBot
So I called setAllPlayersMultiactive() in the action function of a multipleactiveplayer state and I noticed that at the very beginning of onEnteringState, if I called isCurrentPlayerActive(), it would return false. This leads me to believe that onEnteringState() and the action function for the state happens at the same time (or onEnteringState() happens first). I haven't seen anything about this in the docs so far. Does someone know which it is?

Re: onEnteringState() vs setAllPlayersMultiactive() in action

Posted: 24 August 2020, 20:34
by CuriousTerran
I also just found some oddities with multiplayer states and whether players are active in the onEnteringState() function.
If I use setAllPlayersMultiactive() in an action function, then I DO see all players as active inside onEnteringState().
This behavior seems opposite to what you are reporting.
However, if I use setPlayersMultiactive($player_ids, 'state_name'), where I list a subset of players to be active during a multipleactiveplayer state, then NO players are active inside onEnteringState() ? I've used this.getActivePlayers() on the client side to ascertain the behavior of which players are active during onEnteringState.
Thus, it appears that one cannot reliably determine whether a player is active or not during the onEnteringState() function.

Re: onEnteringState() vs setAllPlayersMultiactive() in action

Posted: 25 August 2020, 04:25
by Marcuda
Correct, the active status in onEnteringState is not reliable during multi active states. You need to handle it in onUpdateActionButtons instead, which is only called for active players.

See the very end of http://en.doc.boardgamearena.com/Your_g ... ive_states

Re: onEnteringState() vs setAllPlayersMultiactive() in action

Posted: 26 September 2020, 14:43
by Volker78
This really should be documented in the clientside isCurrentPlayerActive Documentation

Re: onEnteringState() vs setAllPlayersMultiactive() in action

Posted: 26 September 2020, 14:46
by RicardoRix
This same problem seems to come up in the forum once every few months or so.