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.