[SUPPORT] Advanced Turn Based Tile Toolkit

Ok, I see. I misunderstood what you meant by input. You can setup units to receive input in their blueprint settings, but I would not recommend this as you would need to add branches to all units to make sure that they are the active unit which would trigger for all units every time you click the input key, which is both clunky and inefficient. Epic generally advises to put input in the player controller anyway.

But that receiving the input is handled by the player controller does not mean that the rest of the logic cannot be handled in another blueprint. In fact that is exactly what I’m doing with the ability blueprints. If you choose to do inventory like you describe it (using collision and clicking), here is one way to make it work:

Handle the click event in the player controller. If you detect that you have clicked an item we want to know if is on a tile next to the active unit and that the active unit is currently being controlled by the player who owns the player controller receiving the input. For this last part, check the nodes following the click input in the player controller, where I do this already.

For finding out whether the item is adjacent to the unit you can use the GetDistanceInTilesBetweenIndexes (or a similar name. Cannot check now) function in BP_GridManager. The input for this function is two grid indexes, so you would want to convert the location of the item to a grid index by using the ConvertLocationToIndex function also in BP_GridManager. You can also be a lot more lazy and simply take the location of the active unit and the item and check if the distance between them is lower than TileSizeX * 2.

Now after you’ve confirmed that the item clicked is adjacent to the active unit, you can activate a custom event or function in either your item or your unit or inventory manager for adding the item to the unit’s inventory. There are many ways to do this, of course. Personally I might have added an event (perhaps an interface event) to the item, which includes an input for the unit picking up the item. Then for this event you could choose to play whatever animation or sound you want for picking the item up and then add it to an item array stored on the unit (or whatever method you are using for storing the item).

Sorry if my explanation is a bit vague, but since I’m not exactly sure how your inventory system works I have to be a bit general in my response. Let me know if what I said makes sense to you or not.

Hi junghoon. I’m not sure I understand exactly what you mean by ā€œtreated like an obstacleā€. Enemy units are by default treated at least somewhat like and obstacle, in that you cannot move through them. Please go into more detail and I will do my best to help.

Great! No, it was pretty easy to fix when I knew what the problem was. I had just set up some stuff wrong in the grid manager, and I just had to connect it correctly. Thanks for reporting the bug. I have now sent Epic a hotfix which includes fixes to all the issues reported in the last few days, as well as a few more I’ve found on my own.

You can use the GetDistanceInTilesBetweenIndexes function (again, not sure if I got the name exactly right) in BP_GridManager for this. Input the grid index of the attacker and target and use a branch to check if the return value is greater than one.

Hello !

Awsome toolkit and awsome support. I’m a completely new UE4 user that has a grandiose project ahead of me :slight_smile: As a beginner, I’m sorry if my coming question/questions are very ā€œhigh and lowā€ but I will do my best of understanding your answers.
I followed the UE4 Tutorial for the Multiplayer project and I am now trying to weave that together with your latest update of the toolkit. Everything works fine when using Open Level to go to either your Example map or my own newly created map using your BP_Gridmanager. However, as my project will have a lobby (world map) before entering each level I need to use ServerTravel to migrate both server and clients together to the new map. When I do this however, I end up floating in the middle of the map with no control over my pawn. I suspect the difference between Open Level and Server Travel is that Open Level recreates Game Modes, Player Controllers etc so that something is ā€œin the wayā€ of your toolkit taking over.

My question is, is this something that you have tried and have some kind of ā€œaha!ā€ solution for, or at least a place where I should start my debugging. I will of course continue learning your toolkit but it’s quite vast for a beginner so will probably take me a long time to get to a solution all on my own.

Anyways, rambling over and thanks again for all the hard work!

Cheers,
Mivke

Well, I’m sorry I’m not good at English.
The meaning of the obstacle I mentioned is the same as Tile_Wall.
You want the attack to be impossible when there are enemy units within range of movement.
You also want the enemy unit to be treated like Tile_Wall.
I want to make the tiles in which enemy units exist not to be filled in red but to be immovable.
I want to make the enemy tiles in the attached screenshot equal to Tile_Wall.

Hmmm, the differences between OpenLevel and ServerTravel is honestly something I don’t know anything about, so I’m not exactly sure what is wrong there. My guess would be the same as you, that having some blueprints already initialized from the lobby prevents the various startup events from being executed in the correct order. Unfortunately I’m in a pretty awkward position for doing heavy multiplayer testing at the moment, as I’m staying abroad for another month at an Airbnb with a poor internet connection and with only one laptop.

Here is something you can do to figure out what is going wrong, though. Add print string nodes at various points in the EventBeginPlay and Activate events for the important blueprints that are initialized at startup. Then compare the output for opening a level versus using server travel and we might be able to pinpoint where things go wrong. Blueprints to check would be the player controller, the grid camera, the game mode, the turn manager and the action manager. Sorry that I cannot give more specific support at the moment, but that is where I would start looking personally,

Don’t worry about your English. I will try my best to answer your questions and you can tell me if I misunderstood you.

Like I said in my last post, units already block movement, so they are already treated as a wall in that sense. So what you want to do is to prevent other units from attacking the unit? Maybe also to prevent other units from attacking units that are behind the ā€œwall unitā€? If this is what you mean, then why not simply use a wall instead of a unit? Or do you want it to be like a wall that can move?

For a moving wall you can do the following:

  1. Create a new blueprint of the class BP_Unit
  2. Add a static mesh component and set it to be a wall mesh.
  3. Set the collision of the static mesh to block RangeTrace and ignore PathTrace, WallTrace and CoverTrace.
  4. Attach the static mesh to the skeletal mesh component.
  5. Edit: See my next post for a small change you will need to do to BP_Unit.

You will end up with this:

https://media.giphy.com/media/9DhUTcMGAKpoKRH4WS/giphy.gif

I hope this is close to what you had in mind.

Ok, the hotfix is live! Check the ā€œAdded in 1.81ā€ list on [my Trello board]( for a list of fixes.

Annoyingly I just discovered a new bug right after it went live. If you are using units that are not based on BP_Unit_Anim, but just the base BP_Unit (Like in the example I just gave to @losemarins) you need to make sure to call EndAction when they are animated or the game will not progress while waiting for the nonexistent animations to end. Like so:


I’ll add it in the next hotfix, but I’ll wait at least a week to see if any other bugs show up I need to correct, so you guys don’t have to re-download every other day. Apologies for all the issues that have to be resolved, but as I’ve mentioned, I expected there to be quite a few bugs I had not been able to find after such a massive overhaul of the toolkit.

You can use the GetDistanceInTilesBetweenIndexes function (again, not sure if I got the name exactly right) in BP_GridManager for this. Input the grid index of the attacker and target and use a branch to check if the return value is greater than one.
[/QUOTE]

Thanks worked like a charm :wink:

Very nice work ! do you plan to make a video to add this project into Dungeon Generator V2 in Blueprints - UE Marketplace

Hey , hope you remember me from our e-mail exchanges over the past while. Been using your toolkit since June/July of last year. Wanted to say ā€œGREAT UPDATE MAN!ā€ this added a lot of sorely needed functionality and some of the changes you made enabled me to fix some major issues I had with my prototype prior. Wanted to point out that the ā€œCan Player Switch Unitsā€ Bool wasn’t hooked up to anything, but can be easily fixed in BP_Ability –> Default Click –> See attached image for code. Not sure if this was fixed in one of your previous hotfixes, but if not, hopefully this helps someone.

Secondly, on the AttackMove Ability BP, under the Click section, the location node is disconnected by default. Is this intentional? See my other attached image.

Lastly, in previous versions of the toolkit, you allowed for units to follow their hard set initiate order. Now it seems like initiative order is hard locked per faction. I’ve fiddled around with it, but attempting to change the initiative on a unit manually ends up in it being set back to 1 or 2 based on faction. What am I missing? How do I get the turn order to follow hard initiative values for units regardless of teams and have the active controller switch back and forth as necessary? Apologies if I missed something somewhere along the line, this update included so much I still haven’t gotten myself acclimated just yet.

Thank you for your time and thank you for your great toolkit.

Great :slight_smile:

Thanks for the suggestion, though I have more than enough other tutorials planned, so I don’t really see myself making tutorials to integrate the toolkit with other marketplace assets. At least not any time soon. I might do one on the toolkit’s procedural walkability generation more generally, though. What you need to do to get the toolkit working with any sort of procedurally generated map is to make sure the grid of the grid manager and your procedural map is aligned and of the same scale and that the grid manager is large enough to cover the entire potential area of your map. Then you need to make sure the procedural map is generated before the grid manager is activated. Then have all meshes of your map that can be walked on block the PathTrace channel and all meshes that can block movement block the WallTrace channel. Lastly set the Heightmap variable in the grid manager to either false (if your map is flat), one level (if it is not) or multilevel and set TraceForWalls to true. Toy around with the other values under the procedural tag to get the desired effect. Hope that helps!

I think you used a different name in our e-mail exchanges so you will have to remind me. I’m happy to hear you like the update, though! Thanks for pointing out the various issues you found. All the things you mentioned are indeed mistakes and I will add them to the list of stuff to fix for my next hotfix.

As for initiative order, it does actually work like before. It is just that the example map uses the BP_Unit_Anim_Auto actors. I made this actor as a replacement for the four different ranged player, melee enemy etc. units I used to have. They are just like BP_Unit_Anim, but their materials are set to green or red depending on their faction and their animation blueprint is changed to the ranged one if their range is higher than 1. Also, their initiative is set automatically to 0 for enemies and 1 for players. I feel that this unit might be more confusing than it is helpful, though, particularly as it is used in the basic example map. I’ll probably go back to the older version of doing things in the next hotfix. So to answer your question, if you want to be able to modify the initiative value of units do not use the BP_Unit_Anim_Auto class.

OK this is weird, first pic is BP_Ability…default click from the first release of update, second is pic of same from hotfix, they don’t even have a"Can Player Switch Units" nodes

EDIT: I only found one reference for that node in all BPs and it is in a widget BP ?? strange
:confused:
Edit2: Removed local content, reinstalled, still the same…

Thanks for the answer man! I will try to do some detective work and see where this issue happens. Since my current lobbyPC and lobbyGM are quite small, do you see any problem trying to move their functionality over into your main GM and PC? I’m thinking if your gm and PC run everything then things should not need to be reinitialized and things might go smoother? I know these are extremely general questions but I’m just trying to get a feel for how everything is connected specially when multiplayer is involved.

Thanks again for the time and have a good time abroad

Thanks for the reply man! I will do some detective work and try to find out the difference between what happens in the two instances, will let you know what I find out.

A general question about the toolkit kinda: My earlier project had one LobbyGM and LobbyPC AND one GameplayGM and GameplayPC. The latter two are almost not used, so I’m thinking about trying to move the functionality over from LobbyGM and LobbyPC to your Gamemode and PlayerController. Do you think this is a bad idea for some reason? I’m thinking just adding functionality to your BPs should not mess with too much and then the engine will have fewer versions of GMs and PCs to ā€œkeep track ofā€. Since I’m still very new to this I don’t have a good understanding of the different types of versions of GMs and PCs that exist and how the enginge know which one to keep active.

Again, thanks alot for all the hard work!

Cheers,
Mivke

Skulldog, you need to add in the nodes I have in the comment box in my first image if you need Can Switch Units Boolean to work. I was simply showing what nodes needed to be added in where for their intended functionality.

Thanks Tarrtaarus, misunderstood your post, I just saw ā€œbool not hooked upā€, Thanks

Sure thing man, let me know if I can help with anything else.

, I’m having some difficulty setting up custom characters with this new update. I imported all of my models, retargetted animations to their mesh, but when I plug it into the mesh slot on a character, they default to the T-Pose and it spits out error messages regarding AbpRef referencing null. What am I missing here? @.@

Tarrtarus maybe this time I can help you, I just went through this myself, Abpref is an animation BP reference, you have to make an animation BP and change the Abp_ref type to your animation BP in your unit BP. hope that might help, If you need more help PM me !

Edit: Actually if you did a retarget you could used might be able to use that skeletons animation blueprint… that should work

Hey, my support thread has become self-supporting :smiley: Thanks for helping each other out, guys. I’ll chime in now too.

Like I said I’m not 100% confident on all the lobby and map transition stuff, but I would think it makes the most sense to have separate PCs and Game modes for the lobby and game. All the stuff in the included game mode and player controller is really geared towards handling turn based gameplay and I don’t think it has much use in a lobby.

Not entirely sure what has gone wrong here. I will give it a try myself and report back. Are the custom characters using the default UE4 humanoid skeleton?

Not a problem ā€œTryingā€ to help others , I copied and paisted the unit BPs and it was fun fixing up because I used unit_anim_advanced…had a bit of reparenting to do but it worked…I was thinking of doing a pdf tutorial on how I did it…unless you want to do another video…BAH hah I know how much you like to make those !

I actually don’t have that much against making tutorial videos (except the four hour long blueprint one…). It is just that it is hard to justify spending the time on it these days with a lot of work-related deadlines approaching. Animation retargeting stuff is never something I look forward too though. It is a part of the engine that I use so seldom that I usually forget how to do it between the times when I need to. I also have more pressing tutorials to make before that, so if you made a PDF for this I would be in your debt (no pressure, though!)

I’d appreciate some advice, as I am a beginner (roughly). I am used to opening doors based on a trigger volume. Using the index system in this toolkit, I’m having a difficult time with the following:

As the pawn approaches a door, the door should open when the pawn is on the tile directly in front of the door. The door ā€œslidesā€ open, and the pawn walks through.

Thank you in advance.