Happy to help! If it is not a big hassle to migrate your own game logic I would indeed recommend doing so. I try to mark any changes I make in updates clearly so that you can add any changes I make to your own project, but going the other way and adding your own additions to a version of ATBTT with the newest update might be better if you are good at keeping track of what you’ve done.
ATBTT is not on sale, but I might hope that the increased traffic to the marketplace might trickle down to items not on sale. We’ll see
Hello! I must say this is an amazing toolkit, and I can’t wait to get a full game developed using the template!
I’m seeking help to locate which blueprint I should edit to spawn an updated HUD with Unit Portraits and progress bars (i.e. Current Health, Energy, etc.) every time a unit is selected.
I’m trying to have the HUD refresh every time a pawn is selected, with their own health and energy ( I added an energy attribute to the unit parent class) and a portrait of that unit.
I’m having difficulty figuring out which blueprint would spawn this. I was able to spawn a new HUD in the PlayerController, but It would never update the health correctly (Per pawn selected).
The HUD needs to refresh for every unique pawn that is currently selected. (Thought maybe the unit parent blueprint should be edited, but it wouldn’t work correctly).
Hi , sorry for the long delay in answering. I did not get a notification. I’ll do my best to answer your question.
For modifying the HUD based on the current pawn, you would probably want to bind the values displayed in your HUD to values from the current pawn. Follow this tutorial, but get the values from the Current Pawn reference in ATBTT_GameMode. This should cause the HUD to update automatically based on the current unit.
No worries, I completely understand. Thank you for the help! That is exactly what I needed to know.
I’m looking forward to the new features in your next update. Thanks again for making this great toolkit!
Any Idea why the values stay at 0? They are referenced to the correct values in ATBTT_GameMode, Current Pawn. I’m spawning the HUD from the ATBTT_GameMode Event Begin Play script. For some reason I can’t get the correct values/colors to show up on the HUD. (No errors showed from running the game either).
I realized something got messed up, and just recreated the project and remade the HUD. Then it worked. Your example also helped me do it a better way too (since I’m still a bit new to blueprint scripting). Thanks for all the help! Let me know if there’s anything I can do in return.
Empty project, took the standard ranged pawn, and gave it a range of 2, and then just added a command to dump the range array to the player controller.
For some reason the range array for the first pawn is giving the index with the enemy pawn, which is 1 range away, a value of 2, however, the second pawn returns the correct value of 1.
I think you’re just counting from the wrong direction here, Selentic. When you dump the values of an array to the log using a forloop the values for the last indexes of the array will be displayed on top of the screen (since they are the last ones to be printed). This means that the bottom number displayed is the value of index 0, the second to lowest is the value of index 1 etc.
The enemy unit in your images is standing on index 2 if I understand correctly, which is the one two from the bottom when looking at the log (third one to be printed). Its value is 1 in both images, as is expected.
If you want to find the value of the index of an array corresponding to a tile index in the future I recommend using the Get Hit Tile Location and Index function in BP_GridManager. This will get the index and location of whatever tile you are hovering over with your mouse. Use the outputted index to get a value from any of the grid sized arrays (such as Range Array)
Would it be possible to use the tile feature of this on its own? I am trying to create a game similar to animal crossing where the world uses a grid for placement and pathfinding.
I have custom gravity where the playable area is a mini planet that can be walked across entirely, so I need hex cells. Is there a way to project this grid onto a large sphere?
Sorry if you’ve already covered this in previous posts, I’m a little frantic with research.
There is nothing in the toolkit that forces you to use all the features, so you are welcome to use it just for displaying the grid. That is if I understand you correctly, though. You are also implying that you might want to use the pathfinding, which is not recommended if you want a real time game like Animal Crossing. If you just want the toolkit to make a hexagonal grid, buying the toolkit is probably a bit overkill, though. I would just look at my tutorial where I explain the construction script of BP_GridManger. Here is the relevant bit: [Old] UE4 - Advanced Turn Based Tile Toolkit Tutorial - 5 - Blueprints - YouTube
If you want to project the grid to a large sphere there are a couple of ways you should go. You should first know that making a sphere out of hexagons is physically impossible, though you can use a few tricks to make something close enough. You would either do something like a truncated icosahedron (a sphere made of mostly hexagons and some pentagons), or you could fake it in some way, possibly by using a material (u/zeustiak did this with a material a while back. See his thread here).
Hey . Was this by chance something you fixed recently? I’ve run into this issue where the red visible tiles do not spawn in their correct locations when the grid size has been changed (in this case 1000, from 200). I’m unable to reproduce it in a fresh project, but I’m also pretty sure this functionality isn’t something I’ve touched.
…and then do this, it will break the ai’s pathfinding. They’ll just run to index 0 and execute their attack. Using invisible walls does not cause this.
You’re a great resource for finding bugs, Selentic Thanks for reporting the bugs you encounter. Your first issue is an issue I thought I had corrected, but it seems I only corrected it for displaying tiles for pathfinding and not for visibility. To fix this you should make the following changes to the Spawn Tiles In Range function:
The second thing you are pointing to (the branch that is always true) is just a temporary branch I forgot to delete after testing. The reason it does not work is that the AI uses it to determine what tiles it can move to for attacking player units. If we allow the AI to include tiles where LoS is blocked because of walls the AI may then attempt to move to these tiles when attacking. However, later down the event graph of ATBTT_AI_Controller Find Path to Tile in Range is set up to take walls blocking cover into account by default. This function will attempt to find the best tile for attacking the target, but may not find any (since all might have LoS blocked by walls), return false (0) and have the AI unit move to index 0. You could set Trace Visibility to false for the Find Path to Tile in Range in the AI controller and I think it should work as you expect it to, but I think it is better to instead set the collision of any walls you want to be able to attack through to not block RangeTrace.
I will put these bugs on the list of things to fix before the next update. Thanks again for letting me know.
Thanks for your quick reply . I have decided I will need to create a geodesic sphere. With your toolkit, is it possible then to use a custom mesh (such as a geodesic polyhedra) and use that to project a grid on to?
I assume you could create the polyhedra mesh and use that as a base for the grid and bring in each hexagon/pentagon cell one by one and manual index them, but is there a way to generate it all in one?
What you are asking is not exactly my area of expertise, but I’ll try to help you as best I can. If you want to use a polyhedric base mesh and create a sphere out of multiple arranged meshes, you could do it the same way I do it with a flat grid. I use some pretty basic math to calculate the position of each tile. Basically I multiply the X index of an array item by the X width of a tile to set its X location and multiply the Y index with the Y length of a tile to set its Y location (UE4 does not support 2D arrays so I fake this with a 1D array which makes it a bit more complicated). Hexagonal grid are a tiny bit more complicated, mostly because each row needs to be offset by half a tile width. You could do the same thing, the only thing being different is the formula you use for calculating the location and rotation of each tile in 3D space. The formula for this is more complicated, of course, but the concept is the same.
As noted earlier you would need to rewrite a few other things to get this working properly with the toolkit once you’ve got the meshes aligned properly. How to determine which tile index can be found at what location vector is one of these (you would have to do something similar to what you do when setting the location of each tile, just in reverse). Setting up which tiles share edges with other tiles (can be moved between) is something you would also need to do. To achieve this you would need to modify the Add Viewport Terrain to Arrays function in BP_GridManager. You would also need to change how visibility is calculated, as the current solution has some in-built assumptions about the structure of the grid. There are surely other things that also need to be changed (setting the rotation of units while moving comes to mind. This one should be simple, though), but these are the main obstacles I can think of.
Like I said, this is no small task, but it is achievable. I’ll be looking forward to seeing your progress. Feel free to post questions in this thread at any time.