[SUPPORT] Advanced Turn Based Tile Toolkit

First you’ll need to add the items to the grid. You can do this in the BeginPlay event of your potion (take a look at BP_GA_Item for an example of how). Next you need to be able to interact with the item. The GridObject system is based on the actors implementing the BPI_Interact interface, so have your potion implement this interface. After this you can implement the EventInteract event for the potion, where you want to call your healing code from.

If you call the InteractWithObjects function in BP_GridManager with the appropriate GridIndex as input you will now call EventInteract for your potion and any other actor added to GridObjects for that tile. Now we need to make it so it is called when a unit moves onto the potion. The toolkit is set up by default so that when a unit ends its movement it calls the OnUnitEndMovementSimulate EventDispatcher in BP_GridManager. However, this event does nothing by default. We want to bind an InteractWithObjects function to when this happens. Check out the event graph of BP_GridManager_2D to see how this is done.

This is all that needs to be done for the gameplay side of things. However, making this fit well into the action queue of the action system is a bit more tricky. If you simply queue an action to display your healing as part of your InteractWithObjects event then it will trigger before movement is animated (since SimulateMovement, which triggers the event dispatcher and eventually your heal action is called before the Move action is queued in BP_Unit).

There are a few ways to get around this. BP_Unit_2D_Hero queues each step of its movement as a separate action, which is how it is solved for this map. The same is true for BP_Unit_Anim_Ex, though it needs some slight tweaking if you want it to interact the same way with interrupted actions. If you want a game with lots of different kinds of interrupted actions this might be the way to go. If you do not need such a flexible setup you can instead set it up so that the Move action is queued at a custom index so that it triggers before your Heal action. There are other ways as well using the Interrupt Queue type.

Ok, hope I didn’t scare you off with that last bit. Follow my instructions above and let me know if you get stuck and I’ll help you further along.

You’re welcome :slight_smile: