Hey, you could create a structure (New > Blueprint > Structure) that contains all the data you need to check to see if an action is valid to perform (so define just one generic structure that contains the data required to cover all actions (range, angle, etc.) and even if for example the action can’t be used at range just fill that particular variable of the structure with eg. 0).
Then create an array of that structure (the “actions array”) with one element for each possible action, and populate each element with the data required to define that action.
Then create a boolean array the same length as your actions array (the index of both the action array and the boolean array will refer to the same action (bool_array will refer to actions_array), and initialise all elements in the bool array to true (the elements in the bool array will be set false if an action fails a validity check).
Then in the code just run a loop on your actions array. First thing inside the loop save the current loop index (action array index). Then run your code checking each environmental condition (eg. range, angle, health etc.) against the data held in your actions array for the current index. If any of the checks calculate the action is not valid set bool_array[current_loop_index] = false, and immediately drop out of the current iteration of the loop.
Once you’ve looped for all the actions in your action array you should be left with the boolean array with elements true for each action that passed all tests, and false for all the other actions. To choose one of the valid actions at random, you could maybe create an int array that contains the index of all actions that passed, then run a get random number between 0 to int_array_len…