User Tag List

Results 1 to 9 of 9

Thread: Simple npc modification

  1. #1
    Keese
    Join Date
    Dec 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    786
    Level
    9
    vBActivity - Bars
    Lv. Percent
    83.9%

    Simple npc modification

    This is a simple modification of the NPC script by pkmnfrk found at http://www.armageddongames.net/forum...ad.php?t=98097.

    This modification does two things. First, it prevents link from reading the string more than once without first leaving the screen (which prevents the string from starting over when you press 'a' to speed up the script or to attack an enemy sneaking up on you). Second, it allows you to search the screen for a combo, and if the combo exist, play an alternate string.

    Code:
    //real_npc by pkmnfrk and modified by King of Dwythia
    ffc script real_npc {
    	void run(int m, int s, int f, int d, int def_dir, int newcombo, int m2) {
    		int d_x; 
    		int d_y;
    		int a_x;
    		int a_y;
    		int orig_d = this->Data;
                    int CheckCombo = 0;
                    int alreadydone1 = 0;
                    int alreadydone2 = 0;
    		
    		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(newcombo != 0) {
                              for (int i = 0; i <= 176;i++) {
                                if (Screen->ComboD[i] == newcombo) {CheckCombo = 1;}
                              }
    		        }
    			
    			if(f != 0) {
    				if(a_x < d && a_y < d) {
    					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;
    				if(CheckCombo==0 && alreadydone1 == 0) {Screen->Message(m); alreadydone1 = 1;}
                                    else if (CheckCombo == 1 && alreadydone2 == 0) {Screen->Message(m2); alreadydone2 = 1;}
    			}
    			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.
    I have added two more parameters:
    5: The number of the combo to look for
    6: The number of the alternate string to display

    I can see several uses for this script. Here's the scenario that I wrote it for: Link needs to cross a bridge, but it is broken. There is a person sitting next to an unlit campfire. When link talks to him, he says "I'm cold, light my fire and I will repair the bridge". Link lights the fire, the bridge is repaired. The lit fire happens to be the combo the script is looking for, and now that it is on the screen, the guy, when talked to, will now say "Thanks".

  2. #2
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.74%

    Re: Simple npc modification

    Quote Originally Posted by King of Dwythia View Post
    First, it prevents link from reading the string more than once without first leaving the screen (which prevents the string from starting over when you press 'a' to speed up the script or to attack an enemy sneaking up on you).
    In the NPC script I'm using in NeoFirst, I just put the following lines after the Screen->Message line:
    Code:
        do {
          Waitframe();
        } while (Link->InputA);
    And it works fine.

  3. #3
    &&
    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,304
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.77%

    Re: Simple npc modification

    If you just set it so that Link speaks/reads with L or R it works fine also.

  4. #4
    Keese
    Join Date
    Dec 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    786
    Level
    9
    vBActivity - Bars
    Lv. Percent
    83.9%

    Re: Simple npc modification

    The primary purpose of the script was not to prevent the user from reading the script more than once, that was just a quick extra I added simply because it was driving me crazy. It was originally written so that when a secret combo is triggered, a new string is displayed.

    Thanks, though, I will probably use one of these ideas instead, they do seem simpler and easier to use.

  5. #5
    Octorok
    Join Date
    Jul 2006
    Location
    The Netherlands
    Age
    34
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,367
    Level
    12
    vBActivity - Bars
    Lv. Percent
    56.04%

    Re: Simple npc modification

    This is a pretty fucking awesome script. One thing that bugs me though is that white text on the light colors of the overworld is pretty hard to see. Any suggestions to fix this?
    You can take the nerd out of 4chan, but you can't take 4chan out of the nerd.

  6. #6
    Octorok
    Join Date
    Nov 2006
    Age
    29
    Posts
    463
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,770
    Level
    14
    vBActivity - Bars
    Lv. Percent
    8.22%

    Re: Simple npc modification

    You might not actually need scripts, all you need to do is edit the color the string uses. Change it from white to black, red, green, anything you want! Or you can use a simple string pane included within the wonderful string editor, whichever seems easier.

    Click here to level up my card, or be sacrificed... ^_^

    Want to see Shattered Earth, AGN's RPG, back? Got a computer that is capable of running a server? PM me!

  7. #7
    Octorok
    Join Date
    Jul 2006
    Location
    The Netherlands
    Age
    34
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,367
    Level
    12
    vBActivity - Bars
    Lv. Percent
    56.04%

    Re: Simple npc modification

    Quote Originally Posted by Din View Post
    You might not actually need scripts, all you need to do is edit the color the string uses. Change it from white to black, red, green, anything you want!
    Yes, but which color is best? Or could I maybe change the font itself, to include an outline like the font in AlttP?

    Quote Originally Posted by Din View Post
    Or you can use a simple string pane included within the wonderful string editor, whichever seems easier.
    Your ideas intrigue me and I would like to subscribe to your newsletter.
    You can take the nerd out of 4chan, but you can't take 4chan out of the nerd.

  8. #8
    Octorok
    Join Date
    Nov 2006
    Age
    29
    Posts
    463
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,770
    Level
    14
    vBActivity - Bars
    Lv. Percent
    8.22%

    Re: Simple npc modification

    Well, all you need to do for color would be to perhaps make it something a little darker, that would fit into a cave at the same time. Perhaps green? Well, if all else fails you can just go to a string and click the pane selection tile square. Then just click a 2x2 frame (or is it 3x3?) to use as a pane. But make sure that the frame's inside is black and not see through! Hope that helps a bit.

    Click here to level up my card, or be sacrificed... ^_^

    Want to see Shattered Earth, AGN's RPG, back? Got a computer that is capable of running a server? PM me!

  9. #9
    Octorok
    Join Date
    Jul 2006
    Location
    The Netherlands
    Age
    34
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,367
    Level
    12
    vBActivity - Bars
    Lv. Percent
    56.04%

    Re: Simple npc modification

    Wow, I didn't know you can do that.

    Haven't used ZC in ages, so that explains it.
    You can take the nerd out of 4chan, but you can't take 4chan out of the nerd.

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