Modding, Mission Design, and Coding > The Scripting Workshop

Getting number of players in game

(1/5) > >>

krevett62:
Hello, how can you get the number of human players currently in-game via lua script? Is this possible at all?
Thanks.

m!m:
As far as I can tell from the code it is not possible to get the currently active players in a multiplayer game.

krevett62:
Well that's what I was thinking anyway ^^
It would be nice to have a way to test if a ship is AI or player controlled and to know who is the host in a MP game for scripting purpose.
I know MP is not very attractive for many players out there so I can undestand why this was not implemented.

Thanks for the quick answer!!

m!m:
This feature would likely be part of the scripting communication channel feature you already requested on GitHub. I looked through the multiplayer data structures and it does have references to the game objects for every player so it should be possible to determine which objects are controlled by a player and which are controlled by the AI.

krevett62:
Well until then (if it gets in the code on day who knows) I have another question.

Is there a limit to the number of mission sexp variables?
I'm trying to get around in multiplayer by using sexp var instead of lua var but as every ship on a mission may have several variables attached I wonder if it could cause FSO to crash if too many of them are set in a particular mission?

Navigation

[0] Message Index

[#] Next page

Go to full version