[SUPPORT] Advanced Turn Based Tile Toolkit

ok, so you want to be able to move once, but to attack twice? See if this gets you the result you want. Set CurrentAP and MaxAP to 3. In BP_Ability_HoMM, set bUseEndsTurn to false and add the following:

1 Like

No full in you manuai is 1 can walk and can atack but if i attack from first point i can do a second attack.
but is need
1 my unit walk and atack

2 receive the counter attack

3 i can only attack the same unit or other cant move.

Sorry, I’m trying really hard to understand what you mean here, but I’m afraid I don’t.

The first two steps seem like the same as in my solution. Step 3 is where I struggle, though. Can you try to explain it in some different ways or in more detail? Perhaps it is a language issue? Could you try writing it in your native language and using Google translate?

How I am now interpreting what you are saying:

  1. You want the unit to be able to first move to an enemy.
  2. After the unit has moved you want it to be able to attack the enemy.
  3. After it attacks the enemy, you want the enemy to counterattack.

So far, so good, right? Now for the final step you say: “i can only attack the same unit or other cant move.”

Do you mean that after you have attacked another unit, and that unit has counterattacked, you want to be able to choose to attack again, but only to attack that specific unit?

As for “or other can’t move”. By “or” do you mean that if you attack the enemy a second time, the enemy is allowed to move, but if you don’t attack the enemy a second time, the enemy is not allowed to move on its turn?

You include a screenshot of HoMM 3, and I can’t remember any such mechanic there, so I’m pretty sure I’m misunderstanding what you are saying. Sorry that I’m not able to understand this better, but I’m trying my best. If this is a mechanic in HoMM, perhaps you can show a video of how it works?

i make the video exist range unit Mage wath can shoot if the near enemy stay. i not add this moment to video.

Hey I was trying to instal this to get ready for the upgrade to ue5, but everytime the project fails to instal saying that I’m missing files.

I was wondering if you knew about this, and also wondering how to fix it if you know?


Ok. thanks for the video. I think it helps me understand it a bit better. So you want many different things, and not just one. I think that is one of the reasons I was confused. So to summarize you need this:

  1. One unit that can move, attack and then can choose to attack again (but not move). You want this for one type of unit, but not all units. This is similar to the last code that I made for you.
  2. You want some ranged units that can counter attack with ranged attacks. This is again just for specific units.
  3. You want units that can choose to switch between melee and ranged attacks.
  4. You want some ranged unit that cannot use ranged attacks if they start their turn adjacent to an enemy (this is how it works in the HoMM map currently), but you also want some ranged units that can do ranged attacks even if they are next to an enemy.

Is that all of it? Did I get it right?

Hi, I haven’t heard of anyone else having this issue. Does this only happen with ATBTT?

Yes with number of return attack i thing i rezolve.
Did I get it right?

in old i version i starto make variable with this function. was one place before counter attack.

Hi Monokkel, I’m back with a picture: In the photos below, models A&B are in one squad and C&D are in another squad. The squads are determined before the level loads.

If I click either A or B, I want to select both A and B. If I click either C or D, I want to select both C and D. They move and act together (with some behavior written in an AI script). I still want to be able to select individual units to make changes to what the AI decided to do.

Does that make sense? If you tell me how, I’ll try to make the changes (but if you want to make the changes all power to you!).

Hi, sorry for the late reply. Been some busy days. Here is what I would do for each of these mechanics:

If you want some ranged units that can counter attack, but not others, you will need to make the counter attack code a tiny bit more complex. When you check the range between units before deciding if you allow a counter attack you would add another condition where you check if the unit can ranged counter attack. A quick way to do this would be to add a “allow ranged counter attacks” boolean to BP_Unit_HoMM and check this.

For switching between melee and ranged attacks you can use the ability system component so that you get an ability box and have sepearate abilities for melee and ranged for that unit.

Similar to the first question, if you want some ranged units to be able to do ranged attacks even if they are adjacent to enemies you will need to add another condition to the check in BP_Ability_HoMM in UpdateAttributes. Here you could also check a boolean on the unit which specifies if the unit can do ranged attacks even if adjacent to an enemy.

Hi, I’d need to know some more info on exactly how you would want this to play out. So you select two units. How should it be decided what tiles can be moved to?

What tiles would be highlighted? Those in range by any of the units, or only those reachable by both? When you click a tile to move to, both units can’t move onto the same tile, so how would it be decided which of the unit gets to move to the specified tile, and for the other unit, how does it select another tile to move to? I’m assuming an adjacent tile, but following which rule?

Please be as specific as possible, as the devil is in the details with this sort of thing.

1 Like

Hi! If you select a squad it would highlight all tiles within the range of any unit. If I had control over it I would probably change the alpha based the proportion of units within the squad could reach each tile i.e. Tiles that every unit can reach are brightly colored, then there’s a decay as fewer units can reach a tile.

I was reading more about Unreal last night and I think the PlayerController would be selecting a Pawn that represented the entire squad. Once commanded, the Pawn would defer to a script that took (1) the local occupancy grid and (2) a set of constraints (weighted rules) and try to find the best configuration for the squad. My work is behavioral AI so I can do these kinds of behaviors in a C++ script, but I’m not good at Game Dev (which is why I’m using your excellent package).

An examples rule set might be:

  1. Maintain squad cohesion ( min distance between units)
  2. Prefer hard cover, then soft cover
  3. Prefer line-of-sight to enemies
  4. Stronger melee units up front

After the AI gives its best guess, the player can switch modes to make adjustments if necessary, or they could choose to do everything manually (but squads have to be close together so not all moves are valid).

i crea

Ok, so this can of course be done any number of ways, but it is a pretty complex task. I do some of this stuff for the AI already. Namely prioritizing cover, line of sight, accuracy etc. You could modify the same code and have your player units utilize it.

Essentially when you choose a target location you would sample tiles in an area around the target and use these as a filter for the AI functions, only looking for and weighting tiles within that area. That should also make this quite a bit more performant than the default AI, which considers all possible tiles in move range. You can find this code in the AI section of BP_Ability.

Regarding displaying tiles in move range with varying colors depending on the units that can reach it, you could spawn overlapping translucent meshes or decals, which would add together to give darker colors for tiles that multiple units can reach. For more control you could check the keys of each pathfinding output and see how many are able to reach each tile before spawning the appropriate marker.

Though if you are a professional in behavioral AI I’m sure you can think up better implementations than mine. If blueprints are your big hindrance here I can provide you with C++ versions of the pathfinding and visibility functions if you’re interested.

What are you trying to achieve with this particular funtion and is it working like you want it to? If not, what behavior are you seeeing instead?

sory network problem.
i create a branch for range return atack from you mesage. and is need to ad something else?

Hey thanks a lot for the tips! If you have the C++ versions for path-finding and visibility I would love to have them. Thanks again for the response, I’ll see where I can get with this info.

Hello! When looking at the MP_Spawn example, an extra “puppet” gets spawned after I hit ready. It appears to be a visual bug. Do you know why this might be happening? I’m trying to make a level that spawns units at beginplay instead of having them pre-placed and I’m seeing similar behavior.

This is the Daniel that asked the question about having units with mutiple models in them.
My ideal would be for them to move mostly as one unit but be able to adjust formation a little independently. Such as having a member of the unit move one hex less to stay behind cover, Have them spread out to limit splash damage or huddle together to brace for close combat. They would get no more then a hex or two from the rest of unit.
You’d only target the whole unit, but each model would have their own hit points and the defender choices which model in the unit would take damage first. So the unit would get smaller the more damage they take.
Being able to split fire to shoot at multiple units would be nice, but not really targeting specific models.
Let me know if this would be doable and/or if more information would help.



Hmm, doesn’t look quite right. So this is the function for attacking in the HoMM map. In the first branch you only continue if the unit is able to do ranged attacks. I think this would end up so that only units with ranged attacks are allowed to attack at all. Is this what you are seeing?

No worries! I’ve sent you the C++ code over a PM. Note that it has been a while since I made it (for UE4.23, it seems).

Hi, thanks for letting me know. This is a known issue that I intend to address in the next hotfix. In the meantime, here is what to do:

Hi Daniel! So I’m afraid this might be a bit tricky to add. Having multiple, independent units that can split up and choose to find their own cover etc. goes against a one unit per tile assumtion built into the toolkit.

As mentioned in my answer on the store page, adding a Civilization style unit group that is really just a single unit in gameplay terms, but with multiple skeletal meshes (that also serve as a kind of health bar when they are killed off gradually) is relatively simple to do. Even adding some ability that lets that squad split into two ones isn’t terribly difficult to do.

But as soon as all of the units start acting independently and moving on their own it becomes a lot tougher. If this is a feature you need for your game I’m not sure if I can recommend using ATBTT for it. If it is truly central to what you have in mind you might be better off building your own system from scratch, I’m afraid.

I try to enable range return attack

1 check if is counter attack
2 then chek is able to return range attack
3 check the distance for return attack if the unit is in range
if i understand righ

The order still seems odd here. So this is a function that is shared between your ranged and melee units, right? So you want it to be so that melee units can still counter attack. However, with the function above melee units can never counter attack. With your first check you see if it is a counter attack, if true you check if the unit is able to do a ranged attack. If no you stop. So here only ranged units can counter attack.

Here is what I would suggest you do:

i make the cheange but is still something mising the range unit not maik kounter attack.