How to set value of AICharacter on begin overlap?

Your assumption that all AIs will have the same “variable” is actually not correct. The game assigns a unique reference to each Actor as it is spawned. So if you spawn 10 Ninjas - one of them probably has the name “Ninja_C08” or whatever.

When you setup the OnComponentBeginOverlap function, the very first pin called “Other Actor” is the thing that touched your collision sphere. This could return the name of any actor though - the player, a bullet you shoot, a physics barrel you kick into it, AI ninja #8 - so the smart thing to do would be to try and Cast this other actor To your AI type - and if that’s successful, then store Other Actor into the variable you talked about. If it fails, ignore that overlap event.