Artificial Intelligence Tools Extension (Beta Release 8)


  • Posts: 20
Thanks Robert, I updated the code in the .hx file but the game still crashes :(
I'll appreciate if you could take a look at the screenshots of my event code (I copied all screens that I think could be relevant):

I'm really puzzled by this error, because I execute your pathfinding AI code only if the "path_initiated" attribute is true (see "chasing the avatar p3" event), but the only setter of this boolean to "true" happens immediately after I define the start / finish rows and columns (see "chasing the avatar p2" event). So I'm wondering how the AI logic can run at all if the terminal nodes are not defined...


  • Posts: 20
Hey, it seems like I figured out the root cause! And maybe it's worth including into your documentation:
When I specified the start / finish tiles of the graph, I used the block "get column (x) coordinate of [x coordinate of actor]  in scene" and similar block for the row (which I suppose makes perfect sense). The problem is that the actual x / y coordinate of an actor is by default offset by half a tile relative to the centre of a tile. In practice it means that the "get column / row" function would often return a tile ID that was inaccessible (solid object). To fix this, I simply added half a tile to the coordinates of actors when executing the "get column / row" function (see screenshot). I only figured this out when I drew the column and row attributes over my actors and saw that the numbers were off...


  • *
  • Posts: 2319
Sounds like you found the culprit. The x,y position of an actor is always the upper left corner. But you don't need to manually add half of the tile width. The Y of self block has "Y (center) of self" in its dropdown menu options.

The documentation is a little out of date. Adding a footnote about centering sounds like a good idea.