Issue with being at border nodes


#1

Hey Leslie it’s been awhile! I have a new problem I am hoping you can give some guidance with.

Basically I set up this cool tackle ability where the players character pushes the enemy to the next node behind him. I used NodesAround to be able to tell which side of the enemy that the players node is at and it alsmost works great. So to the right would be index of 0, above is 1, left is 2, down is 3 in the nodesList.
The player character pushes the enemy upwards to the next node from the enemies node position. It works in all 4 directions as long as I am not at the edge of the map or in the corners.

Basically my issue is that when I am at border nodes or at nodes in the very corner of the map it doesn’t know how to add nodes since its at the edge. So say I am at the very left of the map the nodesList instead of having the 4 nodes it will be like, right node = 0, top node = 1 and now the bottom node = 2 in the nodesList so the list only goes up to 3. For my ability to work I have to be able to have 4 nodes one on each side otherwise it messes with my code for telling which side is correct.

Do you have any idea how I can overcome this? I am trying to see if there’s a way to add nodes even if they aren’t on the map but I am not sure how to approach it. Thanks again, btw I love mapnav2 very much, hope you are well!


#3

I figured out a more simple way! From the starting position of the player I do the MoveUnit method twice in my code in which ever direction I move my selection cursor while restricting to the movement of the selection cursor to only be able to move one node away from the player to simulate a close range attack So with the node of the targeted enemy and the node behind him from doing MoveUnit twice I just had to do some movement code to move the characters to their new positions. Works great so far, no bugs yet !!!:smiley: :+1:


(Leslie Young) #4

Does NodesAround not work as expected if you pass true for includeInvalid? It is supposed to return the 4 node list but with the invalid ones being null entries.

You could also manually check each neighboring node with the NodeAt method by passing in base_node_position + (0, +1), etc for each of the neighbouring positions { +1, 0 }, { 0, +1 }, { -1, 0 }, { 0, -1 }.