Jump to content

Photo

Gameboy mini boss warp?


  • Please log in to reply
21 replies to this topic

#16 Joe123

Joe123

    Retired

  • Members

Posted 06 July 2010 - 08:36 AM

This is the point where I admit that I'd forgotten entirely =P
I had the code up in the editor but I hadn't saved it and I closed it by accident. I'll write one up quick-sharp.

EDIT:
Alright! 24 minutes. Not too bad, but I think I could've done better.

CODE
const int CMB_BLANK        = 0; //ID of a transparent, non-zero combo with no combotype
const int SFX_WARPING    = 0; //Sound effect to play when spinning in warp
const int CMB_AUTOWARPA    = 0; //ID of a transparent Autowarp A type combo

const int LI_MINIBOSS    = 0x20;

ffc script B_MiniBossRoom
{
    void run(int bossMIDI, int portal)
    {
        int orig = this->Data;
        this->Data = CMB_BLANK;
        Waitframes(4);
        
        if(Screen->NumNPCs() != 0)
            MiniBossPause(bossMIDI);
        
        Portal(this, orig);
    }
    
    void MiniBossPause(int bossMIDI)
    {
        if(GetLevelItem(Game->GetCurLevel(), LI_MINIBOSS))
        {
            npc n;
            for(int i = Screen->NumNPCs(); i > 0; i--)
            {
                n = Screen->LoadNPC(i);
                n->HP = 0; n->X = 512;
            }
            return;
        }
        
        int MIDI = Game->GetMIDI();
        
        if(bossMIDI > 0)
            Game->PlayMIDI(bossMIDI);
        
        while(Screen->NumNPCs() > 0)
            Waitframe();
        
        if(bossMIDI > 0)
        {
            Game->PlaySound(SFX_SECRET);
            Game->PlayMIDI(MIDI);
        }
        
        SetLevelItem(Game->GetCurLevel(), LI_MINIBOSS, true);
    }
    
    void Portal(ffc portal, int orig)
    {
        if(!GetLevelItem(Game->GetCurLevel(), LI_MINIBOSS))
            return;
        
        while(LinkCollision(portal))
            Waitframe();
        
        portal->Data = orig;
        
        while(!LinkCollision(portal))
            Waitframe();
        
        Game->PlaySound(SFX_WARPING);
        Link->Dir = DIR_DOWN;
        
        for(int i = 6; i > 0; i--)
        {
            for(int j = 3; j >= 0; j--)
            {
                Link->Dir = SpinDir(j);
                WaitNoAction(i);
            }
        }
        
        portal->Data = CMB_AUTOWARPA;
    }
}

OK!
So what you do is...

Set the three constants at the top of the screen.
Then you put the script on the screen with the miniboss, and on the first screen of the dungeon. You can't have any enemies on the first dungeon screen. Give the ffc with the script the graphic of the portal, put it where you want the portal to appear and give it the 'Run Script at Screen Init.' flag. Set the sidewarp A to be where the portal should warp you (so between the two screens). If you want the screen midi in the miniboss room to change to a 'fight' midi, put the midi's ID as D0 for the script.

And that's it!

Edited by Joe123, 26 July 2010 - 05:01 AM.


#17 Lemmy Koopa

Lemmy Koopa

    We are the champions

  • Members
  • Location:Ohio

Posted 06 July 2010 - 11:50 AM

Getting undeclared errors
IPB Image

#18 Joe123

Joe123

    Retired

  • Members

Posted 06 July 2010 - 12:45 PM

I edited the post above.

#19 Lemmy Koopa

Lemmy Koopa

    We are the champions

  • Members
  • Location:Ohio

Posted 06 July 2010 - 01:53 PM

is LA_FROZEN supposed to freeze link, cause he can still move.
Other than that it's great.

Edit: Fixed it myself, thanks a ton for scripting me this.

Edited by Hot Water Music man, 06 July 2010 - 02:04 PM.


#20 Joe123

Joe123

    Retired

  • Members

Posted 06 July 2010 - 02:06 PM

OK, edited the post again.

#21 Kyle

Kyle

    Initiate

  • Members
  • Real Name:Kyle
  • Location:CA

Posted 02 February 2013 - 12:45 PM

I can't figure out how to make the sidewarp, arguments, and consts in the script work.

#22 Schwa

Schwa

    Enjoy the Moment more. This strengthens Imagination.

  • Members
  • Real Name:Hunter S.
  • Location:Redmond Subspace (I had a Potion)

Posted 02 February 2013 - 03:36 PM

CONST isn't a zscript command. You use it to declare a "constant". Constants are like variables, except they never change no matter what. Variables you can change whenever and however you want them to. Constants are hardcoded once you delcare them.

The CONST values in std.ZH are there just so you can write out a bunch of code words that make more sense to you, the human, while writing your script. Writing "Game->PlaySound(SFX_ROCK);" is absolutely no different than writing "Game->PlaySound(51);". No different whatsoever. One's just easier to remember.

As for your issues with sidewarp, you will need to be more specific. What are you trying to make your script do? Either way sidewarp is a tricky one for me too, so just be patient and let's work through this.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users