[SUPPORT] Advanced Turn Based Tile Toolkit

​​​​​​

Hey EagleEye, I understand why this might be a bit confusing. Nested arrays and maps are not directly enabled in blueprints. To circumvent this it is possible to create a struct that holds and array or map and then make an array or map of that struct, effectively creating nested arrays. In the example from my code I’m using a map of structs containing maps of structs. In your example I’m guessing you’re just using the struct itself.

Yeah its just the struct itself, could you show me an example of the code you did for this example?

Thanks, EagleEyeGamma.

What sort of example do you need? There is nothing more to it than creating a struct holding a map and then creating a map of these structs. Are you struggling with these steps or with manipulating the data within the struct? Unreal Engine blueprints are a bit weird when it comes to directly setting values in structs, where you sometimes need to use a temporary variable to hold a nested struct while modifying it.

I believe I’m struggling with creating a map of these structs which is what is preventing me to get to the final step to give BP_Unit a Type and then do the final blueprint step need in that example.

Thanks, EagleEyeGamma.

Nevermind figured that one out, however just in case i don’t figure this one out can you explain how you did this?

Thank you very much, EagleEyeGamma.

Also figured that out. Now for my next question, For another mechanic I was thinking of when you hit a weakness that unit that dealt the damage goes again allowing for one more movement by replenishing the AP however if they attack the same target twice their turn ends. I was wonder how I could implement it into these blueprints. Also thanks for the previous example I was stuck on trying to put in that mechanic on my own for several weeks.

Thank you very much, EagleEyeGamma.

Glad you figured it out. Sorry I could not be of more help to your last question, as I was still a bit uncertain about what the problem was.

For your next question you would want to keep a list of attacked targets and add an action point after attacking if the target is not on the list and has a weakness to the attack. I duplicated BP_Ability_Attack, as it is simple, and added a new Set variable that I called AttackedUnits. At the start of ExecuteAbility I check if the attacked target is in the set. If it is not I add it to the set and add an action point to the owning unit (you would also want to add your elemental weakness check here). If it is not in the set I proceed as normal.


All abilities are shared among all units and abilities are deactivated and activated anew each time a unit uses them, which makes how we store and clear the AttackedTargets set a tiny bit difficult. I’ve resolved it here by checking if the owning unit has 0 AP before clearing the set on deactivation. By normal ATBTT rules this means that the unit’s turn will be ending. Not super elegant, but will work, though if your game uses different rules you might want to set up something more explicit.


Note that BP_Ability_Attack has bUseEndsTurn set to true by default, which should be set to false for this to work properly.

Hope that helps!

Hello @, I just posted on one of your youtube channel tutorials about integrating the CCG toolkit into your ATBTT. I see that some other users here are looking for the same thing, I’m pretty sure we all want the same basic 5 functionalities migrated:

  1. Deck builder widget
  2. Select a custom deck to use in the match
  3. Putting units on the map by selecting or dragging & dropping cards
  4. For it to work in multiplayer, where one of the players is the server
  5. For it all to be as easy to develop and change as possible

Any aid on this would be wonderful. The Game State and Game Mode blueprints seem to be the ones who have trouble cooperating.

@ would you be willing to make a tutorial for this?

Hey Doc, most of these questions are difficult to answer, since I don’t know anything about the inner workings of the CCG toolkit. I’m going to need you to give me more specifics on the issues you are facing. What precisely do you mean when you say the game mode and state are not cooperating? What have you tried so far? Selecting a custom deck and having a deck builder widget seem like questions you should ask the creator of the CCG toolkit, by the way. You might have luck asking the developer of Grand Guilds about how he got it set up, though he is far into development, so be mindful that he’s probably pretty busy.

Hello, I’m currently attempting to make a D&D like game, I’ve watched your tutorial series and am having issues assigning a single “pawn” to a grid camera per player. when I go into multiplayer the camera changes with the initiative. So far I have created an authority branch for the grid camera allowing the grid camera to function normally for the Host, and removed the set target location for the remote clients. The issue is when you are a client the camera still moves away from the pawn placed in the player start. how would you go about making it so the client camera will stay locked on that pawn?

Hey , the past week or so I’ve been merging your toolkit with the card game toolkit, and I think I messed something up. How does the spawn? I can’t seem to figure out where it comes from. In my current implementation it doesn’t spawn, and so my game is broken. Any ideas? I checked the default pawn, and its set to BP_GridCamera, but that doesn’t seem to fix it.

Also, any luck on the mobile stuff? :slight_smile:

As always, thanks! :slight_smile:

Hey ,

Can you explain how you made this parent blueprint node in the example you gave me?

Thanks, EagleEyeGamma

Hi there! I’m a DM myself, so I wish you luck on your game :slight_smile: By your request I’ve made a setup for assigning specific units to cameras of clients. It is a bit more hacky than I would like, but it should work. I’ve added a new function to BP_TurnManager which loops through all grid cameras, finds the ones not controller by the server and assign a unit controller by that player to each one:


The ClientAssignPlayerUnit function is a new client event in which assigns the unit to a new, custom variable:


Then I modify the Follow Actor interface event to always follow the assigned unit if available:


See if this gives you the result you’re after :slight_smile:

Hmm, it should spawn normally as the assigned default pawn class. You’re using BP_ATBTT as the game mode? How does the game look when you start? What camera seems to be possessed?

As for the mobile stuff I found out why I’m not able to run it properly on my phone, and that is because the USB port on my phone is slightly wonky, causing it to disconnect and reconnect sporadically… This cancels my attempts to test on mobile. A silly reason, I know, but it is holding me up currently. I’ll see if I can borrow someones phone to test it out.

In any child blueprint you can right click any event which is defined in the parent and select “Add call to parent function”.

Thanks also after I’ve used these abilities for some reason they don’t take any damage, I looked at BP_Unit’s Take Damage function and it should work as the Damage Variable is at 35. The logic should work as they are doing the animations for taking damage then it should give the damage as it should through the toolkit’s base code/blueprints but it just doesn’t. Any idea of why this could be happening and a solution?

Thanks again, EagleEyeGamma.

Could be a few different things based on what you’re saying. Have you seen my tutorials videos on the action system? Might you be only changing CurrentHealth without changing the health bar through an Action? Have you tried printing the value of CurrentHealth and seen if it is changed?

I looked at the default toolkit with no modifications to figure out the problem however, my next question is that example of the elemental weakness how can i find the attacker unit’s type and apply that into the damage?

Thanks, EagleEyeGamma.

I got the camera issue figured out :slight_smile:

Another question for you!

If I had a PlayerTurnArray of BP_PlayerControllers passed into the BP_TurnManager Initialize function to declare the player turn order, how can I make it so that the units belonging to the player at the beginning of the PlayerTurnArray go first? The card system I have declares a random player to go first, so I want to make sure the 2 turn managers are in sync as far as who is going first and who is going second.

Thanks!

There are no unit types by default in the toolkit, but if you implement it like my recent suggestion you can access it through any reference to the unit. In an ability what often makes sense is to either access the OwningUnit of the ability or the target unit by finding the reference in GridUnits using the TargetIndex variable.

Good to hear you fixed your camera issues :slight_smile:

For sorting what players go first you can get the player controller order list from the card game template (which it seems like it has) you could loop through these and have a nested loop where you loop through the units in initiative. Within this nested loop you would check if the units are owned by the player controller in the outer loop, and if so add the faction of that unit to the FactionOrder array (breaking off after finding one valid unit). I think that should do the trick. Be sure to do this after the AssignUnitsToPlayers function, but before StartMatch.

Hi, hope all is well.

Currently, I’m using the toolkit to have units prespawned for each team, i’ve dragged them onto the grid onto the appropriate starting tile, and depending on which Unit Type a player chooses from a WBP menu before the game starts, it is changing the attributes of the prespawned unit (defense, attack, Unit Name, etc) to reflect the player’s choice.

I’m looking to be extend this functionality to Unit’s abilitiies. Currently, I can change the unit’s abilities from the details panel in the ability system in the world outliner, but this would be static and would be the same no matter what the player chooses for the Unit Type.

I’d like to be able to have a unique ability to be added depending on what Unit was chosen at the beginning of the game (similarly to how unique stats and names are being set currently). I’m having trouble getting this to work, I’ve been trying to watch the first ability system video and using nodes like Add Ability, Set Array Element, Update Ability Box etc, but can’t get it to work.

Thanks!