[SUPPORT] Advanced Turn Based Tile Toolkit

Well, HoveredTile is a part of BP_AbilityBase already. Check show inherited variables in the variable list to find it. The GridTerrain map you have to create yourself in the grid manager. It is a map with integers as keys and BP_Tile_Terrain actor references as values.

I am having to adjust since it seems I was not doing some elements correct, I am trying to link the the grid terrain variable into the add at end but it says cannot connect to this type?

That means that they are not identical variables. How did you create the Add node here? Drag a pin out from the GridTerrain reference and then type Add. The context sensitive search should give you the correct node.

On the Grid terrain map elements it will not allow me to add tile types when when selecting them from the pull down list it remains as none.

Yeah, you cannot add references to specific actors (which are what references are) to a blueprint that is not itself instanced. No need for that, though. This loop adds all the tiles in the viewport during runtime instead.

I got everything added into the ability base terrain bp as shown in your sample code.

but when I run I get this error.

And this is my code

After doing some careful review it was the bp I was referencing… here is video showing it working now…

I am now setting up widget inside tile. If I want to have a widget be hidden inside a tile unless the tile is clicked whats the best way to activate a wiget on a tile that is otherwise hidden until needed?

I am guessing the best way to do widget visibility on tile is create a new ability class and have in that ability have ability triggered on tile have it show widget for that tile?

Abilities are a good way to handle player input and displaying relevant in-game visualization such as 3D widgets etc. However, I’m not sure if you need a separate ability for this. Am I correct in guessing that you only want to show one such widget at a time? If so you can add this widget to the ability you have already created, you then place it over a tile when the tile is clicked and make it visible.

Each tile has its own widget such as forest tile would have its own widget for construction or cutting down tree’s ect, flat flat would have its own widget for its tile type. but widget should only be visible when current tile selected.

Basically in the Parent class of the Terrain tile I added a widget class created event interact set visibility of widget.

now what would be the best way to activate that event from the abilites blueprint?

Hey ,
first of all thank you for this wonderful toolkit!

I have been experiencing problems with the integrated object system(grid objects array, add object to grid function, remove object from grid function).
The fact that the array is made of FObjects Structures which contain an array of objects made me believe that the system is designed to allow multiple objects on one tile, the functions also seem to be made with the idea of multiple objects on one tile in mind. However, the add object to grid function seems to “limit” the objects to one object per tile. Also, the remove object from grid function does not seem to work at all. Maybe there is just something weird going on in my project but it would be very kind if you could have a look at it on your side.

I hope to hear from you soon.
Justus

You have access to references of the tile actors through the GridTerrain TMap, which you can use to call events. I can recommend reading up a bit and doing some tutorials on working with blueprints more generally. Many of your questions have to do with blueprint communications. It is something that takes some time to learn, but it is a requirement if you wish to master UE4. The official docsis a good place to start, but there are also many tutorials on blueprint communications if you search for it :slight_smile:

Hey Justus, thanks for the kind words. The way you describe it is indeed how the object system is supposed to work, and the fact that you are only able to store a single object in a tile is a bug. I actually discovered this bug just a couple of days ago, but I’m uncertain how long it has been present. This bug seems to be caused by some change to the underlying UE4 code and how the engine handles manipulating arrays within struct. I have made the following work-around that should bring the GridObjects functionality back to how it worked when it was initially implemented (here is a pastebin):

Hi, and that for the reply on the Question section. The idea for “mouse grab and move” that i have, In the project that i am working on i need to be able to grab static meshes and move it where i want on the the map. I will have table and chairs and other stuff that the player can move around. Maybe pressing shift and the pointer turns into a hand so one can grab the movable object in the scene.

Hey ,
thank you for the quick work-around. That’s what I thought. You are also experiencing the same problem with the remove object from grid function(the remove is not reflected back to the struct array), right?

Yeah, sorry. You need to do the same thing there. UE4 has gone back and forth a bit on whether manipulating nested arrays directly is functional.

Edit: I’ve modified the function a bit further to prevent the map filling up with empty values:

Perfect. Thanks!

There is a super weird issue with PMs that has been happening to me a while. I can see some of the text in my e-mail preview, but when I go to read the PM on the forums it is blank. Sometimes it is in text the first time, but then it goes blank later. [USER=“2598148”]Hayden Meek[/USER]: I’m sorry, but I can’t see your PMs now. Could you post in this thread instead? The PMs look like this:

Anyone experiencing something similar or know what the problem might be?

Hey ! Just want to say how great this toolkit is! I so appreciate the work you’ve put into both making this kit and making the time to support it with videos and this forum. Makes it easier for me to pick through the blueprints for what I want, though I’ll admit that I am dumb environment artist and not a programmer.

With that in mind, I hope you don’t mind me asking a few questions:

Firstly, in one of your older tutorials, you quickly altered the square grid to a hex grid by switching out meshes and altering a few settings. However, now I am looking to switch the advanced square grid to a hex one and I am unable to locate anything obvious in scripting or otherwise. Does a simple option still exist? Would it merely be easier to add the advanced components to the hex grid instead, rather than converting the current advanced square grid to a hex?

If I wanted to spawn in enemy units in varying amounts at varying times during the game (Turn 10 would see three groups spawn, for example), how would I go about this? I followed some other post you made about this, but it seems out of date.

If I wanted to group enemy’s turns based on their initiative, would this be possible? I want to spawn quite a few enemies, and I would like all enemies with the same initiative to act at the same time to save player’s time.

Thank you in advance!

Glad you like it :slight_smile: No worries, we all have to start somewhere. Hope the toolkit will serve as a good learning tool.

BP_GridManager_Adv is literally just BP_GridManager with the stealth and cover components attached, so just add these components to the hex grid and you’re golden.

You can spawn units just like any other actor (By using the SpawnActorFromBlueprint node). There are exposed variables for placing the unit on the grid and in initiative on spawn. If you want to do this on turn 10 you could check the value of CurrentTurn near the end of EventBeginNewTurn (in BP_TurnManager), before the InitializeQueuedActions function is called. If the value is 10 you could then spawn your units.

Not sure if I understand what you mean here. Are you talking about having the enemy units act one after another, not going between the turns of individual player controlled units? If so this should be default player behavior? Or are you talking about animation everything all enemy units do simultaneously (which is pretty tricky to do). Which is it?