Making multiple sounds for swinging sword
#1
Posted 12 March 2007 - 09:39 PM
A good example of this is in the origional Game Boy games, where Link had (I think) 4 different sounds for him using his sword. Each sound played randomly when he swung his sword.
Sorry if this is confusing, but if it is possible to do this, I would like to put it in my quest.
#2
Posted 13 March 2007 - 09:02 AM
When you copy it into the TXT file, be sure to replace the underscores with spaces. Also, replace 1? with the number of the first SFX, 2? with the 2nd, 3? with the 3rd, and 4? with the fourth. Sorry about making you have to edit it, but because it's an item script there is no other way to customize the sfx it plays.
_COMPAREV gd0,0
_GOTOTRUE SND1
_COMPAREV gd0,1
_GOTOTRUE SND2
_COMPAREV gd0,2
_GOTOTRUE SND3
_COMPAREV gd0,3
_GOTOTRUE SND4
_COMPAREV gd0,4
_GOTOTRUE RESET
SND1 PLAYSOUNDV 1?
_GOTO END
SND2 PLAYSOUNDV 2?
_GOTO END
SND3 PLAYSOUNDV 3?
_GOTO END
SND4 PLAYSOUNDV 4?
_GOTO END
RESET SETV gd0,0
_GOTO END
END ADDV gd0,1
_QUIT
#3
Posted 13 March 2007 - 09:02 AM
item script SFX
{
void run()
{
int RandomNum = Floor(Rand(1) * 4);
if (RandomNum == 0.0)
{
Game->PlaySound(30);
}
else if (RandomNum == 1.0)
{
Game->PlaySound(60);
}
else if (RandomNum == 2.0)
{
Game->PlaySound(61);
}
else if (RandomNum == 3.0)
{
Game->PlaySound(62);
}
}
}
That SHOULD work. Save it as a *.z file (When saving in Notepad, type the name of the file, then ".z"), and import it into ZC. Compile it, set SFX 60, 61, and 62 to the SFX you wish to use.
Edit: Oh darn, Revfan got it before me. But MY version requires no editing at all.
Edited by Matthew, 13 March 2007 - 11:33 AM.
#4
Posted 13 March 2007 - 09:56 AM
#5
Posted 13 March 2007 - 11:33 AM
Yes it does, 'cause you used brackets instead of parentheses in your function calls.
Huh? *checks*
Oh darn, you're right. But I could've SWORN I had used brackets for PlaySound.... Oh well.
Edit: And please, fill me in on why brackets and parentheses have to be used differently for different functions.
Edited by Matthew, 13 March 2007 - 11:34 AM.
#6
Posted 13 March 2007 - 12:05 PM
#7
Posted 30 May 2007 - 01:08 AM
#8
Posted 30 May 2007 - 09:21 AM
Any topic over 2 months of age is considered to be dead. If you post in it to revive it, you're gravedigging, and you'll be warned for a minor infraction. The topic will almost certainly be closed. There are 2 exceptions to this rule.
1. A pinned topic is never considered dead.
2. Gravedigging does not apply to Quest Project Forums.
Still quite useful though. We should link to the topic in one of the pinned topics.
#9
Posted 31 May 2007 - 07:58 PM
Will the script work if I just import it, like, at any random place?
EDIT: Oh yea, ITEM SCRIPT, heh, my bad.
Edited by Majora's Wrath, 31 May 2007 - 07:58 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users