User Tag List

Results 1 to 7 of 7

Thread: Bottomless Pits and Lava have been updated.

  1. #1
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%

    Bottomless Pits and Lava have been updated.

    Code:
    //Include these lines once at the top of your script file.
    import "std.zh"
    import "ffcscript.zh"
    
    //Common Constants, only need to define once per quest.
    const int DIAGONAL_MOVEMENT     = 1; //Change this to 0 for nes movement.
    const int BIG_LINK              = 0; //Set this constant to 1 if using the Large Link Hit Box feature
     
    //Constants used by Bottomless Pits & Lava.
    const int CT_HOLELAVA           = 142; //Combo type to use for pit holes and lava. "Scripted Combo 1, you can use no ground enemies if you don't use ghost.zh"
    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			= 88;  //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			= 38;  //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			= 0;   //The first of your four transparent autowarp combos.
    const int HOLELAVA_DAMAGE		= 8;   //Damage in hit points to inflict on link. "One Heart Container is worth 16 hit points"
    
    //Global variables used by Bottomless Pits & Lava.
    int Falling;
    bool Warping;
     
    global script slot2_holelava
    {
    	void run()
    	{
    		//Initialize variables used to store Link's strating position on Screen Init.
    		int returndmap = Game->GetCurDMap();
    		int returnscreen = Game->GetCurDMapScreen();
    		int returnx = Link->X;
    		int returny = Link->Y;
    		int returndir = Link->Dir;
     
    		//Clear global variables used by Bottomless pits.
    		Falling = 0;
    		Warping = false;
     
    		//Main Loop
    		while(true)
    		{
    			NesMovementFix();
    			Waitdraw();
    			if(Link->Action != LA_SCROLLING)
    			{
    				if(Link->Z==0 && !Falling && (returnscreen != Game->GetCurDMapScreen() || returndmap != Game->GetCurDMap()))
    				{
    					if(OnPitCombo()==0) //Not having this check was causing a terrible death trap.
    					{
    						returndmap = Game->GetCurDMap();
    						returnscreen = Game->GetCurDMapScreen();
    						returnx = Link->X;
    						returny = Link->Y;
    						returndir = Link->Dir;
    					}
    				}
    				Update_HoleLava(returnx, returny, returndmap, returnscreen, returndir);
    			}
    			Waitframe();
    		}
    	}
    }
    
    //This function is shared by other scripts need only once per quest.
    void NesMovementFix()
    {
    	if(DIAGONAL_MOVEMENT==0 && (Link->InputUp || Link->InputDown))
    	{
    		Link->InputLeft = false;
    		Link->InputRight = false;
    	}
    }
     
    //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)
    	{
    		if(IsSideview()) Link->Jump=0;
    		Falling--;
    		if(Falling == 1)
    		{
    			int buffer[] = "Holelava";
    			if(CountFFCsRunning(Game->GetFFCScript(buffer))>0)
    			{
    				ffc f = Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
    				Warping = true;
    				if(f->InitD[1]==0)
    				{
    					f->InitD[6] = x;
    					f->InitD[7] = y;
    				}
    			}
    			else
    			{
    				if(Game->GetCurDMap()!=dmap || Game->GetCurDMapScreen()!=scr)
    					Link->PitWarp(dmap, scr);
    				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);
    			}
    			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();
    		}
    	}
    }
     
    //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, 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+16);
    	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);
    }
    
    // Replace the __IsPit function in ghost.zh if you us 2.8 or above.
    // Pit and Lava are currently treated the same. Sorry folks.
    bool __IsPit(int comboLoc)
    {
    	if(Screen->ComboT[comboLoc] == CT_HOLELAVA)
    	{
    		return
    			(Screen->ComboF[comboLoc] == CF_PIT || Screen->ComboF[comboLoc] == CF_LAVA || Screen->ComboI[comboLoc] == CF_PIT || Screen->ComboI[comboLoc] == CF_LAVA);
    	}
    	else return false;
    }
    Changelog
    *Now teleports link to the last safe screen if he immediately falls into a pit.
    *The position update happens before the pitlava code now.
    *Ghost_ZH Function added (at bottom)

  2. #2
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,351
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,496
    Level
    21
    vBActivity - Bars
    Lv. Percent
    15.9%
    If I might suggest, it'd be cleaner to do this:

    Code:
    void HolesLavaMain()
    {
    	if(Link->Z==0 && !Falling && (returnscreen != Game->GetCurDMapScreen() || returndmap != Game->GetCurDMap()))
    	{
    		if(OnPitCombo()==0) //Not having this check was causing a terrible death trap.
    		{
    			returndmap = Game->GetCurDMap();
    			returnscreen = Game->GetCurDMapScreen();
    			returnx = Link->X;
    			returny = Link->Y;
    			returndir = Link->Dir;
    		}
    	}
    }
    
    void DoHolesLava()
    {
    	if(Link->Action != LA_SCROLLING)
    	{
    		HolesLavaMain();
    		Update_HoleLava(returnx, returny, returndmap, returnscreen, returndir);
    	}
    }
    
    
    global script slot2_holelava
    {
    	void run()
    	{
    		//Initialize variables used to store Link's strating position on Screen Init.
    		int returndmap = Game->GetCurDMap();
    		int returnscreen = Game->GetCurDMapScreen();
    		int returnx = Link->X;
    		int returny = Link->Y;
    		int returndir = Link->Dir;
     
    		//Clear global variables used by Bottomless pits.
    		Falling = 0;
    		Warping = false;
     
    		//Main Loop
    		while(true)
    		{
    			NesMovementFix();
    			Waitdraw();
    			DoHolesLava();
    			Waitframe();
    		}
    	}
    }
    This permits easier integration for users not used to modifying, or combining global scripts, and would simplify some support problems.

    Why, also, did you place all of this after Waitdraw() here? I think I had to modify it for someone on PZC to put the holes code before waitdraw, and after ghost, to get something to work right. I have no idea for who, or why though. I clearly recall putting the code in container functions though, to solve problems with user support, and people botching this integration, at least twice.

  3. #3
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Encapsulation is not always a good thing, don't use it unless you have to. Although I'll try to see if I can clean it up some more. I think I have a way, but encapsulating the scrolling check was a bad idea.
    Last edited by Tamamo; 01-21-2016 at 10:51 AM.

  4. #4
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,351
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,496
    Level
    21
    vBActivity - Bars
    Lv. Percent
    15.9%
    I suppose it wastes a nest, by calling a function every frame, even when it's not needed. If it was me, I'd do this:

    Code:
    void DoHolesLava()
    {
    	
    	HolesLavaMain();
    	Update_HoleLava(returnx, returny, returndmap, returnscreen, returndir);
    
    }
    Then, in the global script, call:

    Code:
    if(Link->Action != LA_SCROLLING) DoHolesLava();
    Sorry, it's just the umpteen-Nth time I've had to make another global script for someone today, that the user could have done if the function calls were all encapsulated.

    The other thing I do by default, is trim all the vars down to a single array. Over time, these tally, and if someone is unable to merge a global script, they're not likely to comprehend stack errors either.

    http://www.purezc.net/forums/index.p...81#entry988150

    If you want to see why... People just have no idea how to do any of this unless you make it dead simple.

  5. #5
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    The only problem with that is that they're shared variables with my other scripts.

  6. #6
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,351
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,496
    Level
    21
    vBActivity - Bars
    Lv. Percent
    15.9%
    Ah well, that's on your end.

    Here's what I did, for other people:

    Code:
    /// Global Constants, Arrays, and Variables
    
    //Arrays
    float PitsLava[256]; //Array for Holelava. Set to an arbitrarily large size. Min [2]
    
    //Common Constant, only need to define once per script file.
    const int BIG_LINK                  = 0;   //Set this constant to 1 if using the Large Link Hit Box feature.
     
    //Constants used by Bottomless Pits & Lava.
    const int CT_HOLELAVA              = 128; //Combo type to use for pit holes and lava."No Ground Enemies by default"
    const int CF_PIT                   = 101;  //The combo flag to register combos as pits.
    const int CF_LAVA                  = 102;  //The combo flag to register combos as lava.
    const int WPS_LINK_FALL            = 89;  //The weapon sprite to display when Link falls into a pit. "Sprite 88 by default"
    const int WPS_LINK_LAVA            = 90;  //The weapon sprite to display when Link drowns in lava. "Sprite 89 by default"
    const int SFX_LINK_FALL            = 38;  //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             = 48;  //The first of your four transparent autowarp combos.
    const int HOLELAVA_DAMAGE          = 8;   //Damage in hit points to inflict on link. "One Heart Container is worth 16 hit points"
    
    //Constants for Array Accessors
    
    //Array Indices of PitsLava[]
    const int HL_FALLING               = 0;
    const int HL_WARPING               = 1;
    const int HL_OLDDMAP               = 2;
    const int HL_OLDSCREEN             = 3;
    const int HL_STARTX                = 4;
    const int HL_STARTY                = 5;
    const int HL_STARTDIR              = 6;
    
    
    //////////////////////
    /// Global Scripts ///
    //////////////////////
    
    global script active{                           
    	void run(){
    		//StartGhostZH(); //! Enable if using ghost.zh
            InitHoleLava(); //Inits Tamamo's holes and lava.
    		while(true){
    			//UpdateGhostZH1();//! Enable if using ghost.zh
    			Waitdraw();
    			//UpdateGhostZH2(); //! Enable if using ghost.zh
    			if (Link->Action != LA_SCROLLING) RunHoleLava(); //Main Tamamo Holes and Lava function.
    			Waitframe();
    		}//end whileloop
    	}//end run
    }//end global active script (slot2)
    
    
    
    
    ////////////////////////
    /// GLOBAL FUNCTIONS ///
    ////////////////////////
    
    //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, 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+16);
    	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);
    }
    
    
    //Hole_Lava Init. Call before Waitdraw().
    void InitHoleLava(){
    	//Initialize variables used to store Link's strating position on Screen Init.
    			PitsLava[HL_OLDDMAP] = Game->GetCurDMap();
                PitsLava[HL_OLDSCREEN] = Game->GetCurDMapScreen();
                PitsLava[HL_STARTX] = Link->X;
                PitsLava[HL_STARTY] = Link->Y;
                PitsLava[HL_STARTDIR] = Link->Dir;
     
    			//Clear global variables used by Bottomless pits.
    			PitsLava[HL_FALLING] = 0;
    			PitsLava[HL_WARPING] = 0;
    }
    
    //Main Hole_Lava Rountine. Call after Waitdraw().
    void RunHoleLava(){
        Update_HoleLava(PitsLava[HL_STARTX], PitsLava[HL_STARTY], PitsLava[HL_OLDDMAP], PitsLava[HL_OLDSCREEN], PitsLava[HL_STARTDIR]);
        if(Link->Z==0 && !PitsLava[HL_FALLING] && ( PitsLava[HL_OLDSCREEN] != Game->GetCurDMapScreen() || PitsLava[HL_OLDDMAP] != Game->GetCurDMap() ) && !OnPitCombo() )
        {
            PitsLava[HL_OLDDMAP] = Game->GetCurDMap();
            PitsLava[HL_OLDSCREEN] = Game->GetCurDMapScreen();
            PitsLava[HL_STARTX] = Link->X;
            PitsLava[HL_STARTY] = Link->Y;
            PitsLava[HL_STARTDIR] = Link->Dir;
        }
    }
    
    //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(PitsLava[HL_FALLING])
    	{
    		if(IsSideview()) Link->Jump=0;
    		PitsLava[HL_FALLING]--;
    		if(PitsLava[HL_FALLING] == 1)
    		{
    			int buffer[] = "Holelava";
    			if(CountFFCsRunning(Game->GetFFCScript(buffer)))
    			{
    				ffc f = Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
    				PitsLava[HL_WARPING] = 1;
    				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() && !PitsLava[HL_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;
    		PitsLava[HL_FALLING] = dummy->DeadState;
    		NoAction();
    		Link->Action = LA_NONE;
    	}
    }
    
    
    
    ///////////////////
    /// FFC Scripts ///
    ///////////////////
    
    //Holes and Lava Main ffc
     
    ffc script Holelava
    {
    	void run(int warp, bool position, int damage)
    	{
    		while(true)
    		{
    			while(!PitsLava[HL_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;
    				PitsLava[HL_WARPING] = 0;
    				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);
    			PitsLava[HL_WARPING] = 0;
    			Waitframe();
    		}
    	}
    }
    I think I got your updates in this, but I'm not sure if I incidentally missed any. I can also post accessors for the array that function like the normal variables, if you want; but you could just as well make those yourself. My goal of course, is to reduce the number of used registers, so it saves five regs to do it this way. I usually make accessors for people, so that it's easier to modify scripts, but they do waste a reg (push and pop) when calling them, so it's not as efficient as directly setting an array index.

    The encapsulation likewise, makes it easy for user-Joe to integrate with other things. I also know that it does work, which is good.

    I'm not sure if you approve of this at all, but I have refrained from posting it in the script DB (as a reply to your entry there) without your consent. I was going to ask if you'd mind, about six months back, but I entirely forgot until it came up again today.

    So...if it's up to the present spec--I added in the extra check, but I didn't notice any other overt changes--and you don't mind that I post it to that DB entry to help out some generic users, let me know.

    Otherwise, I'll just facilitate it when someone puts up another request to combine it. If you want to patch the entry in the database with exactly what you have here instead, let me know, and I'll pester someone to go in and edit it. The one on PZC is out of sync, after all.

  7. #7
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    I was going to play nice, but since playing nice doesn't seem to get through to you you I will use the harsh tone instead.

    It won't work cause I have released other scripts that intermingle with one another with the deliberate purpose of forcing people to learn how to combine global scripts. DO NOT DO IT FOR THEM! TEACH THEM HOW TO DO IT INSTEAD OR BETTER YET MAKE A GOD DAMN TUTORIAL!
    Since zscript is deprecated and is being replaced with angelscript. This is thread is being closed, if you wish to discuss it further, feel free to PM me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social