How to keep data in scope with this attack programming?

Hi everyone,

I’m trying to make an X-Com 2-like attack system, where the game displays all valid targets as icons and waits for the player to click one before continuing the execution flow.

image

I wanted all of the functionality to exist in a single blueprint, but I can’t find a way to make the event graph hold the critical Target/Hit Chance data before executing the “Perform Attack” event.

Delays, gates, variables, etc. just won’t keep the Target/Hit Chance arrays in scope. I’ve read that infinite loop are not advisable, either.

Separately from this, each icon on the target selector is dynamically populated in a widget grid panel. For now, each icon is a button. How do I dynamically return the “column” or value of the grid panel item to the event graph?

Thank in advance for your time!!

This logic seems to fit best on the actual Unit, since its what the unit can see/hit.

I’m making a similar game, and i have an ActorComponent that handles vision, since i know what the unit can see i can calculate what it can hit.

The widget can just bind to the ‘SelectedUnit’ and get the info from the component