Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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{
- 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);
- }
- item script SwordSFX{
- void run(){
- Game->PlaySound( LinkVoices[ Rand(1,GetLinkVoices()) ] );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement