User Tag List

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 23

Thread: Lttp style 'pickup rock' script

  1. #11
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.39%

    Re: Lttp style 'pickup rock' script

    I see a bug in his script. Find this line:

    Code:
                 if (can_lift(xx,yy) == 3) {this_dam = dam_3;)
    and replace it with this one:

    Code:
                 if (can_lift(xx,yy) == 3) {this_dam = dam_3;}
    (the brace at the end wasn't curly)

    You need to re-import it to re-compile it.
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  2. #12
    Octorok
    Join Date
    Jan 2008
    Age
    32
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    938
    Level
    10
    vBActivity - Bars
    Lv. Percent
    63.37%

    Re: Lttp style 'pickup rock' script

    Now it says:

    line 117: syntax error, unexpected RBrace
    expecting $ end, on token }

    Is this script working or not?

  3. #13
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.39%

    Re: Lttp style 'pickup rock' script

    I don't know, I didn't write it, nor have I tried to use it.

    I just tried to, though, and it's severely broken. It's missing a whole function! So, I'll say no.

    Tips to ShadowMancer:

    - Pick one style of indenting and braces, and use it.
    - Try to compile your own scripts before posting them
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  4. #14
    Octorok
    Join Date
    Oct 2004
    Age
    47
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,252
    Level
    12
    vBActivity - Bars
    Lv. Percent
    8.98%

    Re: Lttp style 'pickup rock' script

    thanks for trying, I was hoping ShadowMancer would view this and fix it
    I never expected anyone else to step in to try. I know nothing of code, so
    I tried fixing a few things, but my problem is in the end and I have copied
    all the code right down to the last } as well as added the "import std.zh",
    and still get errors. I did all this first before posting, which is why I got stumped.

    so hopefully Shadow will respond, as there is no other way to make contact
    with him.
    -----------------------------------------------------
    NEWEST QUESTS:
    -----------------------------------------------------
    ZC 2.5 build 635+ (Player): Origins III
    -----------------------------------------------------
    visit my web site, for all my quests Einstein Games

  5. #15
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.64%

    Re: Lttp style 'pickup rock' script

    I haven't seen him around for ages

    You could try PM'ing him, if he has the 'get email about PM' thing on, he might notice it.

    Shame really, he used to help out a lot around here.

  6. #16
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.39%

    Re: Lttp style 'pickup rock' script

    In case anyone wants to pick it up in his absence, here's the script, as cleaned up by me:

    Code:
    import "std.zh"
    
    ffc script liftRock{
    	void run(int under, int dam_1, int dam_2, int dam_3) {
    		int xx = 0;
    		int yy = 0;
    		int this_dam = 0;
    		bool is_hit = false;
    		bool is_hold = false;
    		while (true) {
    			is_hit = false;
    			if (Link->Dir == 0) { 
    				 xx = Link->X; 
    				 yy = Link->Y-8;
    			}
    			if (Link->Dir == 1) { 
    				 xx = Link->X; 
    				 yy = Link->Y+16;
    			}
    			if (Link->Dir == 2) { 
    				 xx = Link->X-16; 
    				 yy = Link->Y;
    			}
    			if (Link->Dir == 3) { 
    				 xx = Link->X+16; 
    				 yy = Link->Y;
    			}
    			if (Link->InputR && can_lift(xx,yy) > 0 && is_hold == false) {
    				//Main Action Loop
    				if (can_lift(xx,yy) == 1) {this_dam = dam_1;}
    			  if (can_lift(xx,yy) == 2) {this_dam = dam_2;}
    			  if (can_lift(xx,yy) == 3) {this_dam = dam_3;}
    				//assumes the shape of the rock
    				this->Data = Screen->ComboD[ComboAt(xx,yy)] + 20;
    				this->CSet = Screen->ComboC[ComboAt(xx,yy)];
    				//Changes Rock to undercombo
    				Screen->ComboD[ComboAt(xx,yy)] = under; 
    				//moves ffc to position of rock
    				this->X = xx;
    				this->Y = yy;
    				//Sets flag to tell Link is holding rock
    				is_hold = true;
    				
    				while(Link->InputR) { Waitframe(); }
    			}
    			
    		
    			if (is_hold == true) {
    				//moves rock to above Link's head
    				this->X = Link->X;
    				this->Y = Link->Y-12;
    			}
    			
    			if (Link->InputR && is_hold == true) {
    			//Throwing routine
    				is_hold = false;
    				if (Link->Dir == 0) {
    					while (is_hit == false) 
    						{
    						this->Y-=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    						}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;
    				}
    				if (Link->Dir == 1) {
    					while (is_hit == false) {
    						this->Y+=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;	
    				}
    				if (Link->Dir == 2) {
    					while (is_hit == false) {
    						this->X-=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;	 	
    				}
    				if (Link->Dir == 3) {
    					while (is_hit == false) {
    						this->X+=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;
    				}
    			}
    			Waitframe();
    		}
    	}
    }
    
    
    
    int can_lift(int xn, int yn) {
    	int result = 0;
    	if(xn<0 || xn>240 || yn<0 || yn>160){
    		return 0;
    	}
    	
    	if (Link->Item[107] && Screen->ComboD[ComboAt(xn,yn)] >= 6400 && Screen->ComboD[ComboAt(xn,yn)] <= 6419) { result = 1;}
    	if (Link->Item[19] && Screen->ComboD[ComboAt(xn,yn)] >= 6440 && Screen->ComboD[ComboAt(xn,yn)] <= 6459) { result = 2 ;}
    	if (Link->Item[56] && Screen->ComboD[ComboAt(xn,yn)] >= 6480 && Screen->ComboD[ComboAt(xn,yn)] <= 6499) { result = 3;}
    
    	return result;
    }
    
    bool ene_damage(int damage,int xn, int yn) {
    	int ene_chk = 1;
    	bool result = false;
    	if (xn<0 || xn>240 || yn<0 || yn>160) result = true;
    		while (ene_chk <= Screen->NumNPCs()) {
    			npc trg_ene = Screen->LoadNPC(ene_chk); 	
    			if (trg_ene->X+8 >= xn-8 && trg_ene->X+8 <= xn+24 && trg_ene->Y+8 >= yn-8 && trg_ene->Y+8 <= yn+24) {
    				//Enemy is Hit
    				result = true;
    				int timer = 10;
    				trg_ene->HP -= damage;
    				while(timer > 0) {
    					//Flash CSet
    					int def_cset = trg_ene->CSet;
    					if (trg_ene->CSet == def_cset) {
    						trg_ene->CSet = 5;} 
    					else {
    						trg_ene->CSet = def_cset;}
    					//Push enemy back
    					//0,1,2,3, - Up,Dn,Lt,Rt
    					if (trg_ene->Dir == 0) {
    						if (is_walkable(trg_ene->X,trg_ene->Y+4)) trg_ene->Y+=4;
    					}
    					if (trg_ene->Dir == 1) {
    						if (is_walkable(trg_ene->X,trg_ene->Y-4)) trg_ene->Y-=4;
    					}
    					if (trg_ene->Dir == 2) {
    						if (is_walkable(trg_ene->X+4,trg_ene->Y)) trg_ene->X+=4;
    					}
    					if (trg_ene->Dir == 3) {
    						if (is_walkable(trg_ene->X-4,trg_ene->Y)) trg_ene->X-=4;
    					}
    					timer -= 1;
    				}
    			}
    		ene_chk += 1;
    		Waitframe();
    		
    	} 
    	return result;
    }
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  7. #17
    Octorok
    Join Date
    Jan 2008
    Age
    32
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    938
    Level
    10
    vBActivity - Bars
    Lv. Percent
    63.37%

    Re: Lttp style 'pickup rock' script

    It gives me this:

    pass 1 : parsing
    pass 2 : preprocessing
    pass 3 : building symbol tables
    TMP , line140 : error S10 : Function is_walkable is undeclared
    TMP , line143 : error S10 : Function is_walkable is undeclared
    TMP , line146 : error S10 : Function is_walkable is undeclared
    TMP , line149 : error S10 : Function is_walkable is undeclared

  8. #18
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.39%

    Re: Lttp style 'pickup rock' script

    Right, as I previously discussed, the script is broken. If I knew exactly what "is_walkable" does, then I could probably fix it. For all I know, it could add health to Link, since it can be named anything >_>

    Yes, yes, I know that it probable checks to see if that spot is solid or not. Fine, here you go. I added "is_walkable", based on the "isSolid" function found in my Ladder script:

    Code:
    import "std.zh"
    
    ffc script liftRock{
    	void run(int under, int dam_1, int dam_2, int dam_3) {
    		int xx = 0;
    		int yy = 0;
    		int this_dam = 0;
    		bool is_hit = false;
    		bool is_hold = false;
    		while (true) {
    			is_hit = false;
    			if (Link->Dir == 0) { 
    				 xx = Link->X; 
    				 yy = Link->Y-8;
    			}
    			if (Link->Dir == 1) { 
    				 xx = Link->X; 
    				 yy = Link->Y+16;
    			}
    			if (Link->Dir == 2) { 
    				 xx = Link->X-16; 
    				 yy = Link->Y;
    			}
    			if (Link->Dir == 3) { 
    				 xx = Link->X+16; 
    				 yy = Link->Y;
    			}
    			if (Link->InputR && can_lift(xx,yy) > 0 && is_hold == false) {
    				//Main Action Loop
    				if (can_lift(xx,yy) == 1) {this_dam = dam_1;}
    			  if (can_lift(xx,yy) == 2) {this_dam = dam_2;}
    			  if (can_lift(xx,yy) == 3) {this_dam = dam_3;}
    				//assumes the shape of the rock
    				this->Data = Screen->ComboD[ComboAt(xx,yy)] + 20;
    				this->CSet = Screen->ComboC[ComboAt(xx,yy)];
    				//Changes Rock to undercombo
    				Screen->ComboD[ComboAt(xx,yy)] = under; 
    				//moves ffc to position of rock
    				this->X = xx;
    				this->Y = yy;
    				//Sets flag to tell Link is holding rock
    				is_hold = true;
    				
    				while(Link->InputR) { Waitframe(); }
    			}
    			
    		
    			if (is_hold == true) {
    				//moves rock to above Link's head
    				this->X = Link->X;
    				this->Y = Link->Y-12;
    			}
    			
    			if (Link->InputR && is_hold == true) {
    			//Throwing routine
    				is_hold = false;
    				if (Link->Dir == 0) {
    					while (is_hit == false) 
    						{
    						this->Y-=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    						}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;
    				}
    				if (Link->Dir == 1) {
    					while (is_hit == false) {
    						this->Y+=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;	
    				}
    				if (Link->Dir == 2) {
    					while (is_hit == false) {
    						this->X-=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;	 	
    				}
    				if (Link->Dir == 3) {
    					while (is_hit == false) {
    						this->X+=12;
    						if (ene_damage(this_dam,this->X,this->Y) == true) { is_hit = true; }
    						Waitframe();
    					}
    					this->Data = 0;
    					this->X = 0;
    					this->Y = 0;
    				}
    			}
    			Waitframe();
    		}
    	}
    	
    	int can_lift(int xn, int yn) {
    		int result = 0;
    		if(xn<0 || xn>240 || yn<0 || yn>160){
    			return 0;
    		}
    		
    		if (Link->Item[107] && Screen->ComboD[ComboAt(xn,yn)] >= 6400 && Screen->ComboD[ComboAt(xn,yn)] <= 6419) { result = 1;}
    		if (Link->Item[19] && Screen->ComboD[ComboAt(xn,yn)] >= 6440 && Screen->ComboD[ComboAt(xn,yn)] <= 6459) { result = 2 ;}
    		if (Link->Item[56] && Screen->ComboD[ComboAt(xn,yn)] >= 6480 && Screen->ComboD[ComboAt(xn,yn)] <= 6499) { result = 3;}
    	
    		return result;
    	}
    	
    	bool ene_damage(int damage,int xn, int yn) {
    		int ene_chk = 1;
    		bool result = false;
    		if (xn<0 || xn>240 || yn<0 || yn>160) result = true;
    			while (ene_chk <= Screen->NumNPCs()) {
    				npc trg_ene = Screen->LoadNPC(ene_chk); 	
    				if (trg_ene->X+8 >= xn-8 && trg_ene->X+8 <= xn+24 && trg_ene->Y+8 >= yn-8 && trg_ene->Y+8 <= yn+24) {
    					//Enemy is Hit
    					result = true;
    					int timer = 10;
    					trg_ene->HP -= damage;
    					while(timer > 0) {
    						//Flash CSet
    						int def_cset = trg_ene->CSet;
    						if (trg_ene->CSet == def_cset) {
    							trg_ene->CSet = 5;} 
    						else {
    							trg_ene->CSet = def_cset;}
    						//Push enemy back
    						//0,1,2,3, - Up,Dn,Lt,Rt
    						if (trg_ene->Dir == 0) {
    							if (is_walkable(trg_ene->X,trg_ene->Y+4)) trg_ene->Y+=4;
    						}
    						if (trg_ene->Dir == 1) {
    							if (is_walkable(trg_ene->X,trg_ene->Y-4)) trg_ene->Y-=4;
    						}
    						if (trg_ene->Dir == 2) {
    							if (is_walkable(trg_ene->X+4,trg_ene->Y)) trg_ene->X+=4;
    						}
    						if (trg_ene->Dir == 3) {
    							if (is_walkable(trg_ene->X-4,trg_ene->Y)) trg_ene->X-=4;
    						}
    						timer -= 1;
    					}
    				}
    			ene_chk += 1;
    			Waitframe();
    			
    		} 
    		return result;
    	}
    	
    	bool is_walkable(int x, int y) {
    	 
    		if(x<0 || x>255 || y<0 || y>175) return false;
    		
    		int mask=1111b;
    		
    		if(x &#37; 16 < 8)
    			mask &= 0011b;
    		else
    			mask &= 1100b;
    		
    		if(y % 16 < 8)
    			mask &= 0101b;
    		else
    			mask &= 1010b;
    		
    		int ret = Screen->ComboS[ComboAt(x, y)] & mask;
    		
    		return (ret==0);
    	}
    }
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  9. #19
    Octorok
    Join Date
    Jan 2008
    Age
    32
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    938
    Level
    10
    vBActivity - Bars
    Lv. Percent
    63.37%

    Re: Lttp style 'pickup rock' script

    Yup, it works. Nice work! :)

    Can't wait to try it. :)

  10. #20
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.39%

    Re: Lttp style 'pickup rock' script

    I must point out that I have not actually tried it, and have no idea if it actually does what i promises, etc etc. No refunds, as is, caveat scriptor, etc.
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

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