I’m writing some code to load up game pieces and set some properties on them.
Below is my code. Placing the model on the map and communicating to the opponent works great (the placeAt command, c1).
But I cannot figure out how to send a keycommand to the piece since the Command c2 doesn’t do anything. It should be making a number appear since selecting the model and hitting “n” on the keyboard in game makes a number (actual an image of a number) appear.
Can anybody help?
Code
GameModule mod = GameModule.getGameModule();
GamePieceCreator gamePieceCreator = GamePieceCreator.getInstance();
GamePiece piece = gamePieceCreator.getBySlotName(“piece name”);
Command c1 = GetMainMap().placeAt(piece, new Point(300, 200));
Command c2 = piece.keyEvent(KeyStroke.getKeyStroke(“n”));
c1.append(c2);
c1.execute();