Few questions, main goal is to set my spawns at each of the 4 corners of the produced grid no matter what width and height is give so I could then set up randomized paths from those spawn points to the ‘homebase’ at the center. I knew I would need help setting up the pathfinding in blueprints, but i had no idea setting up the spawns at te corners would be so difficult. it wasnt as simple as using the 0-1 phase to track what tile was being placed, and does multiple branch statements in blueprints drastically slow down compile times?
didnt look too deep at all of that but instead of all those branches you could use a select node.
create a function called IsCorner() which returns true/false plug it into the select node and then output the the class you want to spawn there.
to determine a corner you can use some math, on the grid macro you have the x/y so you know the corners will be at index (0,0 0,x 0,y x,y)
Right on, I’ll look into it this evening
So yea, I’m still struggling with implementing the math required to check if it’s a corner tile in my function. I might need help figuring out how to decide if it’s a corner tile using just the outputs of Unreals 2D grid execution macro and/or initial x and y inputs. I thought I was doing it the right way using OR nodes to check all 4 corner conditions but when I plug the function into the rest of the script, it places the spawner over every tile. I can post screenshots of bp soon
you can convert it to an index (x*y) and put your corners into an array/set .
then check if the corners array contains the current index.
your corners are
0
x-1
y*(x-1)
(x*y)-1
i forgot the -1 before since indexes are 0 based, unless the grid macro accounts for that but you get the idea
So the ‘current point’ output of unreals 2d grid macro execution cant be used somehow instead of converting x row and y row into a 1d index? like just checking if ‘current point = 0, = x-1, etc’?
thanks for the responses too
I’m sorry, your initial suggestion worked fine, i just didnt have my pins connected properly so it was spawning my actor for every tile. But now I’m back to the problem I started at, and thats to change my grid generator to only spawn tiles when theres no navigation/path from the corners of the grid to the center. I may need to open a new topic for that one
this page has some good stuff on pathfinding
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.