My mistake on that, Actually turns out its the wandering unit that is repeating his turn over and over again.
Abit easier to debug and see what the issue is anyway
Finally got some time to work on my project again for a few hours. I managed to make a Macro that returns an area of indexes based on the size of an object and which tiles it is over. It has a few constraints such as the object needs to be centered on itâs scene component. It also uses the objectâs bounds so it might not be ideal for all objects.
Once I get the blue print cleaned up I will share it maybe someone can make it run better. Or at the very least other people can use it for their projects.
I know it is not super clean but here is the basics of it. It takes the Transform and Bound vector of an object as well as the Grid Manager Ref. Since the bound is a positive number and the registration point is in the middle of that it needs to be divided in half to get the positive and negative value. Subtract that from the location to get the lowest value edge. Multiply the bound size by 2 and divide by the tile size this gives you the number of passes on both x and y. Run it through nested loops. Subtract 1 from the index and multiply that by the tile size add that to the lowest edge. Put it all back into a vector and run the VectorToIndexInterface to get the index. Add it to a temp array and then return the temp array at the end.
It is a lot of basic math nods with connecting wires running everywhere I did my best to use Knots to keep the flow clean. If someone sees a better way to do this I would love to have a look at it. However I know this is something that I think will be very helpful so I am hoping others will find it useful as well.
@: Ok, great that you figured it out! Is it working now or do you still need assistance?
@Anzak: Thatâs really awesome! Iâll try to implement it myself when I have the time and give feedback
Hi I was following Tracey Whiteâs UI Tutorial and ran into some problems at the five minute mark.
I am using a melee Pawn that I renamed Player_2 instead of Tracyâs BallPawn. The timer works on the side but does not display on the widget.
Is there something Iâm missing?
Right now Iâm also trying to create a level select mechanic. Is there a good way to do it with the Advanced Turn Based Tile Toolkit?
Hi
I purchased the toolkit for my class project, and to be honest, this is the most awesome thing Iâve ever bought in the marketplace. Your tutorials are descriptive too. I have some questions regarding to my project using the toolkit. I want the character to have 4 attacking moves (active/passive moves, like in Pokemon) instead of just one move (punching/shooting), will that be possible to implement? And also, can I change the game to player vs player (probably on 1 computer) instead of player vs AI?
Thank you
Hi all,
Suddenly, Unit Parent doesnât not compile anymore.
When I try to compile the blueprint, I suffer an engine crash. This is what I see in the error log:
<ErrorMessage>Assertion failed: ((UObject*)ContainerPtr)->IsA((UClass*)GetOuter()) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.9\Engine\Source\Runtime\CoreUObject\Public\UObject\UnrealType.h] [Line: 308]
âPawn_Anim_BP_Ranged_C_156â is of class âPawn_Anim_BP_Ranged_Câ however property âStructProperty_1890â belongs to class âTRASHCLASS_Pawn_Anim_BP_Parent_179â
</ErrorMessage>
Is somebody there already found and solved above error?
My project is stuck because of this
PS. it happens both with 4.8 and 4.9 UE version. I have added some new pawns but I canât understand why it happen. I guess if the Pawn_Anim_BP_Parent is somehow corrupted.
I decided to try a different tactic and I am an not understanding the edge array I think. When I initialize a platform I set an array of all the tile indexes of the platform. That works perfectly with my macro. Then I deactivate all of the platforms by hiding them and setting all all of the side of the edge area for each tile under it to 0. Then When I active a tile I set all of the edges of the tiles under the platform to 1. This does not seem to have the desired effect. In fact the entire grid is able to be walked on like this. Suggestions on what I am doing wrong?
Just a quick message. Sorry for taking a while to get back to you guys. Iâve had some really busy days. Iâll get to answering all of you tonight after work.
Iâm wondering one thing about the AI. I want the enemy AI to be able to ignore player-units during the path-finding/decision-making process but I canât seem to find a way to implement that properly. Letâs say that all units have a boolean called ignoreDuringPathfinding, and if it is true the AI should pretend like the unit doesnât exist.
Iâve been trying to get an AI controlled Unit to search and attack Units with faction = Enemy
Like a friendly NPC, but even with find tiles in ranges with target faction = Enemy, it still finds units with faction = player
Is there something in the AI Bps that disallows AI attacking Enemy factions?
Ok, I finally have some time to answer. Lets do this
The main problem here is that your melee unit is not actually the player pawn. I believe Get Player Pawn refers to whatever pawn is possessed by a particular player at a particular time. For ATBTT this will get the grid camera and not the current pawn, as the current pawn is not actually possessed. Instead of getting the current player pawn get a reference to ATBTT_Game_Mode and get the current pawn from there. Hopefully that should solve your problem.
I havenât really looked into switching levels, though I know several people have done so with the toolkit already. This is one of those places where I reveal my ignorance of much of UE4. My knowlede is fairly specialized. I can see no reason why switching between maps would be different in ATBTT than in any other UE4 project, though, so any general tutorials you can find on the subject should do the trick. I apologize for not being able to help beyond this.
Very glad to hear that! Various different attacks is absolutely possible to add, and a few users have done so already. It depends a bit on what youâre after, though. Generally attacks are resolved through the bluprints in Unit_Parent; mainly in the Attack Victim and Receive Damage parts of the event graph. There are many different ways to add attacks. In pokemon you would choose different attacks through a menu. If you have such a menu you can modify a variable in the current pawn when you select an attack (maybe an enum that holds various attack names). Then when you run the attack victim code you would add a switch that would resolve the attack differently based on the value of this variable. If you only want basic stuff like elemental damage with resistances this can be baked into receive damage.
****, I thought I had solved this bug The last time this happened it was due to a problem with the animation blueprints. It seems it is still like this from the error message. When you say 4.9 UE do you also mean the very latest version of my toolkit or just UE4? I need to try and narrow this stuff down⌠Iâm not able to replicate it at the moment. Are you using a vanilla version? Terribly sorry for the inconvenience.
Iâm not sure I understand completely what you mean. Let me try to rephrase and see if I understand. You get all the indexes under a platform as per your custom function. That means that you find the bounds of a platform, find what locations it is overlapping and convert those to indexes, right? Then when you hide the platform you make the edges of all those indexes 0. This should render them unwalkable. Then you show the platform and make all the edges 1 again making them walkable? I must not be understanding you correctly. Perhaps you can show me what you mean? Here is an excel mockup of my current understanding. Here is a small grid of 28 tiles with the indexes of the tiles in the middle of each tile and their edge costs in the edge array surrounding these indexes.
If you want to understand how the edge costs are used in pathfinding Iâll give you a quick description. Say if you are a unit on tile 8 that wants to get to tile 8 in the second grid pictured above. To find out if it is possible to move between these the pathfinding first checks the eastern edge of tile 7. If this is 0 it gives up. If it is greater than 0 it checks the western edge of tile 8. If this is 0 again it gives up. If it is 1 it declares it as walkable. If it is greater than 1 it checks if the remaining movement points of the unit are greater than this cost. If so it is considered walkable. In other words the pathfinding checks both the edge of the tile it is leaving and the edge of the tile it is entering to see if they are impassable. It only checks the edge it is entering for difficult terrain.
I hope I have not just made you more confused. Please elaborate on what you are trying to achieve and I will help as best I can.
I need to know what you mean by ignore. Do you want the pathfinding to treat the tiles as empty so that the AI can pass right through them or do you want the AI not to be able to move through these tiles, but simply not be aware of (not attack) the player units on them? For the first you would need to change the pathfinding. For the second you will simply need to modify the AI controller. I could give you some more specific suggestions, but I would like to be sure of what you mean first so I can answer your question correctly.
Yeah, the problem here is that while Find Tiles In Range can be set to search for a specific faction, pathfinding always searches for player units. I have changed this in the coming update so that both functions finds all units of all factions and afterwards chooses what to do with this information. If you change this part of the Search and Add Tile function:
To this:
The AI should start killing one another. The next step would be to have them select the potential targets from the Reachable Pawns Array (from pathfinding) and Pawns in Sight Array (from Find Tiles in Range) based on some other metric than whichever unit has the lowest health.
Here is the modified Make Choice Array function in ATBTT_AI_Controller of the WIP update. It is modified so that it throws out all potential targets that are not player units. Modifications to this function could be made to allow for enemy units that target their own for healing, go berserk and attack each other etc.
I hope that is enough to get you started. What is your desired end result, by the way?
Ok if I am understanding this correctly then it needs to be 0 on both tiles of an edge to make it unwalkable. What I am doing is making all of the highlighted tiles edges 1. Everything around it should be 0. But if it needs to be 0 on both sides that explains since the outer edge is 1 on the area that I have made walkable.
I thought I was understanding what you said but it looks like I am wrong.
Tile area array is all of the tiles under the platform. There is an array for each edge top, bottom, right, and left. When a platform is initialized I do nothing though when it is spawned I have a process check what it should be and hides all but the starting one. When it hides them it goes through the Tile area array and sets the edges for all tiles all edges to 0. When I unhide which I do for the first platform at the start of the game I set all edges for all tiles in the Tile area array to 1. Then I loop through each of the 4 edges and set the 3 edges for that side to 0 for each tile on the edge. Each platform is 4x4 tiles.
As a thought for a debugging feature would be a way to turn on a decal that shows the edge values like the image you put up. Just a thought as I try to noodle through this.
I am wondering if this is an artifact of using children of all the base classes. In this case you can see I am using Tile Game Mode which is a child of BP Grid Manager Game Mode. I am also using Tile Grid Manager which is a child of BP Grid Manager. However I am using the Ref to BP Grid Manager to get to the edge array. The part that is troubling to me is that it seems ok with using the grid size x and grid size y from the same ref and that works correctly so it should not be a case where I have not accessed the correct variable. I did try setting all of the tile edges to 0 for all tiles on begin play in the Tile Grid Manager and that does work but activating a tile does not change itâs values back to 1. Anyway eyes are crossing I am calling it a night will try some more things tomorrow.
Nope, I donât use your latest version. I only get what I need from your updates because I have greatly changed the toolkit for our game purpose.
I use the 1.4 version.
Should I download your latest version and copy/paste only the Animation Blueprints to solve my problem?
The later is what I want to accomplish in my game. If a condition is true (in my case the return value of a function in Unit parent (that seriously needs to be renamed to something better)) for player units, the AI should not to attack the player unit in question. I tried to change it myself but I couldnât figure how to do it in the AI controller.
You misunderstood me. If either edge is 0 it should be unwalkable. Note that this is going to change in the next update when only the edge of the tile you are leaving is ever checked.
If what you want is a platform that is walkable with no other tiles in the game walkable it should be enough to make every edge under the platform 1 and every edge not under the platform 0. This should work for what is currently on the marketplace.
That is a very good idea, and Iâve thought about it before. It is on my list of things to do. For now you can do what I have done. In BP_GridManager when pressing a key of your choice, run the Get Hit Tile and Location and Index function and use the outputted index to get that index from the edge array. Then print all of these edges so you can check them during runtime. Note that which edge is east/north/west/south might not make sense to you. I donât think there is one direction that is more obviously âwestâ in the viewport so it was chosen fairly arbitrarily when I first made the toolkit.
Hmm, I donât really think it should matter. Iâve used child blueprints of both of these myself when making my example game without any issues. The reference to BP_Grid_Manager is set in ATBTT_GameMode by getting all actors of type BP_GridManager (which should include any children) and setting the reference to the first BP_GridManager found (since there should always be only one). I canât be absolutely sure though.
Like I said I would first check that all tiles under the platform have edges of 1 and all outside have edges of 0. Note that you will need to run pathfinding again any time you modify the edge array. Pathfinding only takes into consideration the values of the edges at the moment pathfinding is run.
Ok, good to know it is probably because of the old bug. No, it shouldnât be necessary to do that. Simply copy the part of the event graph of Anim_BP_Parent that has to do with updating idle/walking/running into the event graphs of the child animation blueprints (I canât check right now since Iâm at work, but it should be the top part of the event graph). After you have copied it make sure you get a new reference to the actual event driving these animations and replace the one that reads âcopyâ. I hope that makes sense. If you are still confused Iâll send you a screen grab of the event graph when Iâm home.
You should be able to accomplish what you want by modifying the Make Choice Array function in a similar way to what I have done in the last screenshot of my previous post. Instead of not adding a unit index to the choice array if it is not of the player faction it should refrain from adding it if your custom variable is a certain value. Sorry for the naming conventions, by the way. I was uncertain what would be a sensible naming convention when I first made the toolkit and went with what made sense in the moment. I will prefer keeping the names as they are in the future unless I have a very good reason not to, though, as to not confuse users upgrading the toolkit or following my tutorials.