Jump to content

Photo

HCP Pickup message needed


  • Please log in to reply
2 replies to this topic

#1 Purplemandown

Purplemandown

    The Old Guard

  • Members
  • Real Name:Nathan
  • Location:Milwaukee, WI

Posted 27 November 2010 - 09:27 PM

I need an item script, that along with playing a D0 string, will play:

sound effect 64 if the HCP is the FOURTH HCP, making a new container, and

sound effect 65 if the HCP is the first, second, or third HCP

...can it be done? And if so, could someone do it for me?

Thanks in advance!

#2 MarioBrosCom

MarioBrosCom

    Adept

  • Members
  • Real Name:Stylianos
  • Location:Canada

Posted 30 November 2010 - 07:16 PM

I wrote a script like this a while ago:

This lets you set a custom sound depending on how many heart pieces you have. It also lets you specify which string to show each time you get a heart piece. D0 - D3 are the strings to show when you have 1-4 heart pieces respectively, D4 is the sfx to play for heart pieces 1-3 and D5 is the sfx to play when you get a heart container.

CODE
item script HeartPiece{
//Play a message when activated based on Link's current number of heart
//pieces. D0 = str_0p: string to play when you create a new HC.
// D01-3 = str_1-3p: string to play when Link has 1-3 HP
// D04 = reg_sfx: sfx id to play when HP obtained.
// D05 = full_sfx: sfx id to play when HC obtained.
    void run(int str_0p, int str_1p, int str_2p, int str_3p, int reg_sfx, int full_sfx) {
        //D0: String to play when Link has one Heart Piece
        //D1: String to play when Link has two Heart Pieces
        //D2: String to play when Link has three Heart Pieces
        //D3: String to play when Link gains a new heart container (4p)
        //Modify if your quest doesn't use 4HP = 1HC by changing the number
        //of parameters
        //D4: sfx to play when you pick up a Heart Piece
        //D5: sfx to play when you gain a Heart Container
        //Set D4 or D5 to 0 if you don't want to play a sound.
        int new_HP = (Game->Generic[GEN_HEARTPIECES] + 1) % 4;
        if (reg_sfx > 0 && new_HP != 0) {
            Game->PlaySound(reg_sfx);
        } else if (full_sfx > 0 && new_HP == 0) {
            Game->PlaySound(full_sfx);
        }
        if (new_HP == 0) {
            Screen->Message(str_0p);
        }
        else if (new_HP == 1) {
            Screen->Message(str_1p);
        }
        else if (new_HP == 2) {
            Screen->Message(str_2p);
        }
        else if (new_HP == 3) {
            Screen->Message(str_3p);
        }
    }
}


#3 Purplemandown

Purplemandown

    The Old Guard

  • Members
  • Real Name:Nathan
  • Location:Milwaukee, WI

Posted 30 November 2010 - 08:41 PM

Perfect! Thanks a ton!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users