Z3 Style Swimming

SubmittedDecember 14, 2016

Featured Screenshot

Author

ZoriaRPG

Download Script Package

Z3StyleSwimming.zip

Description

In 'The Legend of Zelda: Triforce frce of The Gods (Link to the Past)', when you swim, you can press a button to paddle, that makes a chugging noise, and move Link a but further than just pressing a direction button.

This global function replicates this, entirely, and you can modify it to suit your needs.

Script Setup Details

Add the boolean isSwimming, and the constant SwimPaddle to your main script, and assign a value to SwimPaddle from 'Quest->Audio->SFX Data'. THis is the sound that the player will hear when pressing B to paddle.

The demo quest uses sound 26 'Ocean Ambiance', for the purposes of demonstration, and includes a few types of combos on Screen 00km to demonstrate what happens when the player is swimming, or paddling, onto dry land, or onto a solid object.

This script obeys all object solidity, but FFCs that are solid may not act as such with it, so you nay need to fine-tune FFC scripts to be solid if LA_SWIMMING.

Add the function void paddle() to your main script, and add paddle() to your main while loop, before Waitdraw().

If you are not using any other scripts, you can import and compile this, and use it with no further set-up (aside from setting the value of the SwimPaddle sound effects).

Script Contents

import "std.zh"

////////////////////////
/// Z3 Stle Swimming ///
///////////////////////////////////////////////////////
/// Version 14.1 - 22nd May, 2014 ///
/// Script Credits: Avataro, MoscowModder, ZoriaRPG ///
///////////////////////////////////////////////////////
/// Updated code comments on 22nd May, 2014. ///
///////////////////////////////////////////////////////

const int SwimPaddle = 0; //Set to swimming paddle sound.
bool isSwimming; //Establish boolean to determine of Link is swimming.

global script active {
void run() {
while(true) {
paddle(); //This should be before Waitdraw.
Waitdraw();
Waitframe();
}
}
}

void paddle(){

int combo=Screen->ComboT[ComboAt(Link->X+8, Link->Y+12)];
if(combo==CT_WATER || combo==CT_SWIMWARP || combo==CT_DIVEWARP || (combo>=CT_SWIMWARPB && comboDir == DIR_UP //If Link is facing up...
&& Link->Action == LA_SWIMMING //and is swimming...
&& isSwimming == true //combo is a swim combo...
&& Link->InputB //and presses B...
//You can change this to another button, such as L, R, or an Ext button...
//Do not set this to A if you have diving enabled.
&& !Screen->isSolid(Link->X,Link->Y+6) //NW Check Solidity
&& !Screen->isSolid(Link->X+7,Link->Y+6) //N Check Solidity
&& !Screen->isSolid(Link->X+15,Link->Y+6) //NE Check Solidity
)
{
Link->Y -= 2; //The number of TILES (16 pixels each) that Link will move UP, when paddling.
Game->PlaySound(SwimPaddle); //Play the paddling sound set as a constant.
}
else if( Link->Dir == DIR_DOWN //If Link is facing down...
&& Link->Action == LA_SWIMMING //and is swimming...
&& isSwimming == true //combo is a swim combo...
&& Link->InputB //and presses B...
//You can change this to another button, such as L, R, or an Ext button...
//Do not set this to A if you have diving enabled.
&& !Screen->isSolid(Link->X,Link->Y+17) //SW Check Solidity
&& !Screen->isSolid(Link->X+7,Link->Y+17) //S Check Solidity
&& !Screen->isSolid(Link->X+15,Link->Y+17) //SE Check Solidity
)
{
Link->Y += 2; //The number of TILES (16 pixels each) that Link will move DOWN, when paddling.
Game->PlaySound(SwimPaddle); //Play the paddling sound set as a constant.
}
if( Link->Dir == DIR_RIGHT //If Link is facing right....
&& Link->Action == LA_SWIMMING //and is swimming...
&& isSwimming == true //combo is a swim combo...
&& Link->InputB //and presses B...
//You can change this to another button, such as L, R, or an Ext button...
//Do not set this to A if you have diving enabled.
&& !Screen->isSolid(Link->X+17,Link->Y+8) //NE Check Solidity
&& !Screen->isSolid(Link->X+17,Link->Y+15) //SE Check Solidity
)
{
Link->X += 2; //The number of TILES (16 pixels each) that Link will move RIGHT, when paddling.
Game->PlaySound(SwimPaddle); //Play the paddling sound set as a constant.
}
if( Link->Dir == DIR_LEFT //If Link is facing left...
&& Link->Action == LA_SWIMMING //and is swimming...
&& isSwimming == true //combo is a swim combo...
&& Link->InputB //and presses B...
//You can change this to another button, such as L, R, or an Ext button...
//Do not set this to A if you have diving enabled.
&& !Screen->isSolid(Link->X-2,Link->Y+8) //NW Check Solidity
&& !Screen->isSolid(Link->X-2,Link->Y+15) //SW Check Solidity
)
{
Link->X -= 2; //The number of TILES (16 pixels each) that Link will move LEFT, when paddling.
Game->PlaySound(SwimPaddle); //Play the paddling sound set as a constant.
}

if ( Link->Action == LA_SWIMMING && isSwimming == false )
//If Link is NOT swimming...
{
Link->Action = LA_NONE;
//Change Link tile back to normal. This prevents Link from swimming on solid combos.
}

}

This entry has no reviews.

Recent Resources