Hi everyone!

I'm having difficulties with the Grid Move node in Battle AI. I try to make my NPC combatant move toward the nearest cell of a specific Grid Cell Type and it never works. I checked the Can Use Check Only box in the parameters and the node always exits to Not Useable even though I checked that there is only one cell of the specified cell type in the entire battle grid. If I use the same node but with "Move towards" setting instead, I can specify a target and my NPC moves towards it, so I know the system works, except when I use the Grid Cell Type option. Finally, I also tried to use the Check Grid Cell Type node to check if the user NPC is actually on a specific grid cell type (I select "self" as the target) and, even though it is (I can check in the inspector by clicking on the cell), it always exits from the "failed" output.

What could be wrong?

Btw, I use ORK version 2.34.0 for Unity 2020.3.2f1.

Thanks!
  • I've just realized that, if I set the grid cell type in the editor in the inspector, as opposed to runtime with C#, then the Grid Move node works perfectly and my combatants are able to detect the grid cell type and move towards it.

    So the problem only happens because I have to change the cell type dynamically, in the middle of the battle.

    Is there a command in C# I could use to actually refresh the grid so that the AI can identify the new cell type change?
  • Well, yeah, grid cell types can't be changed in a running game.

    I haven't tested it, but try to do the following:
    cell.cellTypeID = cellTypeID;
    cell.ClearSettings();
    cell.ShowPrefab();

    cell is the BattleGridCellComponent of the cell, cellTypeID the ID/index of the grid cell type.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • That's working perfectly! Thanks!
Sign In or Register to comment.