Jump to content

Photo

"play music when..." script


  • Please log in to reply
5 replies to this topic

#1 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 28 August 2011 - 09:19 PM

I don't know how exactly to word it's function. But I want boss music. And I want it to revert to the normal Dmap music when the boss is defeated. Something like:
CODE

game->playmidi=0;//midi number
if enemy=0, then playmidi (false)

But I'm sure that's not all to it. Or that enemy=0 is anything at all. So I want it so that when Link enters boss screen, midi changes to the number of the boss theme midi. and when the boss is dead, the midi changes back to dmap midi. And that a boss never comes back. But I can do that third part without scripts. icon_razz.gif

#2 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 29 August 2011 - 11:36 AM

Instead, why don't you select the boss music as the room MIDI, then have an Enemy > Secret
that turn the floor into warp tiles, which send you to an identical room without the Boss Music.
That's what I did.

#3 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 29 August 2011 - 07:42 PM

well I was hoping for it to function without old 2.10 and below tricks. And can't warps triggered like that cause a few problems? It's 2.5! and scripts are awesome! And if I get one for this, I'll have 5 in use!

#4 Shane

Shane

    💙

  • Moderators
  • Pronouns:He / Him
  • Location:South Australia

Posted 29 August 2011 - 10:06 PM

QUOTE(The Dancing Dragon @ Aug 30 2011, 10:12 AM) View Post

well I was hoping for it to function without old 2.10 and below tricks. And can't warps triggered like that cause a few problems? It's 2.5! and scripts are awesome! And if I get one for this, I'll have 5 in use!


C'mon what Cukeman said is a better way, it's what I'm doing in my 2.5 quest. icon_shrug.gif You know 2.5 is not all about scripts.
If you really do want a script just to spare a screen good luck. Here is my Dmap set up:

1. Overworld
2. Dungeon 1
4. Dungeon 2
5. Dungeon 3
6. Dungeon 4
7. Dungeon 5
8. Dungeon 6
9. Dungeon 7
10. Dungeon 8
11. Dungeon 9
12. Bosses (use room MIDI)

Edited by Midnight_King, 29 August 2011 - 10:09 PM.


#5 Darkhogg

Darkhogg

    Initiate

  • Members
  • Location:Madrid

Posted 30 August 2011 - 06:54 AM

Just wrote this:

CODE
ffc script BossMusic {
    void run ( int bossMidi ) {
        // Wait until there is at least one enemy
        // NOTE: This seems to be necessary for technical reasons. No harm is done.
        while ( Screen->NumNPCs() == 0 ) {
            Waitframe();
        }

        // Store the current MIDI number
        int origMidi = Game->GetMIDI();

        // Play the specified MIDI
        Game->PlayMIDI( bossMidi );

        // Idle until all enemies have been killed
        while ( Screen->NumNPCs() > 0 ) {
            Waitframe();
        }

        // Revert to the original MIDI
        Game->PlayMIDI( origMidi );
    }
}


Setup an FFC with this script, and set D0 to the MIDI you want as the boss music. I just tested it, and seems to work fine. If no enemy ever appears, the script will idle forever.
Hope this works for you.

#6 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 30 August 2011 - 05:21 PM

Hmm. I should try that. But I also found that the GB miniboss portal script also does this. But I don't know if I want a portal to the boss room, so I'll use your script too, darkhogg


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users