Jump to content

Photo

[2.55 A99] Portals


  • Please log in to reply
9 replies to this topic

#1 Jenny

Jenny

    braixen

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 08 January 2022 - 11:56 PM

Essentially what I need is a script that moves Link to a specified position when he steps on it, and plays a sound effect when it does. I would just use normal warps, but I need combos to not be reset after warping (unless that's something that could be scripted?)

 

Help is appreciated.

 

 



#2 bigjoe

bigjoe

    Apprentice

  • Members

Posted 09 January 2022 - 12:53 AM

// Simple Onscreen Teleporter
// D0 = SFX to Use
// D1 = Sprite to use for Teleportation animation(if none, this is skipped. 
// Link will remain frozen with sprite animation playing over him if set.)
// Attribytes[5] = Destination X
// Attribytes[6] = Destination Y


combodata script onscreen_warp{

void run(int sfx, int spr){

while(true){

if(Link->X <= this->PosX() + 2 && Link->X >= this->PosX() - 2 && Link->Y <= this->PosY() + 2 && Link->Y >= this->PosY() - 2){

Game->PlaySound(sfx);

if(spr > 0){lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);

Sparkles->UseSprite(spr);
while(Sparkles->isValid()){Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);NoInput();Waitframe();}
}

Link->X = this->Attribytes[5]; Link->Y = this->Attribytes[6];

Game->PlaySound(sfx);

if(spr > 0){lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);

Sparkles->UseSprite(spr);
while(Sparkles->isValid()){Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);NoInput();Waitframe();}
}
}

Waitframe();

}
}
}

zmSbQ5Y.gif

 

Make sure in the Script Settings Combodata scripts run on (your preferred layer) is selected.

 

Edit: Gave it a little buffer of 2 pixels offset to grab you it.
 


Edited by BigJoe, 09 January 2022 - 03:47 AM.

  • Jenny, Jared and Bagu like this

#3 bigjoe

bigjoe

    Apprentice

  • Members

Posted 09 January 2022 - 06:10 AM

I made a secondary version of the script with a better teleport animation:

 

MAvVLzb.gif


  • Jenny and Bagu like this

#4 Jenny

Jenny

    braixen

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 09 January 2022 - 10:35 AM

ty for the help, I seem to be having a problem w/ the script though. I set it so combodata scripts work on the appropriate layer like you said, but when testing it in ZC it makes ZC crash, and I've not a clue why this could be?


  • Bagu likes this

#5 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 09 January 2022 - 11:05 AM

combodata script onscreen_warp
{
    void run(int sfx, int spr)
    {
        while(true){
            if(Link->X <= this->PosX() + 2 && Link->X >= this->PosX() - 2 && Link->Y <= this->PosY() + 2 && Link->Y >= this->PosY() - 2){
                Game->PlaySound(sfx);
                if(spr > 0){
                    lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);
                    Sparkles->UseSprite(spr);
                    while(Sparkles->isValid()){
                        Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);
                        NoInput();
                        Waitframe();
                    }
                }
                Link->X = this->Attribytes[5];
                Link->Y = this->Attribytes[6];
                Game->PlaySound(sfx);
                if(spr > 0){
                    lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);
                    Sparkles->UseSprite(spr);
                    while(Sparkles->isValid()){
                        Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);
                        NoInput();
                        Waitframe();
                    }
                }
            }
            Waitframe();
        }
    }
}

Seems it might be a formation problem
...try it this way


Edited by Bagu, 09 January 2022 - 11:21 AM.


#6 Jenny

Jenny

    braixen

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 09 January 2022 - 12:27 PM

Didn't seem to help, no.


  • Bagu likes this

#7 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 09 January 2022 - 12:42 PM

Well,in this case I leave it to Big Joe, to figure out the issue.



#8 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 09 January 2022 - 01:51 PM

I've tried it on my own, without any issues
...that's odd.

Maybe it's got anything to to with your Quest Script Settings or it's a problem with other script or headers.



#9 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 09 January 2022 - 02:42 PM

Just figured out (in discord conversation) that it's probably a problem with Jenny's quest script settings.
...but instead of changing these settings I decided to provide an FFC version of the script.
(BTW...  bigjoe, it's a really nice script.)

As an FFC it's a bit more flexible (no need to have a list of combos, for various X/Y destinations)
...and the FFC can be placed off-grid.

//
//    FFC VERSION
//
// Will move the Hero sprite from one screen x-/y-position
// to another x-/y-position, if he steps on the FFC's Center.
.
// ...this version checks the distance (in pixel), between the hero's center x-/y-coordinates
// and the center x-/y-coordinates, of the ffc, which is running the script.
//
// The "trigger"-sensivity (distance (in pixel)) is variable
//
//





ffc script portal_cmb
////////////////////////////////
//        >>SET UP<<          //
//                            //
//   D0 = Teleport SFX        //
//   D1 = Teleport GFX Sprite //
//   D2 = X Destination       //
//   D3 = Y Destination       //
//   D4 = Teleport Sensivity  //
//                            //
////////////////////////////////
{
    void run(int sfx, int spr, int x_pos, int y_pos, int sens)
    {
        while(true){
            if(Distance(CenterLinkX(), CenterLinkY(), CenterX(this), CenterY(this)) <= sens){
                Game->PlaySound(sfx);
                if(spr > 0){
                    lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);
                    Sparkles->UseSprite(spr);
                    while(Sparkles->isValid()){
                        Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);
                        NoInput();
                        Waitframe();
                    }
                }
                Link->X = x_pos;
                Link->Y = y_pos;
                Game->PlaySound(sfx);
                if(spr > 0){
                    lweapon Sparkles = CreateLWeaponAt(LW_SPARKLE,Link->X,Link->Y);
                    Sparkles->UseSprite(spr);
                    while(Sparkles->isValid()){
                        Screen->FastTile(6,Link->X,Link->Y, Sparkles->Tile,Sparkles->CSet, OP_OPAQUE);
                        NoInput();
                        Waitframe();
                    }
                }
            }
            Waitframe();
        }
    }
}

Edited by Bagu, 10 January 2022 - 02:34 AM.

  • Jenny and Jared like this

#10 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 10 January 2022 - 01:09 AM

ty for the help, I seem to be having a problem w/ the script though. I set it so combodata scripts work on the appropriate layer like you said, but when testing it in ZC it makes ZC crash, and I've not a clue why this could be?

If anything makes ZC crash, that should be filed as a bug report. Try it in the latest build before reporting, though; we just released Alpha 101 today.


  • Bagu likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users