Ok nevermind, you don’t even need C++. Made the same thing in blueprint.
Doesn’t have the safety checks of the C++ one though. I’m not sure if you can do that in BP.