Originally posted by Domsndom
View Post
So there are a few parts to this. First we need to display the chess board style tile names. First, here is the function for displaying the tile names in a set range:

You can see that I have hardcoded the integer to letter conversion here. Might be a cleaner way to do this in blueprints, but it is functional. The ClearChatText function at the start simply loops over and deletes the text objects in the ChatTextObjects array, then clears the array.

Next I added some code in the Player Controller for receiving input from the chat and converting it to an appropriate tile index. The tile index here will not be absolute, but relative to the source index. This function needs to receive input in the [letter,number] format. I have not added checks to ensure this, so this needs to be done.

The SelectTileFromChatInput function is defined in the Grid Manager and looks as follows:

The GetLetterAlphabetIndex being another hardcoded function, looking like so:

The Player Controller passes along the index into the current active ability using a new custom interface. The interface contains a single function (The ReceiveDamageInput function you see above).
I've created a new ability, a duplicate of BP_Ability_Move. I add my new interface to this class. When activated I spawn the input indicators on the tiles:

Note that you should probably rather do this as an action so that it is appropriately queued, but this explanation is long enough as it is, so I'm keeping it simple here.
I implement the ReceiveChatInput interface function like so:

If you don't understand why I'm multiplying by 1000 here, see my tutorial video on grid indexing.
Other than that the ability is the same of BP_Ability_Move, except a small hack I added. I set the action points of the active unit to 0 as part of ServerInteract. This is just so that the turn automatically ends after the unit has used the ability. This might not how you want it to be, but it works for demonstration purpose so that you don't have to click EndTurn after each input.
Lastly we need some way to enter the input. I'm not adding any Twitch integration for this example, so I'm using a simple editable textbox widget, which should serve well enough as a stand in. Here I've just thrown it haphazardly onto WBP_ATBTT:

It implements the following event:

Ok, I think that should be all of it. Hope I didn't miss anything. Some of it is a bit hacky, there might be unforseen bugs and whatnot, but this should be a good enough starting point, I think. Let me know if you get it working. Here is a gif of it in action:

Hope this is close to what you were after

Comment