Jump to content

Photo

Link Sword SFX


  • Please log in to reply
4 replies to this topic

#1 Zagut

Zagut

    Experienced Forumer

  • Members
  • Location:Somewhere in the universe.

Posted 26 July 2017 - 02:11 PM

I'm currently building a quest, and I would like an Item Script for it.                                                   The item randomly plays 1 out of 4 different Sounds each time it's used.

The script would be attached to Sword Items so you can hear Link vocals while he swings his Sword.

Thanks!



#2 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 July 2017 - 02:14 PM

I think that's here

 

http://www.purezc.ne...ic=38391&page=1



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 July 2017 - 04:43 AM

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.

  • Anthus and Zagut like this

#4 Zagut

Zagut

    Experienced Forumer

  • Members
  • Location:Somewhere in the universe.

Posted 31 July 2017 - 05:06 PM

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{
	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()) ] );
	}
}

 

Script doesn't seem to be working for some reason.

The Compiler says there is a syntax error in line 22 of code.

Quote: Compiler: LINE 22: Syntax error, unexpected identifier, on token AddLinkVoice TMP.

Could it be because the version of ZQuest I'm using is 2.5.1?



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 31 July 2017 - 11:54 PM

Script doesn't seem to be working for some reason.
The Compiler says there is a syntax error in line 22 of code.
Quote: Compiler: LINE 22: Syntax error, unexpected identifier, on token AddLinkVoice TMP.
Could it be because the version of ZQuest I'm using is 2.5.1?


Fixed, above.
  • Zagut likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users