Oh dear, not more shrill, screaming child Link.
const int MAX_LINK_VOICES = 15;
int LinkVoices[16]; //GLobal array to hold the voices.
//Adds a voice to the array using the init script.
void AddLinkVoice(int sfx){
LinkVoices[0]++;
if (!( GetLinkVoices() > MAX_LINK_VOICES ) ) {
LinkVoices[GetLinkVoices()] = sfx;
}
else {
int _____err[]="Too many voices set to LinkVoices[]. The maximum number of voices is: ";
TraceS(_____err); TraceMAX_LINK_VOICES); TraceNL();
}
}
//Accessor to get the number of voices used.
int GetLinkVoices(){ return LinkVoices[0]; }
global script Init{
void run(){
AddLinkVoice(65); //Change these numbers to the SFX numbers that you want to use.
AddLinkVoice(66); //Add additional calls to add more voices, max 15 voices.
AddLinkVoice(67);
AddLinkVoice(68);
//AddLinkVoice(69);
//AddLinkVoice(70);
//AddLinkVoice(71);
//AddLinkVoice(72);
//AddLinkVoice(73);
//AddLinkVoice(74);
//AddLinkVoice(75);
//AddLinkVoice(76);
//AddLinkVoice(77);
//AddLinkVoice(78);
//AddLinkVoice(79);
}
}
item script SwordSFX{
void run(){
Game->PlaySound( LinkVoices[ Rand(1,GetLinkVoices()) ] );
}
}
Edited by ZoriaRPG, 31 July 2017 - 11:53 PM.