Simple Command Call
Call one API method to make one cannon action.
artillery.fireRentaka(ship.id);
command.log("Rentaka fired.");Melaka Defense
These snippets mirror what you can express in the Visual tab or in generated code. Drop patterns into your cannon functions or adapt them in the Code (generated) view after building blocks.
Call one API method to make one cannon action.
artillery.fireRentaka(ship.id);
command.log("Rentaka fired.");Repeat an action. Rentaka allows 3 bullets per cannon per tick.
for (let bullet = 0; bullet < 3; bullet++) {
artillery.fireRentaka(ship.id);
}Choose different weapons based on ship type or HP.
if (ship.type === "Colonizer Galleon") {
artillery.fireMeriam(ship.id);
} else {
artillery.fireRentaka(ship.id);
}A function can call itself, but always include a base case.
const countShips = (ships, index = 0) => {
if (index >= ships.length) return 0;
return 1 + countShips(ships, index + 1);
};