Jump to content

Photo

Random sword swing and taking damage ext..


  • Please log in to reply
8 replies to this topic

#1 LTTP

LTTP

    LTTP

  • Members
  • Real Name:LTTP
  • Location:A Place Far Far Away

Posted 22 May 2013 - 06:10 AM

EDIT: I CAME ACROSS THIS: http://www.purezc.ne...showtopic=26867
I am still testing it out but if you have another script u'd recommend instead, do let me know!

Don't work for some reason??

 

 

Looking for a script that can in general, let me add multi SFX (Sounds) to X category!

The idea to this is to be random, so Link takes damage and a random getting hurt sound is played out of X possible sounds, as well swinging sword, ext!

:)

Also WHILE I AM HERE Might as well ask:

I see under item options their is an option for pick up sound, but is there an option to add custom USE sound? like adding a sound for items i may have made or changing sounds for items that dont have a custom SFX? Like to keys...
if not a script?


Water walking and swimming (I see sound effect for tall grass, so is there already a way to set it up to tiles?

also to stepping on a title (aka a portal on the ground)


Thanks :)


Edited by LTTP, 22 May 2013 - 08:58 AM.


#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2013 - 11:14 AM

This is one I used.

Set D1 to the first sound effect and D2 to the number of different sound effects. D0 is left unused so you can also use the Item Pickup Message script on that sword.

 

The script is disabled when you use the Lens of Truth because that would make the sound effects run continuously. Go figure.

item script sfx{
    void run(int null, int baseSFX, int numSFX){
        if ( !UsingItem( I_LENS ) )
            Game->PlaySound(baseSFX+Rand(numSFX));
    }
}


#3 Avaro

Avaro

    >w<

  • Members

Posted 22 May 2013 - 11:49 AM

Sorry I'm still a beginner at scripting, as I don't know everything yet, but here's a working script that randomly plays one of 4 different hurt sounds (and if you want another number of sounds, just ask me). If you use this script, be sure to use a blank sound for the default hurt sfx (#19) as that sound will ALWAYS be played when Link takes damage.

const int firstHurtSound = 61; //set this to the number of the first of the 4 custom hurt sounds
int randomHurtSfx; //used by random hurt sound script

global script Active{
    void run(){
        while(true){
            if ( Link->Action == LA_GOTHURTLAND || Link->Action == LA_GOTHURTWATER ){
                if ( randomHurtSfx == 0 ){
                    randomHurtSfx = Rand(1, 4);
                    if ( randomHurtSfx == 1 )
                        Game->PlaySound(firstHurtSound);
                    if ( randomHurtSfx == 2 )
                        Game->PlaySound(firstHurtSound+1);
                    if ( randomHurtSfx == 3 )
                        Game->PlaySound(firstHurtSound+2);
                    if ( randomHurtSfx == 4 )
                        Game->PlaySound(firstHurtSound+3);
                }
            }
            if ( Link->Action != LA_GOTHURTLAND && Link->Action != LA_GOTHURWATER && randomHurtSfx != 0 )
                randomHurtSfx = 0;
            Waitframe();
        }
    }
}

This might not be optimal scripted, but it works.



#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2013 - 12:44 PM

Here's a more efficient (and shorter) version:

const int firstHurtSound = 61; //Set this to the number of the first of the custom hurt sounds
const int lastHurtSound = 64; //Ditto last

global script Active{
    void run(){
        int lastHP = Link->HP;
        while(true){
            if ( Link->HP < lastHP ) //When HP decreases
                Game->PlaySound(Rand(firstHurtSound, lastHurtSound)); //Pick a value between (and including) first and last SFX
                
            lastHP = Link->HP;
            Waitframe();
        }
    }
}


#5 LTTP

LTTP

    LTTP

  • Members
  • Real Name:LTTP
  • Location:A Place Far Far Away

Posted 22 May 2013 - 01:20 PM

I'm going to leave the multi take damage along for now till I find a less annoying sound to use :P
maybe someone has suggestions? (tho I am planning on using a female link instead.. just saying)



#6 LTTP

LTTP

    LTTP

  • Members
  • Real Name:LTTP
  • Location:A Place Far Far Away

Posted 22 May 2013 - 01:22 PM

 

This is one I used.

Set D1 to the first sound effect and D2 to the number of different sound effects. D0 is left unused so you can also use the Item Pickup Message script on that sword.

 

The script is disabled when you use the Lens of Truth because that would make the sound effects run continuously. Go figure.

item script sfx{
    void run(int null, int baseSFX, int numSFX){
        if ( !UsingItem( I_LENS ) )
            Game->PlaySound(baseSFX+Rand(numSFX));
    }
}

Could you add more slots to use?

and I am not 100% sure how to set this to work/set up

EDIT: Sorry double post >_<


Edited by LTTP, 22 May 2013 - 01:24 PM.


#7 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2013 - 03:38 PM

If by more slots you just mean more sound effects, then yes.

 

D1 = The first of your sword sound effects (must all be in a row)

D2 = The number of sword sound effects you have



#8 LTTP

LTTP

    LTTP

  • Members
  • Real Name:LTTP
  • Location:A Place Far Far Away

Posted 22 May 2013 - 03:56 PM

OOK so sounds would have to be for exp: 111, 112, 113!
IC now ty :)
 


Edited by LTTP, 22 May 2013 - 04:01 PM.


#9 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2013 - 10:47 PM

You're welcome! The random hurt sounds should work similarly (except that instead of the number of sounds you specify the last sound).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users