Once the Array is created, you can then do something similar to his Make Choice Array Function where you would pass in the ‘Consumable Array’ instead of the Reachable Pawn Array.
Hope this helps
Edit:
You will want to Clear the ‘Consumable Array’ before looping through all of the actors found, because you wouldn’t want it to add to what is already in it from the previous pawns turn, only on the current pawns turn.
Okay done some tweaking now, could you look over it please?
Right now AI still doesnt move to resources if they are closer but im guessing I havent added that functionality in the event graph yet/correctly.
Instead of moving to the player, one of my AI punched the air ?
Just to add to what I posted before; You will want to Clear the Resource Array before looping through all of the actors found, because you wouldn’t want it to add to what is already in it from the previous pawns turn, only on the current pawns turn.
I think the issue you are having here is that you are also using the Make Choice Array in the wrong context and it is trying to attack the Resource Index tile Instead of a Pawn (which it was intended for). The Branch check for ‘Is the best target pawn in attack range?’ will always be True and it will always move to it and attempt to attack.
You need to include your own logic; Checking first if the lowest Resource Index is less than the ‘Pawn with Lowest Health from Choice Array’ Index. If True, move to the Resource Index, if False, connect to the Branch for ‘Is the best target pawn in attack range?’.
What would you say the best way to work out the lowest Resource Index is?
Making a similar function to Get Pawn with Lowest Health from Choice Array
or manipulation the ResourceArray?
@: ‘Min of Int Array’ will get you the lowest value of an Array.
I would highly suggest watching 's tutorial videos, most notably the ATBTT Blueprint Tutorial. It may be long, but you will definitely learn a lot more about the toolkit in a much faster pace than relying on replies from the Forum. Should help you get a better grasp on Blueprinting as well.
Cheers, I have tried it several times before in chunks when i needed specific things.
But yes your right I really need to sit down and try to get a general better grasp of the kit.
One final question though as im still experiment with AI settings, I would use what you suggested in terms of.
ResourceArray- Min Of Int Array - IF - Index of Min Value < Get Pawn with Lowest Health?
If you are actually trying to make the AI go for the Resource Tile instead of attack the pawn/unit with the lowest health, you probably want to do something along the lines of this;
Hey, thanks a lot ! While I’ve slept you’ve provided exeptional support, and pretty much exactly the same way as I would have suggested (isnotbad ). Work is crazy this week, so that you stepped in to relieve me is highly appreciated
, like suggested I would very much recommend watching all the tutorials. This will give you a much better understanding of the toolkit, which will in turn make it much easier for me to help you out. 's solution is clever and should achieve much of what you are looking for. If there are no unexpected issues (which there ofter are), this is what the code will do:
The AI determines the unit in range with the lowest health as normal
It looks at all tiles in sight and sees if any of them has a resource tile on it (you can omit this if you do not require the unit to have line of sight. If so you should directly check the CanMoveToArray on the index of each ResourceTile actor)
The AI checks if any of these tiles can be moved to (here you should also check the pawn array to see that there is not already a unit standing on it)
It then finds the closest of these tile - if this closest tile is closer than the player unit in reach with the lowest health move to it (note that this means the unit will move to a resource tile even if there is a player unit closer to it, as long as that unit is not the one with the lowest health within reach)
Is this what you’re after, or were you thinking of something differently? Sorry that I can’t really test this out myself, but work is absolutely bonkers all week, so I can only take 10 minutes to answer comments here and there until next week.
Good news! After a short testrun it seems that the toolkit runs just fine in UE4.9. There is one error that appears in the log because the engine no longer seems to like me changing the visibility of both decals and static meshes in the same node, but this does not have any effect on how the toolkit works. As such I’m reluctant to update until I’m finished with my next major update. I know it has taken quite a long time, but I’ve been on vacation for quite a while. It will be the largest update I’ve made until now by far, so stay tuned
Oh and speaking of my new custom function; I switched Decals off and Static Mesh Components are still going beyond the bounds of the custom grid even when the grid exceeds the viewport for all markers (Hover/Attack/Movement/Etc)…
I will probably end up using my own path trace that excludes the bounds beyond the indexes of visible tiles, but if you are fixing this in the next update I will hold off
That’s an AoE flame effect I’ guessing? Looks neat! That issue should disappear with the next update. I’ve added a part to Find Tiles In Range that checks if it is possible to move to a tile from any angle. If not it will not be counted as visible.
That was just playing around with my spells making sure that the direction ranges I included in the spell/ability would display the correct attack tiles. ie: NW=3, NE=2, E=2, SE=3, SW=2, W=2
Intention being that I want to be able to set any range in any direction with a ‘Fill’ Range for each. That way I can make any combination of spells and attack patterns relevant to that spell. (Cone/Straight Line/Star/Wall/Etc)
Finally home and got a chance to try this out; Implemented and working as expected.
For those not yet familiar with this asset; I am using my own variation of the function is referring to, but if you need to know where it is before he puts out the patch… it is inside the BP_Grid_Manager and either in the function ‘Find Visible Pawns Step 2’ or ‘Find Tiles In Range Step 2’ if you are not using ‘Check Visibility’ for ‘Find Tiles In Range’ check.
Also: To create a function like ‘Is Tile Passable?’ without having to run an execution line through it, you will need to make sure and select the ‘Pure’ option in the function defaults.
Any chance in the next update you can also abstract the Tiles in Range Array from the ‘Get Indexes in Range’ and including a local Variable for the ranges that gets cleared and then output to the Find Tiles in Range function? Currently using it to get the range from the current hover tile and set my spell markers, but unfortunately it clears the ‘Tiles in Range Array’ on every lookup. So if it was to output the Range Array instead, I could just use that.
Trying not to touch the Grid Manager as much as possible, and also re-use the functions that you include in it. The deeper I get the more I find little things like this and have to either adjust or make my own functions.
Hit me up on IM if you have any questions or want me to provide any examples of how/what I am trying to do here and I will be happy to assist!
Edit: Changed the function to look like this;
(Using a Local temporary ‘Struct_Range’ in Get Indexes In Range function)
Working for the interim, but would definitely prefer it be in there by default if possible.
Sounds reasonable! I’ll look into it at the next opportunity, and will probably include it in the update. Let me know of any other minor (or major) annoyances you might encounter
About making a cone skill, I’ve actually made it by using a double for each loop with a multisphere trace array.
I first get all units by filling the array (multisphere trace should ignore any static mesh, self, and all unnecessary hits) and then apply receive damage event to all of them.
I started with some line/sphere tracing but it was pretty heavy lifting when all I really needed to do was set indexes based on grid size and direction. (Quite a bit more math to it then that, but looping through Integers is so much more efficient than line tracing imho)
May still use some line tracing to change the attack tile indexes if the attack starts on the Unit, but that will happen a bit later