Jump to content

Photo

Saves position and when comes back to screen link comes back to the sa


  • Please log in to reply
4 replies to this topic

#1 TheRock

TheRock

    Go glitches

  • Members

Posted 26 April 2017 - 07:52 PM

Saves position and when comes back to screen link comes back to the same spot. Let me try to explain what I am requesting a little better. When link leaves through a warp it saves his position. When he takes a warp back he then goes back to the same spot that he left the original screen. Hope this makes since.

 

Thanks in advance.



#2 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 26 April 2017 - 10:03 PM

So, basically something like the way Farore's Wind works in OoT? Because I had made a request for that some years ago, the thread is here.



#3 TheRock

TheRock

    Go glitches

  • Members

Posted 26 April 2017 - 11:37 PM

Just like that, but it needs to be a ffc being on that screen and needs to happen automatically. I could try and change the script to make it work, but I'm awful with scripts. 



#4 TheRock

TheRock

    Go glitches

  • Members

Posted 27 April 2017 - 11:13 AM

I took a good look and as far as I can tell the script needs these two things changed: The tile warp will activate the warp. Returning to the screen will activate the warp return of that screen. Does anyone know how to change the code to make it work like this?

Never mind. I got both of those parts to work, now I just have to figure out how to make you warp back to the original screen...


Edited by TheRock, 27 April 2017 - 08:42 PM.


#5 TheRock

TheRock

    Go glitches

  • Members

Posted 27 April 2017 - 10:10 PM

So I got it to work. Here's the script to whoever wants. And thank you Binx for showing me that script!

import "std.zh"
import "ffcscript.zh"
import "stdExtra.zh"
import "string.zh"
const int STEPONME = 98; // this is what sets where you come back. use fall 98 for this
const int WARP = 99; // This will allow you to warp back. use flag 99 for this
const int RESET = 100; // this is so then if someone dies in a battle there is a way to    reset the cycle. use flag 100 for this
int mpCost = 0;
int Checks = 0;


const int SFX_FARORESWINDSET = 59; //Default Whistle Whirlwind
const int SFX_FARORESWINDWARP = 39; //Default Farores Wind

const int CMB_AUTOWARP = 12; //An invisible "Auto Warp A" combo
const int CMB_CSET_WARPPOINT = 2; //The CSet of the above combo
const int CMB_WARPPOINT = 13; //The combo for the warp point
const int WPS_FARORESWINDSET = 13; //The Weapon/Misc sprite for setting the warp point (appears above Link)
const int WPS_FARORESWINDWARP = 81; //The Weapon/Misc sprite for Link's warp animation

//Global array - gets saved across sessions
int fwData[5] = {-1, -1, -1, -1, 0};
const int FWD_DMAP = 0;
const int FWD_SCREEN = 1;
const int FWD_X = 2;
const int FWD_Y = 3;
const int FWD_ACTIVE = 4; //If 1, call set or warp function

global script active{
    void run(){
        int faroresWindTimer = 0;
        Link->Invisible = false;
        


while(true){
            //Implement cooldown for Farore's Wind
            //if ( faroresWindTimer > 0 )
            //    faroresWindTimer--;
            
            //If Farores Wind was called by item script
            //else

 






 if ( fwData[FWD_ACTIVE] != 0 
){
                //No warp point set: set one
                if ( fwData[FWD_DMAP] < 0 
){
                    //Start animation (sprite above Link)
                   // Game->PlaySound(SFX_FARORESWINDSET);
                    lweapon anim = CreateLWeaponAt(LW_SPARKLE, Link->X, Link->Y-16);
                    anim->UseSprite(WPS_FARORESWINDSET);
                    //freezeScreen();
                    
                    //Let it finish
                   // while(anim->isValid())
                      //  WaitNoAction();
                    
                    //Animation done; set warp point
                    //unfreezeScreen();
                    
                    //Store warp point data
                    fwData[FWD_DMAP] = Game->GetCurDMap();
                    fwData[FWD_SCREEN] = Game->GetCurDMapScreen();
                    fwData[FWD_X] = Link->X;
                    fwData[FWD_Y] = Link->Y;
                    fwData[FWD_ACTIVE] = 0;
                    Checks = 1;
                    createWarpPointFFC();
//Waitframe();
                }
                }
                //Warp point set: warp to it
                 if
(ComboFI(ComboAt(CenterLinkX(), CenterLinkY()), WARP)&&Checks == 1
)
{                    
//Start animation (sprite replaces Link)
                   // Game->PlaySound(SFX_FARORESWINDWARP);
                    lweapon anim = CreateLWeaponAt(LW_SPARKLE, Link->X, Link->Y);
                    anim->UseSprite(WPS_FARORESWINDWARP);
                    Link->Invisible = true;
                   freezeScreen();
                    
                   // Let it finish
                    while(anim->isValid())
                       WaitNoAction();
                    
                    //Animation done; warp
                    unfreezeScreen();
                    Link->Invisible = false;
           Screen->SetSideWarp(0, fwData[FWD_SCREEN], fwData[FWD_DMAP], WT_IWARPBLACKOUT);
                    ffc warpFFC = loadUnusedFFC(true);
                    warpFFC->Data = CMB_AUTOWARP;
                    
               //Wait for warp to take place (warp pauses global script), then place Link
                    Waitframe();
                    Link->X = fwData[FWD_X];
                    Link->Y = fwData[FWD_Y];
                    
                    //Un-set warp
                    fwData[FWD_DMAP] = -1;
Checks = 0;
                }
                
               // fwData[FWD_ACTIVE] = 0;
               // faroresWindTimer = 60;

           //}
        
            //THIS REPLACES YOUR NORMAL WAITFRAME()
            //Any other scripts that check screen changes can share this section
            if ( WaitframeCheckScreenChange() ){
                createWarpPointFFC(); //If screen changed, try to create warp point
            }






 //If warp currently active, quit
        if (fwData[FWD_ACTIVE] != 0 )
            return;
    
        //If no warp point and insufficient magic, quit
       //if (fwData[FWD_DMAP] > 0 && Link->MP < mpCost )
         //  return;
        
       // Otherwise if no warp point, pay to make one
      // if ( fwData[FWD_DMAP] > 0 )

//Screen->ComboT[CT_STAIR]||Screen->SetSideWarp->WT_IWARPBLACKOUT
if(ComboFI(ComboAt(CenterLinkX(), CenterLinkY()), STEPONME)&&Checks == 0
)
{
            Link->MP -= mpCost;
        //Game->PlaySound(SFX_FARORESWINDWARP);
        //Then activate
        fwData[FWD_ACTIVE] = 1;
//Checks = 1;
    }

if(ComboFI(ComboAt(CenterLinkX(), CenterLinkY()), RESET)
)
{
fwData[FWD_DMAP] = -1;
Checks = 0;
}

     }   
    }
}

void createWarpPointFFC(){
    if ( Game->GetCurDMap() == fwData[FWD_DMAP] //If on warp point DMap/screen
        && Game->GetCurDMapScreen() == fwData[FWD_SCREEN]
    ){
        ffc warpPointFFC = loadUnusedFFC(false); //Get an unused FFC
        
        if ( !ffcIsBlank(warpPointFFC) ) //If non-blank FFC, quit now
            return;
            
        //Place the FFC
        warpPointFFC->CSet = CMB_CSET_WARPPOINT;
	warpPointFFC->Data = CMB_WARPPOINT;
        warpPointFFC->X = fwData[FWD_X];
        warpPointFFC->Y = fwData[FWD_Y];
    }
}


Edited by TheRock, 27 April 2017 - 10:21 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users