Jump to content

Photo

Bottomless Pits & Lava

Global FFC

  • This topic is locked This topic is locked
54 replies to this topic

#16 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 26 April 2013 - 08:55 PM

Are they animated?

#17 Aevin

Aevin

    Lucas, the Reluctant

  • Administrators
  • Gender:Male
  • Location:Oregon

Posted 26 April 2013 - 09:02 PM

They are now, but there's no difference.

#18 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 26 April 2013 - 09:38 PM

PM it to me.

#19 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 27 April 2013 - 11:45 AM

Looks like a curly brace was added somehow. :/
I fixed the script. Should work fine now.

#20 Aevin

Aevin

    Lucas, the Reluctant

  • Administrators
  • Gender:Male
  • Location:Oregon

Posted 27 April 2013 - 01:56 PM

Yup, it works perfectly. Thanks a bunch!

For what it's worth, the process of troubleshooting this has made me a lot more comfortable with how global scripts are organized.

#21 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 27 April 2013 - 02:51 PM

That is good, just to be clear this is entirely my fault for not catching the curly brace in the wrong place bug that appeared when I fixed the indentation.

#22 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 27 April 2013 - 03:50 PM

Why do the combos need a script combo type AND flag? That way I can't have the no push block flag and the no ground enemies type/flag at the same time on pit and lava combos..

Besides that, great script!

#23 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 27 April 2013 - 04:33 PM

Just to be clear DO NOT change CT_HOLELAVA it's only there to make reading it easier.
it uses both because ground enemies shouldn't be able to move over Pits and Lava. ;)

#24 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 27 April 2013 - 04:48 PM

Oh ok, I was using an old version of the script, where the combo type used by this script was the script combo type 1.
Updated my hole and lava script. it's better now ;D

#25 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Gender:Male
  • Location:Minas Gerais, Brazil

Posted 29 April 2013 - 03:59 PM

LordVolcanon, can you check if I put scripts in the correct order, please? I want to use the Bottomless Pits & Lava script together with the Moving Platform script, but it is not working properly... OR these two scripts are not 100% compatible yet?

import "std.zh"
import "string.zh"
import "ffcscript.zh"
// ---------------------------------------------------------------------------------------------------------------------

const int BIG_LINK				  = 0;   //Set this constant to 1 if using the Large Link Hit Box feature.
const int CT_HOLELAVA			   = 128; //Combo type to use for pit holes and lava. "No Ground Enemies by default"
const int CF_PIT				    = 98; //The combo flag to register combos as pits.
const int CF_LAVA				   = 99; //The combo flag to register combos as lava.
const int WPS_LINK_FALL			 = 90;  //The weapon sprite to display when Link falls into a pit. "Sprite 88 by default"
const int WPS_LINK_LAVA			 = 89;  //The weapon sprite to display when Link drowns in lava. "Sprite 89 by default"
const int SFX_LINK_FALL			 = 61;  //The sound to play when Link falls into a pit. "SFX_FALL by default"
const int SFX_LINK_LAVA			 = 55;  //The sound to play when Link drowns in Lava. "SFX_SPLASH by default.
const int CMB_AUTOWARP			  = 51;  //The first of your four transparent autowarp combos (SENSITIVE WARP A).
const int HOLELAVA_DAMAGE		   = 8;   //Damage in hit points to inflict on link. "One Heart Container is worth 16 hit points"
const int DIAGONAL_MOVEMENT = 1;
int onplatform;
int Falling;
bool Warping;
// ---------------------------------------------------------------------------------------------------------------------
global script slot2
{
	    void run()
	    {
 
 
  //Initialize variables used to store Link's strating position on Screen Init.
			    int olddmap = Game->GetCurDMap();
			    int oldscreen = Game->GetCurDMapScreen();
			    int startx = Link->X;
			    int starty = Link->Y;
			    int startdir = Link->Dir;
			    //Clear global variables used by Bottomless pits.
			    Falling = 0;
			    Warping = false;
 
 
			    while(true)
			    {
					    NesMovementFix();
					    Waitdraw();
					    MovingPlatforms();
	 
	 
	  if(Link->Action != LA_SCROLLING)
					    {
							    Update_HoleLava(startx, starty, olddmap, oldscreen, startdir);
							    if(Link->Z==0 && !Falling && (oldscreen != Game->GetCurDMapScreen() || olddmap != Game->GetCurDMap()))
							    {
									    olddmap = Game->GetCurDMap();
									    oldscreen = Game->GetCurDMapScreen();
									    startx = Link->X;
									    starty = Link->Y;
									    startdir = Link->Dir;
							    }
					    }
	 
	 
					    Waitframe();
			    }
	    }
}
// ---------------------------------------------------------------------------------------------------------------------
ffc script movingplatform
{
	    void run()
	    {
			    float oldx = this->X;
			    float oldy = this->Y;
			    float linkx;
			    float linky;
			    while(true)
			    {
					    if(onplatform == FFCNum(this))
					    {
								 linkx += this->X - oldx;
								 linky += this->Y - oldy;
								 if(linkx << 0 != 0)
								 {
										 Link->X += linkx << 0;
										 linkx -= linkx << 0;
								 }
								 if(linky << 0 != 0)
								 {
										 Link->Y += linky << 0;
										 linky -= linky << 0;
								 }
					    }
					    else
					    {
								 linkx = 0;
								 linky = 0;
					    }
					    oldx = this->X;
					    oldy = this->Y;
					    Waitframe();
			    }
	    }
}

ffc script holelava
{
	    void run(int warp, bool position, int damage)
	    {
			    while(true)
			    {
					    while(!Warping) Waitframe();
					    if(warp > 0)
					    {
							    this->Data = CMB_AUTOWARP+warp-1;
							    this->Flags[FFCF_CARRYOVER] = true;
							    Waitframe();
							    this->Data = FFCS_INVISIBLE_COMBO;
							    this->Flags[FFCF_CARRYOVER] = false;
							    Link->Z = Link->Y;
							    Warping = false;
							    Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
							    Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
							    Quit();
					    }
					    if(position)
					    {
							    Link->X = this->X;
							    Link->Y = this->Y;
					    }
					    else
					    {
							    Link->X = this->InitD[6];
							    Link->Y = this->InitD[7];
					    }
					    if(damage)
					    {
							    Link->HP -= damage;
							    Link->Action = LA_GOTHURTLAND;
							    Link->HitDir = -1;
							    Game->PlaySound(SFX_OUCH);
					    }
					    Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
					    Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
					    Warping = false;
					    Waitframe();
			    }
	    }
}
// ---------------------------------------------------------------------------------------------------------------------

void NesMovementFix()
{
	    if(DIAGONAL_MOVEMENT==0 && (Link->InputUp || Link->InputDown))
	    {
			    Link->InputLeft = false;
			    Link->InputRight = false;
	    }
}
void MovingPlatforms()
{
	    onplatform = 0;
	    if(Link->Z == 0)
	    {
			    int buffer[] = "movingplatform";
			    for(int i = 1; i <= 32; i++)
			    {
					    ffc f = Screen->LoadFFC(i);
					    if(f->Script != Game->GetFFCScript(buffer)) continue;
					    if(Abs(Link->X + 8 - CenterX(f)) >= f->TileWidth* <img src='http://www.purezc.com/forums/public/style_emoticons/<#EMO_DIR#>/icon_cool.gif' class='bbc_emoticon' alt='8)' /> continue;
					    if(Abs(Link->Y + 12 - CenterY(f)) >= f->TileHeight* <img src='http://www.purezc.com/forums/public/style_emoticons/<#EMO_DIR#>/icon_cool.gif' class='bbc_emoticon' alt='8)' /> continue;
					    onplatform = FFCNum(f);
					    break;
			    }
	    }
}
//Handles Pit Combo Functionality.
void Update_HoleLava(int x, int y, int dmap, int scr, int dir)
{
	    lweapon hookshot = LoadLWeaponOf(LW_HOOKSHOT);
	    if(hookshot->isValid()) return;
	    if(Falling)
	    {
			    Falling--;
			    if(Falling == 1)
			    {
					    int buffer[] = "holelava";
					    if(CountFFCsRunning(Game->GetFFCScript(buffer)))
					    {
							    ffc f = Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
							    Warping = true;
							    if(f->InitD[1]==0)
							    {
									    f->InitD[6] = x;
									    f->InitD[7] = y;
							    }
					    }
					    else
					    {
							    Link->X = x;
							    Link->Y = y;
							    Link->Dir = dir;
							    Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
							    Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
							    Link->HP -= HOLELAVA_DAMAGE;
							    Link->Action = LA_GOTHURTLAND;
							    Link->HitDir = -1;
							    Game->PlaySound(SFX_OUCH);
							    if(Game->GetCurDMap()!=dmap || Game->GetCurDMapScreen()!=scr)
									    Link->PitWarp(dmap, scr);
					    }
					    NoAction();
					    Link->Action = LA_NONE;
			    }
		 }
		 else if(Link->Z==0 && OnPitCombo() && !Warping)
		 {
					    Link->DrawXOffset += Cond(Link->DrawXOffset < 0, -1000, 1000);
					    Link->HitXOffset += Cond(Link->HitXOffset < 0, -1000, 1000);
					    int comboflag = OnPitCombo();
					    SnaptoGrid();
					    Game->PlaySound(Cond(comboflag == CF_PIT, SFX_LINK_FALL, SFX_LINK_LAVA));
					    lweapon dummy = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y);
					    dummy->UseSprite(Cond(comboflag == CF_PIT, WPS_LINK_FALL, WPS_LINK_LAVA));
					    dummy->DeadState = dummy->NumFrames*dummy->ASpeed;
					    dummy->DrawXOffset = 0;
					    dummy->DrawYOffset = 0;
					    Falling = dummy->DeadState;
					    NoAction();
					    Link->Action = LA_NONE;
	    }
}

//Used to determine if Link is on a Pit or Lava combo.
int OnPitCombo()
{
	    int comboLoc = ComboAt(Link->X+8, Link->Y + Cond(BIG_LINK==0, 12, <img src='http://www.purezc.com/forums/public/style_emoticons/<#EMO_DIR#>/icon_cool.gif' class='bbc_emoticon' alt='8)' />);
	    if(Screen->ComboT[comboLoc] != CT_HOLELAVA)
			    return 0;
	    else if(Screen->ComboI[comboLoc] == CF_PIT || Screen->ComboI[comboLoc] == CF_LAVA)
			    return Screen->ComboI[comboLoc];
	    else if(Screen->ComboF[comboLoc] == CF_PIT || Screen->ComboF[comboLoc] == CF_LAVA)
			    return Screen->ComboF[comboLoc];
	    else
			    return 0;
}

//Snaps Link to the combo so he appears completely over pit and lava combos.
void SnaptoGrid()
{
	    int x = Link->X;
	    int y = Link->Y + Cond(BIG_LINK==0, 8, 0);
	    int comboLoc = ComboAt(x, y);
	    //X Axis
	    if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
			    Link->X = ComboX(comboLoc);
	    else if(Screen->ComboT[comboLoc+1] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
			    Link->X = ComboX(comboLoc+1);
	    if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+16] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
			    Link->X = ComboX(comboLoc+16);
	    else if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
			    Link->X = ComboX(comboLoc+17);
	    //Y Axis
	    if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
			    Link->Y = ComboY(comboLoc);
	    else if(Screen->ComboT[comboLoc+16] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
			    Link->Y = ComboY(comboLoc+1);
	    if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+1] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
			    Link->Y = ComboY(comboLoc+1);
	    else if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
			    Link->Y = ComboY(comboLoc+17);
}


#26 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Gender:Female
  • Location:Rainbow Factory

Posted 03 May 2013 - 01:54 AM

else if(Link->Z==0 && OnPitCombo() && !Warping)

needs to be changed to.

else if(Link->Z==0 && OnPitCombo() && !Warping && !onplatform)

Edited by LordVolcanon, 03 May 2013 - 01:54 AM.


#27 Binx

Binx

    Formerly Lineas

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

Posted 04 May 2013 - 11:47 PM

Ok, I had it working, except it was freezing when I tried to use it, so I removed it from my script file, then recopied what you had written there, but now it won't compile.

Line 175: Syntax Error, Unexpected Script, Expected Identifier, On Token.


It's somewhere in this area, I think right at the beginning of the FFC script (sorry, I kept losing my place after about 130-150 lines):

{
	 lweapon hookshot = LoadLWeaponOf(LW_HOOKSHOT);
	 if(hookshot->isValid()) return;

	 if(Falling)
	 {
			 Falling--;
			 if(Falling == 1)
			 {
					 int buffer[] = "holelava";
					 if(CountFFCsRunning(Game->GetFFCScript(buffer)))
					 {
							 ffc f =
Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
							 Warping = true;
							 if(f->InitD[1]==0)
							 {
									 f->InitD[6] = x;
									 f->InitD[7] = y;
							 }
					 }
					 else
					 {
							 Link->X = x;
							 Link->Y = y;
							 Link->Dir = dir;
							 Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000,
1000);
							 Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000,
1000);
							 Link->HP -= HOLELAVA_DAMAGE;
							 Link->Action = LA_GOTHURTLAND;
							 Link->HitDir = -1;
							 Game->PlaySound(SFX_OUCH);
							 if(Game->GetCurDMap()!=dmap ||
Game->GetCurDMapScreen()!=scr)
									 Link->PitWarp(dmap, scr);
					 }
					 NoAction();
					 Link->Action = LA_NONE;
			 }
		 }
		 else if(Link->Z==0 && OnPitCombo() && !Warping)
		 {
					 Link->DrawXOffset += Cond(Link->DrawXOffset < 0, -1000, 1000);
					 Link->HitXOffset += Cond(Link->HitXOffset < 0, -1000, 1000);
					 int comboflag = OnPitCombo();
					 SnaptoGrid();
					 Game->PlaySound(Cond(comboflag == CF_PIT, SFX_LINK_FALL,
SFX_LINK_LAVA));
					 lweapon dummy = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y);
					 dummy->UseSprite(Cond(comboflag == CF_PIT, WPS_LINK_FALL,
WPS_LINK_LAVA));
					 dummy->DeadState = dummy->NumFrames*dummy->ASpeed;
					 dummy->DrawXOffset = 0;
					 dummy->DrawYOffset = 0;
					 Falling = dummy->DeadState;
					 NoAction();
					 Link->Action = LA_NONE;
	 }
}

ffc script holelava
{
	 void run(int warp, bool position, int damage)
	 {
			 while(true)
			 {
					 while(!Warping) Waitframe();
					 if(warp > 0)
					 {
							 this->Data = CMB_AUTOWARP+warp-1;
							 this->Flags[FFCF_CARRYOVER] = true;
							 Waitframe();
							 this->Data = FFCS_INVISIBLE_COMBO;
							 this->Flags[FFCF_CARRYOVER] = false;
							 Link->Z = Link->Y;
							 Warping = false;
							 Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000,
1000);
							 Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000,
1000);
							 Quit();
					 }
					 if(position)
					 {
							 Link->X = this->X;
							 Link->Y = this->Y;
					 }
					 else
					 {
							 Link->X = this->InitD[6];
							 Link->Y = this->InitD[7];
					 }
					 if(damage)
					 {
							 Link->HP -= damage;
							 Link->Action = LA_GOTHURTLAND;
							 Link->HitDir = -1;
							 Game->PlaySound(SFX_OUCH);
					 }
					 Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
					 Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
					 Warping = false;
					 Waitframe();
			 }
	 }
}

Edited by Lineas, 05 May 2013 - 10:38 AM.


#28 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Gender:Male
  • Location:Minas Gerais, Brazil

Posted 05 May 2013 - 07:12 AM

The script is working fine now :) Thanks, LordVolcanon!

#29 Binx

Binx

    Formerly Lineas

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

Posted 05 May 2013 - 03:46 PM

So, I got it to work, it was my fault, lol, I forgot a "}" when I was combining global scripts. But now, it works, but the first time I step on it, it makes link fall from the sky into the lava, then appear back at his arrival point. Subsequent falls just warp you back to the start without the lava-pool cannonball, but if you leave the screen and come back? Cannonball diving into lava again. Any idea what I'm doing wrong here?


EDIT: Figured it out, I was using the FFC wrong. Took it off and it works perfectly.

Edited by Lineas, 05 May 2013 - 04:06 PM.


#30 Moosh

Moosh

    Tiny Little Questmaker

  • Members
  • Gender:Male

Posted 10 May 2013 - 09:10 PM

A wild bug appears! When I fall into lava in a sideview area I don't respawn back at the room entrance. It just plays the lava sound seemingly every frame.



Also tagged with one or more of these keywords: Global, FFC

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users