Hi everyone,
I have a grid spawner(Actor blueprint) class that spawn a gird of planes, and I would be able to get the location of each plane when I hoover my mouse over them.
However, I do not know how to pass that vector date into the Pawn class, so that the Pawn class could use it as the destination of it’s movement.
Also, What is the best way to handle grid based movement? basically I want to achieve kind like FF tactics/ heroes of might and magic style movement system.
Please reply with anything you think can point me to the right direction, although I do not have a coding background, I am eager to learn and I see blueprint as the first step of my long long UE4 journey.
So to update that variable in your pawn, you can go about it several different ways. I am assuming your pawns will spawn into the game after the map. So inside your pawns you can create variables and set those to be “Exposed on Spawn” in their details panel. Then, when you use the spawn actor node, it will have those variables exposed as inputs. Then when you spawn them using Spawn Actor from Class node, you can pass the grid data and anything else to them.
If you need to do this after they are spawned(which you will probably have to do at some point either way), then Cast, Interfaces, and direct blueprint communication are the 3 mains ways to do that. The unreal documentation covers all 3 methods in detail.
As for the actual movement of them, I think updating their vectors based on a timeline might be the way to go but I haven’t worked that part out myself so there are probably a few other ways to do that as well.
I have basically created my pawn (the red small square) you can move with mouse,gamepad or keyboard, my problem is this how do I do interact with each square of the grid?
I tried a variant with the trigger box but it is too intricate and inaccurate.
It depends what you want to do but basically, in square blueprint : On over event : visual effect and store a bool info “this square” and on click event : cast to character custom event “move there” and do in bp custom event “move there” with square location as input. (bool will be usefull when you’ll have more choices. (don’t forget to set this bool to false on click)