Hi Stefano,
I am trying to figure out how to replace disconnected players with a bot, but I am having difficulty understanding what to do.
The wiki says:
""
Replacing Disconnected Players with Bots.
To replace a disconnected player with a bot refer to the Server API.
""
And the Server API shows a detailed example of the
channel.connectBot() function. But there is not much more description than that.
I tried to figure this out. However, I can't seem to get it to work for me.
In logic.js, I am listening for a player disconnect in the callback of a stager.extendStep() function:
node.on('in.say.PDISCONNECT', function(msg) {
console.log(msg);
channel.connectBot({
replaceID: msg.data.id
})
});
It is catching the disconnect, because I can see the msg in the console (well, only if no other players/bots have already finished the step), but then it is creating a client with a different id than the player that disconnected, connecting them to the waiting room, and then throwing an error: "stepID not found".
Could you perhaps explain the appropriate way to replace disconnected clients with bots? I am not understanding how to properly listen for a disconnection, much less how to properly create the bot.
Thank you.
Best,
Drew