[SUPPORT] Advanced Turn Based Tile Toolkit


Heh, to think I was about to pop in and edit my post again. Thanks for the tips on the camera and stuff. I’ve spent the past 6 hours watching the tutorials you put up (up to about the Timeline Manager tutorial) in anticipation of your response.

The thing is that I’m trying to get something mildly playable ready by this Friday. I feel as if that’s within the realm of possibility with what I currently have and what I feel can be done from watching your blueprints; I’m just trying to see how many features I can cram into my demo before then.

From skimming titles and comments from your videos, however, I’m not entirely sure if I’ll be able to implement every thing I’m thinking of adding on my own with your tutorials, so if you don’t mind answering, I have a few more questions for you.


  1. I’d like to elaborate on the third question (the only un-self-answered) question I previously asked: MP Bars is what I was trying to make. I designed an MP Bar to appear right underneath the HP bar, as shown in image 1 of the album posted below. I followed similar steps that you posted earlier to someone else asking about an “AP” bar by doing the following:

-I copied the Health Bar Material and turned it blue.
-In BP_Unit->Config->Attributes, I added new variables MaxMana and CurrentMana to mirror how Health was tracked by the Health Bar.
-In BP_Unit->Version, I duplicated HealthBarMaterial and renamed the dupe “ManaBarMaterial” since HealthBarMaterial was referenced by the Setup and Modify functions for the Health Bar.
-In BP_Unit_Anim, I duplicated SetupHealthBar and ModifyHealthBar and changed (what I think is) “Health-related” variables to my new “Mana-related” variables.

However, upon construction, any and all MP bars for every unit appear as such in the first image regardless of value. There’s clearly something wrong with what I did, so might you know what I could have forgotten or made mistakes on that I should fix to make this bar functional?

Album for 1) is here: https://imgur.com/a/tOQSh8u


  1. I’ll preface this second question of mine by saying I haven’t had the time to view your Turn Manager video yet (It’s pretty late right now where I am as I type this and I won’t have time to see it until at the earliest tomorrow night) so if you think that I’d be able to figure out how to do what I’m asking of you here by watching the Turn Manager video and figuring out how it works, it’d be perfectly fine for you to tell me to just watch the video.

Anyways, Fire Emblem’s turn system is a little bit different from your Toolkit’s default way of handling turns.

-Fire Emblem’s turns begin with the cursor either on the tile that was last referenced by the game or the cursor jumps back to the main character depending on the player’s game settings. Units by default are “un-selected” and must be pressed to open up their movement options. If the player puts in a movement instruction and decides it is unsatisfactory, they can press a back button to cancel the move instruction and return the unit to its original location. Once units are done acting, they are greyed out to indicate they’re “exhausted”.

-The Advanced Turn Based Tile Toolkit’s turns begin with the cursor automatically “selected” upon the unit with the highest initiative value for movement options. There is no way to “de-select” a unit other than selecting another non-exhausted unit, which selects that unit for movement options instead. If the player puts in a movement instruction and decides it is unsatisfactory, no option exists to cancel the move instruction and return the unit to its original location. Once units are done acting, they show an exhausted icon to indicate they’re “exhausted”.

Do you have any tips or tutorials you can give me for matching Fire Emblem’s turn setup exactly?


  1. When I was fiddling around initially with creating a title screen for the game, I remember going into World Settings and completely messing all sorts of things up. Although I’m a lot more informed now, I’d still like to ask for absolute clarity the following:

In World Settings, to change the Game Mode of the level in order to remove warnings from BP_GridManager/etc., do I change the value under “GameMode Override” to a different Game Mode? If so, what should I change it to? Should I create a brand new Game Mode for Title Screens or is there a Game Mode already within the toolkit that I can use for this purpose?

That’s all for now. Thanks a lot again for the help, . I really appreciate what you’ve done with this toolkit.

I’ll try my best to answer.

Hmm, from what I can see your setup seems reasonable. Where are you calling these new functions?

The turn manager stuff is probably what I’m the least happy with in the current version of the toolkit, and is ripe for a refactoring. It can be modified to get almost any form of turn order, but it is sometimes cumbersome to work with, so I understand if you’re struggling.

There are a few different questions here. To select no units at the start of the player turn and when a unit ends its turn, make the following small modifications to the turn manager:


For deactivating the current active unit, a function like this should do most of what you want:


For greying out your units, you can apply your effect to the EndActorTurn event of your unit and remove it as part of RefreshActor.

The rewinding turn stuff is a bit more tricky. The ways I can immediately think of are a bit convoluted. You could for instance store the previous GridIndex, Health etc of each unit on the individual units and use this info to reset if needed. A more complete solution could be to keep a save file that stores all relevant information for all units and for each turn (or unit action within that turn). Could get tricky to work with, though. I’ll let you know if I think up a more elegant solution.

If you don’t need any special game mode functionality for your level (and you probably don’t for a menu), just set it to the default Epic game mode called GameMode.

Thanks and no worries! Hope my answers were useful.

Found out that I didn’t run the Setup function and found out that it was referenced in the construction script, where I remedied that situation by constructing it after the Health Bar was constructed. It seemed to measure the correct Mana amounts afterward just fine.

As for the “turn off auto select unit”, your fixes worked great.

https://i.imgur.com/BETT9B2.png

I made that and hooked it up to a key press (K) to see if it worked. It didn’t appear to do so, though, so I’m not sure what went wrong. Does it have to be “DeactivateActiveActor” as the custom event? Because it’s just a named Custom Event. I’m not sure if that’s actually connected to something or not.

Yeah, I’m not entirely sure if I’m ready to take on something complicated like that yet. It’s definitely looking like I’ll have to figure out how to implement such a thing muuuch later. If you do come up with a more elegant solution, do share, though. I’d love to know.

Okay, thanks.


Right now I’m focusing on setting up weapons and inventory, reconfiguring the attack function, adding additional stats to units for battle processing (defense, speed for double attacks, skill for accuracy and critical hits), and the like. Inventory management development’s sending me up a tree lol.

I guess I just have a few more questions at the moment if you don’t mind answering more inquiries.

  1. Which blueprints do I interrupt at which time in order to accomplish these tasks?:
    -Adding a “footsteps” sound effect to the movement of all units (Starts when movement begins, stops when movement stops)
    -Whenever the cursor hovers over a tile, play a sound. (Should make a lot of noise if you run your mouse over many tiles at once)
    -Detect when the cursor is hovering over a unit to show a mini widget and after a key is pressed while hovering over the tile with a unit on it, open up a widget that displays their stats

  2. How would I go about modifying the “Mind Control” action to make a “Talk” option that can recruit enemy units for your team more permanently? I’m planning on having this action open up a dialogue widget or something to show two characters conversing and then it ending with one character joining the player’s side permanently.

https://i.imgur.com/2ICjSKZ.png

  1. Can you change the appearance of specific tiles on BP_GridManager or is the only way to change the tile meshes of specific grid tiles through changing all of them (as in the image I posted above this question)? I tried placing tile blueprints over the individual locations over the GridManager but that just covered up the markers on the grid. What I’m trying to accomplish is making a completely flat sprite-based grid.

https://i.imgur.com/jam85fb.png

  1. On the topic of sprites, I’m trying to animate a sprite’s hurt animation as shown in your Custom Unit (3/3) YouTube tutorial (My attempt as shown above), but instead of a StaticMesh basic cube I’m using a flipbook of a sprite animation I made. In order to produce the effect I was going for, I was thinking of making the sprite animate so that it drifted away from the enemy that just hit them on the map, so I used the following blueprints like this with the timeline set up like this. However, this doesn’t actually do anything to the sprite (I mean, I’m guessing that in order for a unit to get knocked back from the enemy I would have to figure out how to get the enemy unit’s position which I definitely didn’t do, but the sprite didn’t even change its color according to the timeline.

Sorry if I’ve come off as overbearing with all these questions.


https://i.imgur.com/AAmDT7Y.png
*
*EDIT: *Okay, really strange interaction with the “Game Over” detection here. When I sever this connection and adjust it as you’ve done so, if an action with a unit kills the final enemy unit on the map, the game refuses to end until I select another unit. I don’t know for sure why, but if I were to guess, it’s because the game checks for “is the game over” at the start of the following action.

This can be an issue since there’s no way to manually start the next action if the final unit on the player’s team defeats the last enemy unit. For the time being (and likely looks like it’ll be like this when I release my demo in a couple of days for some fellow students to see), it looks like I’ll be keeping this connection the way it was. How could someone change the functions so that the “win game” condition is checked on the end of the same turn? (Or a more elegant way of ending the game without having to select another unit that can act?)

Good to hear!

https://i.imgur.com/BETT9B2.png

Are you running your input event from an actor that actually receives keyboard input? Try calling it from a keyboard event in the player controller, perhaps?

Probably a good call. I’ll let you know if I think of something simpler.

Check out anim notify events. Google that and footsteps + unreal engine and you should find some tutorials.

In the hover event (event server hover,) of whatever ability is active you can check the GridUnits TMap in BP_GridManager at the hovered grid index.

Switching factions just means setting the faction variable and AlliedFactions variable to appropriate values.

The default visible grid is mostly there for debugging and is not that easy to modify. I recommend setting ShowDefaultTile to false and visualizing the grid in whatever way you choose. Check out the 2D example map (2D/Hydra’s Lair) for an example on how to use a sprite based grid.

Again, check out the 2D example map. The units there do something similar when they attack.

You’re right in your interpretation of what is happening here. You should be able to also check for game over in the EndActiveActorTurn event. Just be sure that InitializeQueuedActions in BP_TurnManager is called after the game ends, or the associated actions will not animate.

Hey , congrats on being a Doctor now (a bit late to the cheers, I know).

So you know I’ve been eyeing your Ability System videos and putting timemarks, and now I was trying to get my hands dirty in abilities to see for myself some points. I was trying to re-create the counterattack ability you made in this post by duplicating the MoveAttack ability and adding that additional branch you talk about in ExecuteAbility(). It seems to work fine for AI units, but apparently if the unit is player-controlled, the Branch never comes out as True, and thus skips the counterattack.

Using breakpoints I found that in those failed cases Target Index has a value of 0. Do you know why could be?

The branch I added looks like this, though again, afaik I just copied 1:1 what you made before:

Cheers! Hope you’re doing awright.

Thanks! Also a bit late on my reply, sorry. Still catching up on some of the stuff I pushed forward due to my PhD work.

Yeah, I saw that. Thanks again!

I think there might be a naming conflict here that is causing trouble. There are two TargetIndex variables here. One is the one stored in the ability itself. Another is the one stored as a local variable in the function (blueprint functions automatically converts input variables to local variables). I think you’re using the TargetIndex variable of the main blueprint instead of the local one of the function. As the AI and player store the target index differently, I’m guessing this fails in one of the cases. This is my bad for not naming them differently. If you right click the graph and search for the TargetIndex variable select the lowest one that is least indented. That should be the local variant.

Hey , I was wondering if you had any updates for the animations while moving? :slight_smile:

I’ve been working on this the last few days and I think I finally had a breakthrough a few hours ago. Networking was always the challenge here, but my new approach seems to work. I’ll need to do a bit more testing, but a new version should be out fairly soon that simplifies animating actions within other actions.

Edit: The main issue remaining is how best to handle units dying on their own turn. This code was ripe for refactoring anyway. Fixing this might take a couple of days, but then I should send out a new update.

The only good work around I found to units dieing on their turn was to put in code to always leave them with 1 hp. But if you can tell the unit to end its turn then die when when it recieves a fatal blow from a counter attack or an overwatch attack that might help

Thanks for the input. There are several possible hacky solutions, but I should probably rather change the underlying system so that such hacks won’t be necessary at all.

Hey, first off fantastic package. As someone very new to blueprints its a brilliant resource to look through and learn from. I was following along with your Custom Units - Custom Rigs tutorial on youtube, but am having an issue. I’m getting this error with AbpRef. The idle is playing, but nothing else is working with movement or attack etc, as it is failing to cast to ABP_Unit. Guessing its something very basic I’ve missed, but felt I had followed the tutorial along correctly.


Thanks!

this sounds great! For what it’s worth, in my game it’s perfectly acceptable for a unit to die on it’s own turn depending on the decision they make. They could even die in the middle of their run from tile A to tile B.

Me again, just to say that I’ve solved the issue and it was me missing something obvious. I was casting to ABP_Unit instead of the ABP for the new character/skeletal mesh, although not 100% sure how thats happened as I don’t think it was covered in your video. Probably my fault again! Still very new to all this.

Glad you figured it out. Simple mistake to make. Hopefully it was not caused by something incorrect I said in the video.

Yeah, that is probably the case for many games, which is why I’m trying to find a generic solution for this.

hi

If possible I would like to know when another major update is planned (roughly)
I just want to plan my continued work with regard to the updates you are working on (if possible of course)
Every major update requires me to start a new project, although some of the blueprints are only mine and then I just switch, but some are actually based on your orginal blueprint which I have to change according to my changes.

In any case, it is not very important and only if you have a rough estimate

cheers

leo

Yep, that was totally it! For what it’s worth I think it’d be a good idea to keep those variables named differently, in case you could do that in later updates, unless it’s smarter to work like this (in which case, I’d love to know why).

Now, next experiment. For the way these counterattacks have been set up, they are bound to the attacking unit, meaning no matter who this unit attacks, it would always receive counter damage, since it’s something hardcoded in the ability. Now, I wanted to flip this around, and make the counter be bound to the attacked unit, meaning no matter who attacks this unit, they should receive some counter damage.

So my though process was this, and please tell me if I’m on the right track during all this or I’m missing important ATBTT rules here.

-Normally I’d like to just paste the extra branch we added in ExecuteAbility() simply after the unit takes damage instead, but this is: A) not very modular, and B) not really possible, because the TakeDamage() function is in BP_Unit, which has no easy access to all that information like TargetIndexes/GridManagerVariables that abilities have…

-So, to solve A), I would create a BPI, let’s say BPI_CounterAttack, and add it to the unit I want to have this status effect. This should be a very modular solution to the problem, since I can attach or detach during gameplay these BPIs to various units (dont really know how to yet but I assume this is easily doable).

-To solve B), now in BP_Unit’s TakeDamage(), after the Hurt Queue Action I simply check if the object/unit has the BPI_CounterAttack, and if so I send through the Return Node a HasCounterAttack boolean as true. With this, back in the ability’s ExecuteAbility() I can specify what happens when this occurs after I call TakeDamage(), saying for example if HasCounterAttack is true, take damage. I even win some control in specifying whether some abilities are immune to this status effect or not.

What do you think? Can you think of easier & better ways of implementing this?

It is a bit difficult to estimate, and depends a bit what you mean by major update. The next planned update is the one that includes a system for inserting actions into the ongoing action queue. This could potentially be done in a week or in two months. It depends on how thoroughly I’ll need to modify the turn order code to get a satisfactory solution for units dying during their own turn. I guess my rough estimate is three weeks, but it is a pretty wild guess. This update will in any case be quite small compared to my major revisions, and I imagine it should be possible to just implement just the relevant changes.

Ok, glad to hear that was the reason. I agree that it is not ideal to have variable name conflicts like this. I’ve had it on my list of things to fix for a while, but other things have taken priority.

I think this sounds like a very reasonable approach. The solution that might come to mind immediately is to include the code in the TakeDamage event, but it would be unnecessarily called several times, and you’d have to pass over a lot of relevant information. Having the ability call an interface event on the unit as part of the execution seems like a flexible and clean way to solve it.

Oh, I just realized my mistake. A BPI can only be added to blueprints and not in-game actors, meaning if I added the BPI_Counterattack to a certain unit’s BP, all of the other units sharing the same BP would acquire counterattack too. Someone tell me if I’m wrong though, obviously.

  1. , have you made any videos going in-detail about status effects in the ability system, or maybe have some sample code somewhere in a specific map example? Maybe I could create a status effect for this Counterattack, which BP_Unit’s TakeDamage() could verify if it exists in its unit, to know whether to send back the OK signal for counterattack damage to be applied.

  2. Smaller curiosity Q: I am not aware what’s the purpose of leaving Branch nodes empty after a True/False pin, and why you seem to never do this in certain places. Say, for example, in many Event Graphs, like BP_Ability_MoveAttack or BP_TurnManager, after you do a “check if…” it’s common to see you leave the False pin empty, and continue the code only when the Branch node comes out as True/Valid.
    Shouldn’t such an action freeze the game? It obviously isn’t freezing when I run it so it’s not a problem, but I do not understand why it isn’t doing so. If the code is running each tick, and comes across one of these checks and is invalid, it has nowhere else to go! No return nodes, no exits, nada! However, you never seem to do this (AFAIK) inside functions, since in those you always put in a return node no matter where the code ends. I suppose what I am saying about freezups do apply here, and that’s why you do this, but just in case, I wanted to hear your words on this, if possible.

Cheers, and have a nice day & everyone.

I still think your idea is solid. I generally recommend making a duplicate of BP_Unit_anim as the starting point for your own units (unless you are not making units with skeletal meshes, and if so check my recent animation videos). You could implement the interface for this unit. Then you could tie the interface event in the event graph to a branch that checks if this particular unit can counterattack before proceeding with this.

There are currently two status effects demonstrated in the toolkit, which is the mind control and woke status effects. Check them out in JungleRaid. I cannot remember to what degree I’ve covered these in my tutorials. Probably not enough. They are fairly straightforward, though. If you add a status effect (generally done through a function in BP_Ability) the effect is added to an array of status effect (provided the unit has the ability system component). Then on the start and end of a unit’s turn it loops through all its status effects and run any events specified in the status effect to run at this time.

You do not actually need to have return nodes for everything in blueprint functions, as the compiler takes care of this. It is best practice, though, as it keeps your intentions more clear. Also, using a return node can exit a function even if it is, say, in the middle of a loop.

As for the empty nodes in various event graphs, I think I’ve generally set these up so that if they fail they are called again, or alternately send an error message. I’m sure I’ve forgotten it in some places, though. Could you mention some specific ones?

But regardless of whether I create a duplicate/new BP for my units, if I attached the BPI during gameplay to any unit’s BP, all the other units sharing/inheriting from this BP woud acquire counterattack too, no? This would be a no-go. That was why I asked about status effects - maybe this counterattack should use the same setup that those use, so that units sharing the same BP_Unit can be affected by different effects.

Nice, I didn’t know that about the return nodes - thanks for explaining that!

Well, in BP_TurnManager I can see an empty IsNotValid pin right after the BeginActorTurn event is called, in the Begin Actor Turn colored comment chart. Or an empty False branch in the same chart at the end, after ServerUpdateInitiativeBar is called. In BP_Ability_MoveAttack’s event graph, right after the Event Server Interact, inside the Click chart, we have tthree branch nodes, two of which have empty False pins.

Again though, just to be clear, I am not saying this is wrong - obviously the kit works like a charm as is from my POV. I simply wonder how it is these BPs can leave open ends like this and not simply freeze up.