Jump to content

Photo

Making multiple sounds for swinging sword


  • Please log in to reply
8 replies to this topic

#1 Blue Link 2007

Blue Link 2007

    Doyen(ne)

  • Members

Posted 12 March 2007 - 09:39 PM

I really dont know how to describe this in words, but this is what I hope to have. I want somebody to come up with a script that makes Link have more than one sound effect play when he swings his sword, and all of them playing in a random order.

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 Revfan9

Revfan9

    Hero of Time

  • Banned
  • Real Name:Dr. Pajamas
  • Location:In front of a screen

Posted 13 March 2007 - 09:02 AM

Hmm...

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 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

  • Members
  • Real Name:Matthew
  • Location:Static Void Kingdom

Posted 13 March 2007 - 09:02 AM

Basically, you'd just need a script that randomizes a number, and, depending on that number, makes different sounds. I'll whip you up one real quick-like... Done.

CODE
import "std.zh"
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. icon_wink.gif

Edit: Oh darn, Revfan got it before me. But MY version requires no editing at all. icon_wink.gif

Edited by Matthew, 13 March 2007 - 11:33 AM.


#4 Saffith

Saffith

    IPv7 user

  • Members

Posted 13 March 2007 - 09:56 AM

Yes it does, 'cause you used brackets instead of parentheses in your function calls. icon_razz.gif

#5 Nimono

Nimono

    Ultra Miyoa Extraordinaire!

  • Members
  • Real Name:Matthew
  • Location:Static Void Kingdom

Posted 13 March 2007 - 11:33 AM

QUOTE(Saffith @ Mar 13 2007, 10:56 AM) View Post

Yes it does, 'cause you used brackets instead of parentheses in your function calls. icon_razz.gif

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 Saffith

Saffith

    IPv7 user

  • Members

Posted 13 March 2007 - 12:05 PM

If something uses square brackets, it's not a function at all, but an array. An array is basically a group of variables that are stored together and accessed using the same name.

#7 Lemmy Koopa

Lemmy Koopa

    We are the champions

  • Members
  • Location:Ohio

Posted 30 May 2007 - 01:08 AM

I've been kind of wanting this feature. So yeah nice job.

#8 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 30 May 2007 - 09:21 AM

HWMM, the gravedigging length is two months.
QUOTE(Forum Rules)
C. Gravedigging
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.
You can read those Here.

Still quite useful though. We should link to the topic in one of the pinned topics.

#9 Majora

Majora

    Unironic Marxist-Leninist

  • Members

Posted 31 May 2007 - 07:58 PM

This is regarding the topic:

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