Support Forum

Ability to tag walls per unit

Hello,

I got “stuck” on a problem.
I have player units which can pass through all the closed doors (They open when getting near).
Problem is the enemies. If doors are closed they should look for a better route (if there is any open one), otherwise go on the route of locked doors (And i will stop them as soon as they get in contact with the doors.

Tagging those “doors” would be nice but the best i could do was add penalty for the two tiles around the door and the character goes “around” as expected. The problem is that i have blocked the other doors (i tagged it with “problem” on the picture) so the player goes all the way around to get to the position (even tho he should enter thru the door but i blocked it with my method)

Somehow making the doors have higher penalty instead of those 2 tiles would fix all the problems.

firstTile.Tag = 3; (labeled with 1 on the picture)
secondTile.Tag = 3 (labeled with 2 on the picture)

EDIT: this is a 2d project
EDIT2: i might have written a bit wrong, problem tile is not “blocked” but the one below it (labeled with 1) as i didn’t know how to tag it better and this just doesn’t work :frowning:

Might not be a deal breaker as i might still make them just go for shortest route thru the doors (And whack them on the way but if there is something for this might be cool :-))

image

Thank you!

Hi

If you want the enemies to behave like

  1. If there is a path without a locked door in the way, then follow that
  2. Otherwise, take the path which requires me to go through the fewest locked doors.

Then what you want is a really high penalty on the doors for the enemies.
You can do this by assigning a tag to the doors and then setting individual penalties on the Seeker component.

interesting, so there is a way to set penalty to the door area instead of the neighbour tiles. Seems like i haven’t checked documentation well enough so I went about it the wrong way.

Thank you for the hint will be on it :slight_smile:

Awesome support btw so far every time i asked you replied :slight_smile: And seems so for others for years too from what i read!

Hi

Tags can only be set on nodes, not connections between nodes (it looks like your doors is between two nodes). So I’m afraid that is not possible. It is possible to adjust the cost for a node connection, but that cost will be the same for all agents.
You can increase the resolution of your graph so that the door gets its own node, but that might have other side effects for your game.

Thank you for the kind words! :slight_smile:
If you enjoy using the package, a rating and/or review in the Asset Store is also a great way to show that :wink:

1 Like