Yea, thats what I figured. Thanks man, what I’ve done is move to a more semi-random dungeon builder, similar to the way Dungeon of the Endless builds its dungeons, and am planning on then adding the GridManager afterward so it can then scan for walls/etc. Love it so far, keep up the great work!
I have been working with both Unreal 4 and your Blueprints for about a month now. I am finally understanding how everything works, Thank you for a great system. One thing that caused me much grief though was the SM_AR being inherited so earlier. Made it hard as newbie to replace the SM_AR with another weapon. Having the weapon in BP_Unit_Anim instead of like BP_Unit_Anim_Adv makes it much harder for newbies like me to add a different weapon, especially when the AddHealth ability is casting to BP_Unit_Anim. But also was good lesson I guess.
Great, best of luck!
Happy to hear things are beginning to click. I think the placement of SM_AR in the hierarchy is okay, though I understand your objection. The idea is that a duplicate of BP_Unit_Anim (not a child blueprint) should be made for whatever base unit you want in your game. That way you have full authority to change anything you want animation wise while keeping the essential functionality of BP_Unit. Nothing in BP_Unit_Anim or its child blueprints are needed for the game to function and are just for animation. BP_Unit_Anim_Adv is just BP_Unit_Anim with the stealth and ability system components added. You can just add these directly to your fresh duplicate and achieve the same result.
I understand that it is easy to fall into the trap of basing your own unit on one of the child blueprints further down into the hierarchy if you use the JungleRaid map as a guide. I intend to explain what I consider the best method (described above) when I make an updated video on how to create new custom units (on my to-do list, I swear)
This is a pretty big WTF here for me. I’ve got some characters that I’m using from a set. Their heads/hat/masks are additional meshes. If I add 1 static mesh and attach it to the head, it’s fine. The unit still works fine. (e.g. the hair) but if I add a second static mesh to the head socket, it stops functioning. When I start the game the unit will not shoot or move with a second static mesh there. Now for the head it’s fine because it covers the whole head, but other masks also require a hair mesh be attached.
Edit: Already solved this. Apparently you can’t have something cover their face with collisions. Is there a line trace or something being done for movement/shooting? I set the masks no collisions and then it was fine.
I’ve actually got a functioning cut-away system in place for my camera. If a character is in a building or behind things it’ll hide it for me so that I can see. The problem I’m having now is that despite the building being cut away the grid has already laid itself out, so you end up with a bit of an odd situation, where you can see into the building and where the character is, but your camera is a bit higher up. This means your mouse tries to interact with the spots that might be on the roof rather than the floor you can see. Is there anyway to have the grid go transparent with the underlying meshes?
Also, why is the game always starting on Turn 2?
This is probably another newbie issue I think, but I thought I heard you say you could delete any sub folder like Maps 2d, but when I deleted caused other things to get broken. I think it is when deleting the BP_Grid_Manager_2d is breaking BP_Grid_Manager, unless I am not clicking the right warnings when I am deleting the Maps 2d. After I deleted everything in Maps 2d, but left Maps 2d Core folder in everything still works.
Thanks, Loco
Yeah, you need to be careful what meshes are blocking RangeTrace and PathTrace when using the toolkit. Only things blocking line of sight should block RangeTrace and only things that can be walked on should block PathTrace. If not you’ll get weird results like a unit’s head blocking its own line of sight or the GridManager treating the tops of heads of units as ground when calculating walkability.
For your first question again the answer is the trace channels. When you hide the top floor you also need to stop these meshes from blocking PathTrace or you will not be able to select tiles through them. Check out the platforms in the JungleRaid map that I have set up to become semi-transparent and click through when you zoom close.
As for the game starting on Turn 2 I’m not seeing that. Can you give me the steps to reproduce this?
Hmm, yeah seems like UE4 is detecting some dependencies. Not sure if it is a false positive, though, as I’ve now tested deleting the folder with no apparent issues. What issues are you seeing on your end?
This was my mistake. When starting a game I saw the hourglass marked “Turn 2” and misread that as meaning the current turn was turn 2, it was marking the start of Turn 2.
Is there a simple way generate tiles on a vanilla Top Down blueprint project? I don’t need any of the turn based stuff, just the multilevel tile generation/navigation logic so that it restricts my character to a specific 100x100 square per move. Thanks in advance.
Is it possible to create a third non-hostile faction? For example if I had Team A and B controlled by players, but wanted a third faction of say civilians or something like that handled by AI, is that possible?
How does cover work? I’m looking at the jungle map but can’t see what activates it? I have the advanced grid manager on my custom map, with the cover system component, I even dragged in some of the tiles from the jungle map to my map but I can’t get the cover system to seem to work on there. When I try to move a unit next to them, there is no shield icon.
And what is the proper way to change the color of the overlay for the grid? I tried changing it on the grid manager in the world, but changing from blue to green did nothing.
And as yet another question: The Laser Ability seems to be broken. it always hits, even when reporting a hit percent chance of 0. I edited my units to have lower accuracy and higher dodge, and even when the mouseover reports “0%” it still hits. Every time. And now that I’ve managed to decipher the blueprint here, of course it does, because you have it set to return a hit no matter what. Is this an error? or did you set this laser up to always hit? I even tried attaching the hit bool to that lower branch, but even when it returns false, the unit still takes damage. But I can’t see why. The take damage is only on the true node.
Hey ,
first of all i wanna thank you for this amazing framework! Im trying to spawn Units in runtime. I know this is a frequently asked question, but the framework changed a lot over time and i couldnt get it work with the old advices you gave to other people on this topic. It would be amazing, if the system recognizes spawend actors in runtime. Maybe it would be easier for beginners, if frequently asked questions are summorized on a blog or something. Thank you a lot.
I want to achive the following: when a unit enters a certain area another unit spawns randomly.
It’s the BPI_Interact in the Maps 2d Core folder. When I try to delete it says it has 1 Asset Reference and 3 Memory references to BP_GridManager and if I do delete it, it does break the game.
There is definitely something messed up with the included laser ability. I added some print statements and rewired the hit result into the branch as I think it should be. The first time a unit tries to laser fire in the game, the bool prints (it was true) and the unit was hit. Every attempt to fire a laser after that, results in nothing being printed but the sound plays and the unit takes damage. I fired this 3 times in the game I just tested, and only got a single print, but each shot resulted in the unit taking damage. I then added another print node to the false line, and even when it reports false it’s running take damage, but how?
On further inspection, it looks like even though the shot is missing, it’s affecting the health bar. Now all I’ve done to customize this health bar is to change the material, and I updated the blueprint to refer to it’s variable (progress instead of percentfill). if I inspect the unit it was still showing 100/100 health, however after being hit 4 times the body drops to the floor and it turns in to an invisible ghost. After another test with 2 units shooting at it, 1 hit, 1 failed. The health is 70/100 but the bar has been reduced 2 times as if it’s been shot successfully two times. The third shot is a successful hit and enough to kill him if all the shots had hit. But they didn’t. In the screen shot you can see the “killed” unit is invisible, but still in the game.
Finally after a bunch of trial and error I found the problem. It seems like that entire section was not wired correctly. That hit result bool needs to be wired to that branch AND it needs to be wired to the bool of the queue action on the right. Otherwise it still tries to update the health bar of the targeted unit regardless as to whether or not it was hit. The updated wiring in the screen is what was required to make this work correctly, in case anyone else is having this issue:
It work yaaaa. Thank you crossmr so much. I though it was something i did lol. You saved me big time me big time.
No problem, you still need to customize their accuracy rates and things like that. The next challenge is the APs… I created a new ability that needs 2 AP, but I can still use it after moving, which is not what i want. The Unit has 2 AP and the “Move” ability requires 1 AP, but after moving the unit can still use an ability that requires 2 AP. It looks like the AP is deducted after ability use, but not checked before. is there any built in system to check/disable abilities when not enough AP remain?
Edit:
After more digging around, it turns out the cover system is something that is built in to the sprint ability. Is this the best idea? I feel like checking for/displaying cover/etc should be something that is independent. But exactly what does this mean? Is only displaying the icon independent? if I use the regular move ability to move someone into a spot that should have cover, would they still have the cover benefit even if no icon was display when they moved there?
The other outstanding issues I have are these two:
Is it possible to create a third non-hostile faction? For example if I had Team A and B controlled by players, but wanted a third faction of say civilians or something like that handled by AI, is that possible is there any basic AI set up for a non-hostile faction?
And what is the proper way to change the color of the overlay for the grid? I tried changing it on the grid manager in the world, but changing from blue to green did nothing.
Wow, lots of posts since last I checked. Sorry for the wait, guys. I’ll get to answering.
Ok, good to know. I guess this might still be something that would be confusing to players, though. I’ll consider a rework for how it is displayed. Maybe just call it “next turn”?
Not entirely sure what you mean by generate tiles? You can always place down the grid manager in a TopDown project and just never start turn based combat in the Turn Manager if you do not need any of the turn based functionality.
Yep, just expand the faction enum with however many factions you want. Then add the faction to the allied factions set of whatever units you do not want harming it.
Cover is indeed handled by the abilities in the advanced example map. JungleRaid is an example map that shows possible ways for how you can expand the toolkit’s base functionality to create an XCOM-style tactical game. One of the reasons I did not place the cover functionality deeper into the core of the toolkit is that it is a system that will only be used in some games, which would just be clutter in many cases. There is also an argument for keeping things as modular as possible. Having much of the cover functionality handled within individual abilities (albeit in tandem with the cover system component) allows the designer to flexibly design how each specific ability interacts with the cover system. The sprint ability does not really interact with the cover system on a server-side level (except for the AI), but just for displaying cover icons to the player. The real impact of the cover system is handled within the abilities that are affected by it, which by default is only BP_Ability_Laser. If a unit moved behind cover using the regular move ability they would still have cover against units using the Laser ability as hit chance is calculated there and not applied as a modifier on ending movement.
Again this is something that is handled within the individual abilities. Change the materials of the tile marker HISMs in the ability you want. The values in BP_GridManager used to universally affect all abilities, but the values stored there now are just used as defaults if nothing is defined in the specific ability.
Whoops, that’s a mistake. I changed this temporarily as I was debugging the last update. Apparently I forgot to change it back. I’ll put it on my bug list change this in a hotfix. Thanks for letting me know.
Yeah sorry, there is an issue in the current version that means you need to add a couple of extra nodes when spawning a unit to get it working properly. I will also get to this in the next hotfix. Check out how to fix this in the present build here.
Yep, you’re right. BPI_Interact should not be there. For a long time this interface was only used in the 2D map, but when I moved the functionality to the main grid manager it seems I forgot to move the interface with it. I’ll fix this, but in the meantime move BPI_Interact to AdvancedTurnBasedTileToolkit/Core and then FixUpRedirectsInFolder (On AdvancedTurnBasedTileToolkit). Then you should be able to delete the map without issue.
Thanks for finding and providing the answer before I got to it, @crossmr
Yeah, I should add a check for this. The abilities in the JungleRaid example map are of the XCOM 2 type, where they can always be used as long as you have remaining actions, but there are better ways of handling this without making other types of AP systems more complicated to implement. I’ll put this on my to-do list to update. For now, here is what you need to do:
In BP_Ability add the following:
In BP_AbilitySystem add the following:
In WBP_AbilityBox add this:
that should hopefully get you the result you want.
Thanks for letting me know of these issues @crossmr. Let me know if you run into any other problems. Because of an imminent deadline I cannot promise to check in every day, but I will at a minimum try to make the time to provide answers every other day.
Hello again.
I am having problems with dead units being referenced by the AI. The unit dies and is removed from map, but when the next Round starts the AI puts the Selected Icon (see photo) on where the unit died, and even moves it (the Selected Icon) around on the map until it gets to where it would attack, then the game freezes there. I think it usually starts happening when I get up to around 12 units in the game.
I see you delay actually removing a dead unit from game to let effects happen and stuff, but for some reason it is never actually be really deleted before the next round.
EDIT: I have narrowed it down to a second Ability I added. It does fine unless I kill the Unit with that ability, then the dead unit is still referenced by AI. At least I know where the issue is, so hopefully I can figure out what is going awry.
EDIT 2: Okay, found the issue. I was using your BP_Ability_Attack as my base to add a new attack ability. There is a problem in Execute Ability in that blueprint where if you have Use Unit Attributes unchecked, and change the value of the local variable Damage, the code is using 2 different Damage values because the code was written to get one of the Damage variables directly from the Owning Unit as shown in picture. So I removed getting Damage from owning unit and replaced with Get Damage and everything is golden.
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_155365_1547137079461_581”}[/ATTACH]
Thanks, Loco
After messing around with that laser ability, I wanted to make sure. The laser ability was a bit complicated because the actual damage and the display of that damage were intertwined in an unusual way. It seems the death animation was triggered by health bar being depleted, and not a health check (this should be changed in my opinion) so even though I had hooked up the damage, the character was still dying because of the visual representation. I wanted some clarification on how the cover system operates. I knew the cover system was included in the grid manager, but I wasn’t sure if that visual representation of the shield was a necessary thing to make sure a unit was in cover or not. Luckily I’ve based all the shooting abilities that I’ve made so far off laser, so I’m okay there for using cover. I’ll have to look at sprint and see what I can take from there to make a new move ability and enable cover. I want my units to have access to cover, but I don’t want them to be able to sprint. My maps won’t be that large, so sprinting probably won’t really be required. That’s still in the testing phase, so I need to move all that cover interaction over to the regular move, or make a copy of sprint that only allows the base move and not the extra move.
-
also I seem to be getting some odd path issues around certain tiles. Any idea what I should check for that? As far as I can tell they’re all lined up and there are no increased cost tiles placed. After more testing, I thought it was a good idea to make a video to illustrate what is going on. The unit seems to be having issues moving to the adjacent tile that is part of the same mesh. It’s not even stepping from one mesh to another. https://youtu.be/h6Hhzav24vo You can see he can move diagonally to the left without issue and further out, but the right squares seem to cause some heavy pathing problems. after showing that i pause the game and highlight the mesh so you can see the problem tiles are on the same mesh
-
is there a way to refresh or update the grid at runtime? I’m having a scenario where doors may be closed. Characters can run up to them, activate a custom ability to open the door, and carry on through. The problem is when the door is changed/removed the grid doesn’t update and doesn’t connect the tiles on either side. This doorway is normally passable with the door starting open.
-
Can I calculate AP usage on a per tile basis? I tried setting my unit to have 6 ap and costing 1 ap per tile, which seemed fine on the first move (he could move 6 tiles) but after moving once, he was then allowed to move 4, and 2 and then 1 tile before finally his turn ended (this is after including the code above to deduct AP points)
Hey, glad you figured it out. Issues like this are generally caused by the animation and gameplay code getting different input. I recommend checking out my tutorial on the Action System where I explain how this works if you have not done so already.
As I explained to Locoweed above, these sorts of issues are avoided by making sure the gameplay code and action system get the same input. The action system is the most unorthodox part of the toolkit, but it has a number of benefits. Decoupling gameplay code from what is animated means that you can simulate several different actions over a single tick and then send a queue of actions to be animated sequentially. This way you do not need to add lots of delays, callback events etc. to handle the flow of the game. With the action system you can run all your gameplay code immediately without waiting and can have the action system take care of handling animating in sequence.
Though it is a bit of a learning curve at first I have found this to be much easier to work with than the alternative. It has the added benefit of keeping a clean distinction between server-side and client-side operation, and eliminates perceived animation lag in multiplayer games by having an animation system that receives action commands from the server, but that animate on each client independently. Check out my video on the action system for a more in-depth explanation.
Making a copy of the sprint ability and removing the code that adds the extra sprint range is what I would recommend.
Hmm, that is odd. Unsure what could be causing this issue. How is your grid manager set up? Have you enabled multi-level grids or TraceForWalls? Are you able to give me the repro steps for this issue?
What tiles can be moved between is defined in the GridEdges TMap in BP_GridManager. Each tile is represented by a key in the TMap and its connected tiles as a nested map of tile indexes and costs. In the case of opening/closing a door I would recommend using the AddEdgeBothWays function in BP_GridManager with the grid indexes of the tiles on either side of the door as input. When closing the door you would rather use RemoveEdgeBothWays. Note that if pathfinding has been calculated before opening the door, the pathfinding will not update automatically when you alter the grid, so you will need to run it again if you want it to take the changes into account.
The move and sprint abilities should have a public variable for this called MoveCostType which you can set to FromPathfindingCost.