Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Skipping scripts


Why is it that when I program a hero in multiplayer using java he only performs the last action?


First off, it is JavaScript, not Java. Java is a completely different language, so you will get everyone confused (and be wrong).

As far as the actual question goes, the game is designed to only perform the last action. The debugger should give you a warning when it detects you are trying to perform multiple actions in the same turn, indicating it will only perform the last action. This is because the hero can only perform one action per cycle of your script. He can perform one action and say one thing each time. Some actions will override the thing he says as well. So whenever your script finishes, it checks what the last action and say were and performs those.

If you want your hero to perform the first action you decide for him to do, use a return; statement in your code after he performs the command. This will terminate the script early and run the command and say that you’ve queued up.