User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 31

Thread: Sign post

  1. #1
    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.51%

    Cool Sign post, NPC scripts

    Signpost script:

    Code:
    //remove this line if you already have a script file.
    import "std.zh"
    
    ffc script sign {
    	void run(int m) {
    		while(true) {
    			while(Link->X < this->X - 8 || Link->X > this->X + 24 || Link->Y < this->Y || Link->Y > this->Y + 24 || Link->Dir != DIR_UP || !Link->InputA) {
    				Waitframe();
    			}
    			Link->InputA = false;
    			Screen->Message(m);
    
    			while(Link->X >= this->X - 8 && Link->X <= this->X + 24 && Link->Y >= this->Y && Link->Y <= this->Y + 24 && Link->Dir == DIR_UP) {
    				Waitframe();
    			}
    			
    			Screen->Message(0);
    		}
    	}
    }
    To use this, give the FFC the number of the string as the first argument. Then, the script will wait until Link is just below the sign, and facing up, and pressing A, and it will display the message.

    Tips:

    • It works best with the "Messages freeze all action" and "Messages disappear" rules.
    • You can make the FFC's combo the sign, or you can make it invisible, and place it ontop of an existing sign
    • If you do the former, make sure the combo underneath the FFC is solid, or Link will walk right through it!


    -----------------------

    NPC script:

    Code:
    //remove this line if you already have a script file.
    import "std.zh"
    
    ffc script real_npc {
    	void run(int m, int s, int f, int d, int def_dir) {
    		int d_x; 
    		int d_y;
    		int a_x;
    		int a_y;
    		int orig_d = this->Data;
    		
    		if(d == 0) d = 48;
    		
    		
    		while(true) {
    			d_x = this->X - Link->X;
    			d_y = this->Y - Link->Y;
    			a_x = Abs(d_x);
    			a_y = Abs(d_y);
    			
    			if(f != 0) {
    				if(a_x < d && a_y < d) {
    					if(a_x <= a_y) {
    						if(d_y >= 0) {
    							this->Data = orig_d + DIR_UP;
    						} else {
    							this->Data = orig_d + DIR_DOWN;
    						}
    					} else {
    						if(d_x >= 0) {
    							this->Data = orig_d + DIR_LEFT;
    						} else {
    							this->Data = orig_d + DIR_RIGHT;
    						}
    					}
    				} else {
    					this->Data = orig_d + def_dir;
    				}
    			}
    			
    			if(Link->InputA && a_x < 24 && a_y < 24) {
    				if(s != 0) Game->PlaySound(s);
    				Link->InputA = false;
    				Screen->Message(m);
    			}
    			Waitframe();
    		}
    	}
    }
    Takes 5 parameters (!!):

    0: The message. Same as the sign post.
    1: S sound to play when activated.
    2: Whether to have the NPC turn to face Link when he's near. See below for details. (0 is off, anything else is on)
    3: If #2 is on, how close Link must be for the NPC to turn, in pixels (+ 16, because that's how wide Link is) (default is 48)
    4: If #2 is on, which direction is the "default" direction, when Link is far away (0 - Up, 1 - Down, 2 - Left, 3 - Right)

    To have an NPC that faces Link, you must put the combos for each direction in a certain order: Up, Down, Left, Right, AND! You must set the FFC to the UP facing combo. If you do that, you'll be fine.

    Tips:

    • Like the Sign post, you should put a solid combo on the same square as the NPC, so Link can't move through it.
    • If you use the facing feature, then you must use the FFC as a sprite, you can't have it invisible on top of an NPC combo. If you're just using a plain NPC, then it doesn't matter which you do.
    • It works best with the "Messages freeze all action" and "Messages disappear" rules.


    Have fun!
    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. #2
    Octorok Beta Link's Avatar
    Join Date
    Jan 2007
    Age
    31
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,125
    Level
    11
    vBActivity - Bars
    Lv. Percent
    52.05%

    Re: Sign post

    Cool! I'll probably use this! I thought _L_ was going to make signpost combos though. Now I'm not sure cause there's only going to be bug-fixing from now on...

  3. #3
    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.51%

    Re: Sign post

    If he was, it won't be for a while.
    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. #4
    Octorok Master_of_Power's Avatar
    Join Date
    May 2001
    Age
    35
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,195
    Level
    15
    vBActivity - Bars
    Lv. Percent
    47.04%

    Re: Sign post

    This is great for making NPCs. Perhaps you can make it that the combo directly under the FCC is solid instead? that way you can make it move.
    Keeping something big a secret, in case it doesn't work out I can understand.
    But he deliberatly drops little hints just to drive us mad.

  5. #5
    Octorok Beta Link's Avatar
    Join Date
    Jan 2007
    Age
    31
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,125
    Level
    11
    vBActivity - Bars
    Lv. Percent
    52.05%

    Re: Sign post

    Hey, wait! The script doesn't work! I just tried to compile it in Build 443 and it messed up in lines 4 and 10. On both lines it said "Tmp, Line 4/10: Error 509: Variable DIR_UP is undeclared.".

  6. #6
    Octorok Master_of_Power's Avatar
    Join Date
    May 2001
    Age
    35
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,195
    Level
    15
    vBActivity - Bars
    Lv. Percent
    47.04%

    Re: Sign post

    It works for me

    you got to put

    Code:
    import "std.zh"
    or

    Code:
    include "std.zh"
    at the top of your buffer file before it compiles correctly. I forget exactly which one, though...
    Keeping something big a secret, in case it doesn't work out I can understand.
    But he deliberatly drops little hints just to drive us mad.

  7. #7
    Gibdo beefster09's Avatar
    Join Date
    Mar 2006
    Age
    31
    Posts
    699
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,710
    Level
    16
    vBActivity - Bars
    Lv. Percent
    97.33%

    Re: Sign post

    it's import. pkmnfrk, could you tack that on?

    BTW: typed out long would it be Pokemon freak or Pikmin freak?
    Avatar: Just who the SPAAAACE do you think I am?

  8. #8
    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.51%

    Re: Sign post

    Quote Originally Posted by beefster09 View Post
    it's import. pkmnfrk, could you tack that on?
    I know it's important, but I designed it to be pasted into someone's pre-existing script file. But, ok.

    Quote Originally Posted by beefster09 View Post
    BTW: typed out long would it be Pokemon freak or Pikmin freak?
    It would be "pkmnfrk". I picked the nick in grade 5, and I now regret it, 9 years later.
    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. #9
    Gibdo beefster09's Avatar
    Join Date
    Mar 2006
    Age
    31
    Posts
    699
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,710
    Level
    16
    vBActivity - Bars
    Lv. Percent
    97.33%

    Re: Sign post

    Look what I made from pkmnfrk's code. NPCs!

    Code:
    import "std.zh"
    
    ffc script Person {
    	void run(int m, int s) {
    		while(true) {
    			while(Link->X < this->X - 16 && Link->Dir != DIR_RIGHT || Link->X > this->X + 32 && Link->Dir != DIR_LEFT || Link->Y < this->Y - 16 && Link->Dir != DIR_DOWN || Link->Y > this->Y + 32 && Link->Dir != DIR_UP || !Link->InputA) {
    				Waitframe();
    			}
    			Link->InputA = false;
    			Screen->Message(m);
    			if(s >= 0) {
    				Game->PlaySound(s);
    			}
    
    			while(Link->X >= this->X - 16 && Link->X <= this->X + 32 && Link->Y >= this->Y - 16 && Link->Y <= this->Y + 32) {
    				Waitframe();
    			}
    			
    			Screen->Message(0);
    		}
    	}
    }
    The first argument is the string; the second is the sound.

    Whew! Glad I previewed.
    Avatar: Just who the SPAAAACE do you think I am?

  10. #10
    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.51%

    Re: Sign post

    Hmm, actually, that's not how I would code it. I'll post an NPC script in a minute.
    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