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

Level: Enemy Artillery


The idea behind this level would be to teach people about using while loops. The goal is to kill Garek, but the artillery fires and kills Tharin before he can finish him off. The idea would be that while artillery shells are in the air Tharin would seek cover in “the magical tree” (workin on comin up with a better explanation.) then he would come out get a couple of hits on Garek, repeat process until Garek is dead. I am still very much struggling with the level editor and would love any helpful tips or ideas on how to make this work.

I only have the Thangs in it and some of the script. Please advise.


I’ll give this a more thorough strategizing later, but the first things I would do:

  1. Make Dreek (Garek) stay in one place. Getting rid of the ChasesAndAttacks, Shoots, and Moves Components would get you most of the way there. I might try a Brawler or something here, since Fangriders normally throw spears. (This one isn’t throwing because it doesn’t have a missileThangID set in its Shoots Component.)
  2. Add config to specify missileThangIDs for the Shells you want to fire to each Artillery’s Shoots Component. (This is pretty janky, I know.)
  3. The most natural way to make the tree protect Tharin is to have the Artillery just always shooting at fixed targets, with Artillery Attacks damage and Shell Shell blastRadius and flightTime such that the shells are very slow but very deadly in that range (but so that it doesn’t quite hit Dreek). You can do this by making them Programmable but with the Programmable config {isProgrammableDisabled: true} and writing this.attackXY(x, y) as the only line in their chooseAction() Programmable method. If Tharin runs back to the tree, then he’ll be just out of the blast radius. He could run to other places, but the tree makes sense. (You could also have like a little alcove or something as the only possible safe spot.) I feel like I’m not explaining it well but have to sleep soon, so maybe find me in the chat sometime tomorrow to clarify more quickly.
  4. Don’t actually place Captain Anya in the map–she’s just there always but not part of the actual game world. Later you’ll be able to configure her with the editor, but for now, just interact with her with the scripts.
  5. Have your “killThangs” goal either point to “Dreek” or just to the “ogres” team (to kill all the ogres). Once your initial conditions don’t start off with a win, you’ll see those first scripts start to fire.

Hope this helps get a little further. By the way, if you have any ideas for improvement to the editor documentation (that “Crude Level Editor Doc” Google doc), we’d be happy to see comments in there on what parts are confusing or could be fleshed out.


It won’t load :astonished:


It needs to be published before non-admins can see it, currently. We’re thinking of removing that restriction so that anyone with the link can play it before publishing. Good solution?

Last night we went over the level some more and it’s almost ready, but I need to fix some bug before it’ll start working properly.


That would be a great solution. Im excited to get the level working once the bug is worked out!


@mcdavid1991 I figured out how to get this level working. The main thing was to set the team on all the Shells to "ogres". (Tharin wasn’t seeing anything from this.getEnemyMissiles() because they were friendly missiles being fired from enemy artillery. A little weird–sorry! Will make this less crazy in the future.)

I also needed to bump Tharin’s health up a little bit, otherwise he just barely lost to the ogre with the ogre’s longer attack range in the mix.

I also added say to his programmableProperties since it can come in handy for debugging.

Spoiler: here’s the code that worked (with bad formatting). You may want to give some of this as a skeleton for the level.

this.say(“I see " + this.getEnemyMissiles().length + " missiles.”);
if (this.getEnemyMissiles().length) this.moveXY(8, 18);
else this.attackNearbyEnemy();

It’s a great level! I didn’t save any of these changes, since I figured you’d want to play with it. A little more scripting and guide/victory hookups and it’ll be good to go on /play.


I think my player window has a problem, Tharin will not respond to any code I give him…


Oh, I think you need to delete the programming.Plans Component before it’ll work. Sorry, I forgot to say that part.


The screenshot leads to an idea where you can build a level with the concept of just ‘run’ from the ogre while the artillery kills the ogre. Since we’re talking loops here, two tutorial-level wouldn’t be a bad idea.