Here is the code that creates a NPC:
Code: Select all
User npc = api.createNPC("npc-" + npcCount, zone, false);
Player player = playerBuilder.build();
npc.setVariable(UserHelper.createPlayerVariable(player));
npc.setVariable(UserHelper.createNicknameVariable(player));
npc.setVariable(UserHelper.createTrophiesVariable(player));
This fake player (NPC) will be added to the room.
The problem is when room extension tries to order players to make their moves. Each player will receive an Extension Response from room extension.
This line of code sends SwitchTurn command to all users. In client side, user will update their game and send their move if it's their turn:
Code: Select all
send("SwitchTurn", null, room.getUserList());
How can I check if "SwitchTurn" was sent to the NPC and respond back?