I completely forgot about this.
The problem is this:
Code: Select all
function void queueMessageAll(str title, str message, str icon, str sound, int duration) {
for(int playerNum = 0; playerNum < MAX_PLAYERS; playerNum++)
queueMessage(playerNum, title, message, icon, sound, duration);
}
When a message is queued, it's queued for all players. MAX_PLAYERS is defined as 64.
Long story short, queueMessageAll calls queueMessage 64 times. queueMessage then calls ProcessMessageQueue (so, it too will be run 64 times). ProcessMessageQueue sets the player for which it is called as the activator and then calls showMessage:
Code: Select all
script "ProcessMessageQueue" (int playerNum) {
SetActivator(0, PlayerSelector[playerNum]);
// Process entire "queue" -- show all messages until the
// end of the queue is reached.
for(int i = 0; i < QueueLength[playerNum]; i++) {
showMessage( MessageQueue[playerNum][i][0]
, MessageQueue[playerNum][i][1]
, MessageQueue[playerNum][i][2]
, MessageQueue[playerNum][i][3]
, MessageQueue[playerNum][i][4]);
delay(((MessageQueue[playerNum][i][4] + 1.0) * 35) >> 16); // Wait for (duration + 1) seconds.
}
// Reset queue counter -- this will effectively "clear" the queue.
QueueLength[playerNum] = 0;
}
And there we arrive at the problem: showMessage will show the message on all 64 player screens since it's called for them all, and each of them will run the invisible HUD message that's logged to the console.
So here we need two fixes: the first is that showMessage needs a way to check if its activator is the local player or not, and if not, it needs not to log the message. The second is that queueMessageAll needs a way to only queue players that are actually existing in the game session, no need to queue players 2 to 64 if the game is in single-player mode.