There are ways to query the number of players on a server and/or the number of players in a given party but I don't know them offhand. When you need to find a specific scripting function go to the
NWN Lexicon.
The trick to writing multiplayer mods is setting variables properly. By default the wizards bundled into the toolset (this includes the plot wizard and the script wizard bundled into the conversation editor) set variables on the PC triggering the script. This won't work for a multi-player module so you won't be able to use them.
In order to make a working multiplayer module you need to use SetPLocalInt to set varaibles on the PC
party, and GetPLocalInt to retrieve it. Now, this works with integer variables only. I don't know if there are similar functions for floats and strings, but I don't think so. Again, check the Lexicon to be sure.
Optionally you can use SetLocalFloatOnAll, SetLocalIntOnAll, and SetLocalStringOnAll. Instead of setting the variables on the party it can set the variable on everyone in the party. It's a subtle difference, but an important one. This works particularly well in PW settings, allowing party members to leave the party before the quest is done and not lose their progress, but complicating matters when new players to join parties mid quest. Stay away from this at the start though. PW scripting is complicated and if you use SetLocalVariableOnAll without also using SetPLocalInt or adding some important checks on existing party variables newbies joining quests can inadvertantly reset the entire party to zero.
OK... this isn't nearly as complicated or difficult as I'm making it sound.
Used in combination these functions give you awesome power, but properly exploiting them can be a royal PITA. Try to stick with Set/GetPLocalInt.
Just FYI... the LS TK Script Generator supports multi-player modules.
Modifié par Urk, 03 mars 2012 - 07:43 .