[SUPPORT] Advanced Turn Based Tile Toolkit

@ - Hi, I’m new to unreal and blueprint. When I bought the toolkit I was glad to be able to make a game in the genre that I love. Even my friends were interested and jealous. So far, I have been able to follow most of the things you taught in the tutorials.

Right now, I am trying to make 3 custom blue prints but can’t seem to grasp. I was wondering if you could help me. What i need is…

  1. A pickup or power up.
  2. When an AI dies they drop power up
  3. An AI that walks away from player unit in range.

So far, I have made a health pickup that seems to respond when I step on it. However, I don’t know how to get reference for current health or range, movement or damage so my pickup works as string only. Unfortunately, I don’t know how to begin with the other 2. Here is the blue print I have so far. Could I ask for pointers?

@deflip007:

There is quite a bit to explain for what you are trying to do and it all really depends on how you want to handle those power ups in the future.
If you would like to make a power up/heal/buff/debuff/etc the best thing to do is create the actor as you have done, but also attach that to a new Tile_Parent Child Blueprint so that you can reference it later for any AI logic. (Take a look at the page before this one for some more in depth explanation on how to reference those ‘Consumable’ type tiles.)

Apologies as I am not at home so I can not provide example screenshots, but hopefully this will help.

As far as this goes, the quickest and easiest way would be to create a new Custom Event on the Unit Parent called something like “Receive Heal” with a variable input for the Amount. Once you have done this, you will need to get ‘Current Health’, add the Amount, check that the new Current Health is not Greater than the Max Health, and set the new Current Health Value to either what has been added or the Max Health. Then inside the Power Up Actor, you will need to setup a reference to the GameMode so that you can get the ‘Current Pawn’. When the event ‘ActorBeginOverlap’ is executed, you can call ‘Game Mode’ -> ‘Current Unit’ -> ‘Receive Heal’ and include the Amount that the Power Up will provide for healing.

In the Unit Parent blueprint there is a ‘Destroy Unit’ handles the Death of the Unit. In this you will need to check if the Faction of the Unit is Equal to ‘Enemy’, if so, ‘Spawn Actor’ with the class dropdown selection of your power up blueprint. (Location will be the Current Pawn Index, which you will need to run through the Grid Managers ‘Index to Vector’ function)

This is quite complicated and will require a bit of math and other logic depending on how you want to handle this. When you use ‘Find Tiles In Range’ it creates an array called ‘Pawns In Range Array’. Checking that can give you the Index and Distance of any enemy that is within the range you set for ‘Find Tiles In Range’. The complexity here will be how to handle the actual movement of the AI. Will it be going away from the closest Player, but also away from all other player units that could be surrounding it? In which direction will the Unit go for each case will have to be handled independently. I would start with the ‘Pawns In Range Array’ and play around with what you find there.

Also, @ has created a lot of really great Blueprint Tutorials that I would highly suggest you watch!

Something along the lines of this :slight_smile:


@

Thanks so much for the help. Quick nube question. The Top pick is in the Unit parent and the bottom is in the actor blueprint? Also how to get the green ball nodes and custom event to have heal? I put an orange arrow in areas I don’t know how to get.

Hi deflif007, I replied to your question by e-mail yesterday and said I would reply in more detail on the forums when I had the time. I wrote a post earlier to day, but for some reason it doesn’t seem to have been posted. Thanks for stepping in again, ! Great solutions as always. I’ll write a new post where I take 's suggestions into account.

Making a receive heal event in Unit_Parent is probably the way I would have done it myself. This is pretty flexible since you can easily add things like healing powers from other units etc. now that you have a dedicated event. You might not need to run it through the game mode, though. Something simple like this does the trick:

Here’s a quick .gif of it in action.

For this to work, you need to make sure that you have collision enabled properly, though. I would enable collision of the skeletal mesh of all units, set their object type to WorldDynamic and enable generate overlap events. Then set both the WorldDynamic collision of the skeletal mesh and your powerup to overlap. The default units don’t have collision enabled for performance reasons, but the impact is minimal unless you have vast amounts of units.

For AI units dropping powerups you could again do something like suggested. You can again make it slightly simpler if you know that units will never be between tiles when they die (which never happens in the default toolkit), in which case you can simply spawn the powerup at the current location of the actor without running it through Index To Vector. It’s also generally advicable to get an index from the Vector Field Array instead of using the “Index to Vector” functions, as it is agnostic to the grid type.

As has mentioned and I mentioned in my e-mail, your third question is the trickiest bit by far. If you have a situation where you have complex terrain and multiple player to escape from you will need to know all possible paths for the next turn for all player units so that the AI can avoid them. This is not trivial to solve; especially if you want to avoid any drop in framerate. What I would probably do is to create a modified version of the Pathfinding function that initially adds the location of all player pawns within a reasonable distance of the AI to the open list. This way you would have a pathfinding that simultaneously spreads out from all candidate player units. You would run this for a fairly large move range (I think the movement range of the AI unit plus the movement cost between the AI and the closest player unit should be sufficient).

You would need this function to write to a different aray than CanMoveToArray so the two can be compared. The new array would function sort of like a threat map. You would then look at all locations that the AI can reach in one move from the CanMoveToArray and compare it to your new ThreatMap array. The AI should choose to move to the tile with the highest cost in the ThreatMap, as this would be the tile within the AI’s reach that takes the longest for all player units to reach. That’s the best solution I can think of currently. Like I said it’s a pretty tricky thing to do, and there might be much easier ways to fake it if you need a less generic solution for a few specific scenarios.

edit: The green ball is a float output. You can add it to the custom event in the details tab like so:

The second ball is a reroute node. You can place it by dragging out a float from an output and letting go anywhere in the graph editor. A dropdown appears where you can select “Add reroute node”. The third is a simple float / float node.

@deflip007: I would definitely do it as @ suggested. Mine was just a quick pass to help you along the way, mostly trying to help you understand the relationship between blueprints :slight_smile:

Little Awesome Trick: You can also add Reroute Nodes by double clicking any existing line :smiley:

@ & - Thank you guys for helping :).
I got it to work. The HP gauge kinda lags a bit but it does fill up.

Ok, great! What exactly do you mean by lag? Is the powerup destroyed and then it takes some time for the HP gauge to fill up or is it also destroyed later than you intend it to?

@ -

Hello, sorry for delayed response. By lag, I mean that the health bar does not increase until somewhere between the AI’s turn or the next player’s turn.

@ & -

Thanks for the advice on the previous questions. Right now, I am trying to get a teleporter to work but so far all I have to go on is tutorials for 3rd person games. Do you guys have any suggestions to get this to work? So far, I have been using trigger boxes and target points to accomplish this. Also, the square Tile_empties like to sit on top of the trigger boxes. Is there a way to fix this?

Hi again. Firstly for the lagging health bar problem I’m guessing you’re modifying Current Health properly, but are doing something wrong in the Set Scalar Parameter Value part, so that the actual visual representation of the health only catches up when Set Scalar Parameter Value is called at some later point. Does this part look exactly like the one in 's screenshot in your blueprint?

Is what you’re saying that empty tiles seem to be placed on top of the trigger boxes, meaning that actors moving to tiles with trigger boxes walk upwards to the top of the boxes? If so I’m guessing you’re using “From Tracing” heightmaps and that the traces that detect which parts of your map are walkable are colliding with your trigger boxes. This can be fixed by making sure collision on these tiles is set to ignore the PathTrace channel (you should also set ti to ignore RangeTrace or your trigger boxes will block line of sight)

Your solution for teleportation looks reasonable enough, but you need to update the position of the unit in the underlying grid arrays as well or the Grid Manager will still think the unit is still at its old position, which will lead to some weird results. I’ve created a modified version of my Spawn Unit blueprint for you that moves a unit on the grid. Note that this function should not be used while the unit is moving, but after it has finished its move. Here are screenshots of the function (I’m not able to upload it to BlueprintUE for some reason):

First Part:


Second Part:

My small 4.9 patch has now been uploaded by Epic. This is not a big feature update, but again a minor compatibility patch. Here are the changes:

v1.43 (21.09.15)

  1. Changed all Set Visibility nodes of markers to Set Marker Visibility Functions to prevent an error in the log.
  2. Removed Clear all Instances from the Clear range array, reachable pawns array and path meshes collapsed graph in the Find Tiles in Range function in BP_GridManager to prevent an error in the log.
  3. Changed all Get World Location/Rotation And Distance Along Spline nodes to the newer Get Location at Distance Along Spline (with coordinate space set to “world”) nodes.
  4. Removed unnecessary cast in HUD_Faction_Turn and changed the name of Tile Spawner 2 to Grid Manager Ref to make it consistent with other blueprints.
  5. Replaced the landscape in the landscape example level as it was having some collision issues.

None of these changes come with version markers, as they are all easy to find by following the pointers in the error log.

I picked up the pack a couple days ago and ran into what sounded like the same interaction issue mentioned in the 3rd post (keys and mouse wheel worked, but hovers and clicks did not), but the config files seemed ok. I have two machines that I work on, but only one of them had the issue. Long story short after a bunch of reinstalls and comparisons, everything is exactly the same on both machines. The machine with the issue however has two monitors of differing resolutions, with the Primary monitor on the right (where I use UE4). When I disable the Secondary (left) monitor, the UI finally behaved normally. I’m guessing it has something to do with how mouse coordinates are determined for the pointer, but I don’t know if it’d be an engine bug or something you can fix in the BP. Either way it’s working for now with a non-ideal workaround, but thought you might want to take a look if you can. Running 1.43 in a fresh 4.9.1 project.

Hi m2tt, I’m sorry you’re experiencing these problems. I use a computer with two monitors, though with identical resolutions, and I have not experienced this problem. I have not had anything like this reported by any other users and I hope it’s not a common issue. I’ll try to narrow down what this could be about and see if it’s caused by my blueprints or Unreal Engine more generally.

First I would open ATBTT_PlayerController and print a string right after the InputAction Click event in the event graph. If a string is printed when you click we can be sure input is working. In that case it seems likely that something is wrong when a trace is fired from the cursor so it does not hit what is exactly below the cursor. When you say that hovering does not work, do you mean that there is no hover marker displayed? To test if the grid is hit at all I would add a new Print String node after the Get Hit Tile Location And Index function, a bit further down the chain that starts with InputAction Click. Here print the outputted location and see what vectors you are getting. Something like this:

Try using a very large grid (100*100 or so) to increase the chances of getting a hit if the trace is going wild. If you are getting result, compare the results you are getting with what you get when you click the same tiles with your workaround solution. Try to see if it is missing systematically. If you are getting 0,0,0 results every time something else might be wrong. Whatever you find it should hopefully bring us closer to finding out what the problem is. By the way, are you also getting the same problem if you package the project, or just when you play in editor? Do different ways of launching from the editor yield different results (Play in Standalone window etc.)?

Thanks for the ideas, and yeah by hovering not working I mean that the marker/splines are not displayed. I ran through the BP tweaks and the string is indeed printing 0,0,0 after the Get Hit Tile Location And Index node. It doesn’t seem to matter how it’s played, either editor window, standalone, or packaged the result is the same. I also tried packaging the game on the working machine, but when copied to the broken machine the packaged version exhibits the same broken behavior.

I haven’t done much with input BPs yet, but I’ll play around tonight and see if I can’t narrow down where the game thinks the cursor is.

Ok, try this. I have created an extremely simple project without the toolkit. Just A box BSP, a default Player Controller set to show the mouse cursor and a super simple level blueprint that just finds what is clicked under the mouse and returns the location as a string. If this doesn’t work with your dual screen setup there is something wrong with UE4, not my toolkit specifically. If it works we can try to narrow it down some more. You can download the project here.

Confirmed, I was able to recreate the issue in a completely blank project, so it’s definitely not the toolkit, thanks for your assistance, though! It also seems to only crop up after I’ve RDP’d into the machine so I’ll narrow down the steps and submit a bug to Epic.

No problem! I hope you’ll be able to solve your problem soon with the help of Epic or the community.

Hi , love the toolkit! It’s saved me a lot of time. I was wondering how difficult it might be to integrate a visibility/fog of war set up with the toolkit. The specific instance I had in mind is in, for instance, a spy game where you’d want to sneak past guards who have defined vision cones that the player can identify and avoid. I’m thinking of something along the lines of Invisible Inc’s system, if you played or saw that game. A different though somewhat related question is how to employ certain mechanics that would allow the player to hide more effectively, I.E. in or next to a potted plant for instance. I know this is probably a lot to ask, and it seems like you have some of these features planned for the toolkit in future updates but I thought I’d ask to try and get a grasp of how this might work. If nothing else, thanks again for providing this toolkit. You probably should have charged more for it but I’m happy to see it on the market place for gamers like me who pine away for the days of turn based strategy games. You’re awesome, and I look forward to seeing what you do in the future! :slight_smile:

Hello MicahM, I’m happy to hear the toolkit has saved you a lot of time :slight_smile: I’m a big fan of Invisible Inc. and have played it a lot. I’ve thought a bit about various ways in which I could replicate some of its features.

Some parts of vision cones are pretty easy to do. You could simply attach a cone shaped collision mesh to the AI units and when a player character overlaps this collision volume you could do a line trace using RangeTrace from the AI to the player character to see if there is anything blocking line of sight. If there isn’t you would put the AI in combat mode. Displaying the cone is a bit more tricky, as simply making the cone visible would have it clip through terrain. I think your best bet would be to use some sort of spotlight emanating from the AI’s eyes corresponding to the size of the conical collision volume.

Regarding fog of war there is a user on the forums that has a cool tutorial for creating such an effect, though it’s in C++. I have also toyed with the idea of not spawning any visible tiles when the game starts, but spawning them on the indexes the player unit can see every turn using the Find Tiles In Range function. I haven’t figured out the exact implementation of this, but I think it could work pretty well, though it might not be exactly what you’re looking for. You might also want to ask around in the rendering subforum, as they will be a lot better on the visual side of things than I am.

Here is a short, silly video I made in response to a comment on one of my tutorial vids, which asked whether it was possible to use a hexagonal grid as the terrain for a real time third person game. I threw this together in literally five minutes, but I thought it was fun to see the grid from a different perspective. The mannequin looks happy to be freed from the grid, at least :slight_smile: