Add the audio
In your enemy scene node tree with the root node selected click the "+" and select "AudioStreamPlayer2D" (or 3D as appropriate) and drag your audio file into the "stream" on the right. Name the node.
Make one of these for each sound.
Add a script
Right click on the enemy root node and click "attach script".
var is_speaking = false
func speak(phrase):
if is_speaking:
return
if phrase == 0:
$Phrase_1.play(0.0)
elif phrase == 1:
$Phrase_2.play(0.0)
# etc
is_speaking = true
You'll need to call the speak
method on whatever criteria you want. You might also want to add a timer node with a signal to reset is_speaking
. Hopefully that puts you on the right lines.
Good luck!