Code:
void createNewSnd(STRING* sndStr, int maxNmbr) {
	STRING* tempStr = str_create("");
	int randNum = integer(random(maxNmbr)+1);
	
	str_cpy(tempStr, sndStr);
	str_cat(tempStr, "_");
	str_cat(tempStr, str_for_int(NULL, randNum));
	str_cat(tempStr, ".wav");
	
	SOUND* tempSnd = snd_create(tempStr);
	// play the sound
	var sndHandle = snd_play(tempSnd, 100, 0);
	// wait until finished
	while (snd_playing(sndHandle)) { wait(1); }
	
	// remove the sound
	ptr_remove(sndHandle);
}



you have all your sounds named something like "attack_n.wav", where n is an number from 1 - unlimited.

you call the function like:

Code:
createNewSnd("attack", 5);



And it will get you a random sound chosen from attack_1 .. attack_5.

Tested and works (implemented it in my own game)!

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/