DM Client Module Restart[]
What it does[]
Restarts the module after all players leave when running the DMClient. Couldn't find a way to do it setting up the game (it's a checkbox on the dedicated server) so here.
Notes[]
Be sure to note that this WILL RESTART THE MODULE after the players leave, so if you're a DM and you're doing things, after the players leave it's going to restart on you. You shouldn't be doing anything after a player leaves anyway.
You're going to need to create an NPC (I call my Feaf) somewhere inaccessible by the players.
The Script's[]
Modules OnClientEnter[]
void main() { SignalEvent(GetObjectByTag("Feaf"), EventUserDefined(101)); }
ModulesOnClientLeave[]
void main() { SignalEvent(GetObjectByTag("Feaf"), EventUserDefined 201)); }
NPC's OnUserDefined[]
void main() { int iNumber; string sCount; int nUser = GetUserDefinedEventNumber(); switch(nUser) { case 101: SpeakString("Someone is Coming"); iNumber = GetLocalInt(OBJECT_SELF,sCount); iNumber = iNumber + 1; SpeakString("The Count is now"); //Debugging purposes only SpeakString(IntToString(iNumber)); //Debugging purposes only SetLocalInt(OBJECT_SELF,sCount,iNumber); return; break; case 201: SpeakString("Someone is Leaving"); iNumber = GetLocalInt(OBJECT_SELF,sCount); iNumber = iNumber - 1; SpeakString("The count is now"); //Debugging purposes only SpeakString(IntToString(iNumber)); //Debugging purposes only SetLocalInt(OBJECT_SELF,sCount,iNumber); if (GetLocalInt(OBJECT_SELF,sCount) == 1) { string sSelf = "HiddenAgenda"; //Replace with your module name here, this seems to be the FILENAME rather than the module name StartNewModule(sSelf); } return; break; } }
Foot Note[]
Shouldn't be any problems, tested it quite a few times, but email tenedos@brug.org if you have anything to say.