pzsz So I made a really small project with animation states that has an idle and attack state. And in the attack state, there's 3 different attack animations that get randomly picked.
Is this something you were looking for? It's controlled by a simple script that picks the random attack every time you hit the spacebar for attack.
One thing to note is that, when using animations state machines, the animation finished signal does not get triggered, so in order to "simulate" a finished animation, I added a function call key at the end of the animation in the animation player.
Have a look and let us know if something similar to this is what you are looking for?
The best way would be to just get a list from the used transition inputs, but I couldn't find that the transition node has a method for returning the list, so I had to create an Array and list the animations instead.
Update: So I had to add each animation in each transition input (as you can see in the project), but you want to add those inputs programmatically? Or did you mean just selecting the animation for playing? Just to clarify what you are after.