Hello
Sorry for delayed reply.
I don't have the time I used to have when I created the script but I have updated my script to do a null check
I also added srpgThroughTag compatability
Sorry for delayed reply.
I don't have the time I used to have when I created the script but I have updated my script to do a null check
I also added srpgThroughTag compatability
srpgThroughTag Explanation
Pathfinding works by creating a map (as an assocative array) which lists each tile as either passable or not.
A tile is flagged as impassable if its defined in the editor or an event is on it (with object tag / active unit)
The new fix adds a check to change a tile to be impassable only if terrainTag == 0 or if terrainTag of tile is greater the srpgThroughTag
A tile is flagged as impassable if its defined in the editor or an event is on it (with object tag / active unit)
The new fix adds a check to change a tile to be impassable only if terrainTag == 0 or if terrainTag of tile is greater the srpgThroughTag
On line 625, you inserted the null check, I think you should also add
else {
targettable = false;}
for the null check. Or the empty actor event will still be recognized as targettable.
Recently, I also find another issue. When the map's height is longer than its width, and you have your actors at the bottom of the map, the enemies won't reach there.
I think it's because of the code around line 147.
if (location.distanceFromLeft < 0 || location.distanceFromLeft >= gridSize || location.distanceFromTop < 0 || location.distanceFromTop >= gridSize) {
// location is not on the grid--return false
return 'Invalid';
The gridsize equals the grid.length, which is the width of the map. so if the height exceeds the width it will become invalid. I tried to define a new variable which equals the map's height but somehow it failed......
Another suggestion (which might be greedy) is to consider the terrain cost in your plugin. Currently, if the AI is around tiles with terrain cost above 1, they will not move. The terrain cost system will affect the flying units so I'm not using it now... but it can be a future improvement.