Jump to content

Photo

need an edit of the "real NPC Script"


  • Please log in to reply
2 replies to this topic

#1 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 13 July 2008 - 12:55 PM

i'm using 16x32 NPC's, but a regular sized link. So I need link to basically be able to talk to their lower halves.
however, i can't make heads or tails of this at the moment, so i would like to see if someone could make it 16x32 and even 32x32 sized NPC capatible please?

original script:
CODE
//===============//
//REAL NPC SCRIPT//
//===============//

//Instructions:

//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.


ffc script real_npc{
    void run(int m, int s, int f, int def_dir, int d){
        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; a_x = Abs(d_x);
            d_y = this->Y - Link->Y; 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;
                        else this->Data = orig_d+1;
                    }else{
                        if(d_x >= 0) this->Data = orig_d+2;
                        else this->Data = orig_d+3;
                    }
                }else{this->Data = orig_d + def_dir;}
            }
            if(Link->InputL && a_x < 24 && a_y < 24 && Link->Z == 0){
                if(s != 0) Game->PlaySound(s);
                Link->InputL = false;
                Screen->Message(m);
            }
        Waitframe();
        }
    }
}


joe wrote this one. (press L to speak, instead of A)

thanks!

Edited by Master Maniac, 13 July 2008 - 12:57 PM.


#2 Joe123

Joe123

    Retired

  • Members

Posted 13 July 2008 - 01:10 PM

QUOTE(Master Maniac @ Jul 13 2008, 06:55 PM) View Post
joe wrote this one.


'twas but a mere edit of a script by Pkmnfrk.
I do like a capital letter at the beginning of my name though.

If you replace the 'this->Y' in the script with 'this->Y+16', it should work with a 16x32 sprite.

#3 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 13 July 2008 - 01:16 PM

all of the "this->Y"'s?

EDIT: whoops. there's just one.

thanks joe!

Edited by Master Maniac, 13 July 2008 - 01:16 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users