I would really like one, it would make the story line so much easier to put together. If anyone could send me a link or post one here it would be lovely.
I am using build 984
Can anyone give me an npc script for the new beta?
Started by
zombie gen
, Mar 29 2009 12:11 PM
4 replies to this topic
#1
Posted 29 March 2009 - 12:11 PM
#2
Posted 29 March 2009 - 01:34 PM
CODE
//remove this line if you already have a script file.
import "std.zh"
ffc script Real_NPC {
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);
}
}
}
D0 - the message string i.d to play
and that's all there is to it.
*CREDITS* go to mike (pkmnfrk)
#3
Posted 29 March 2009 - 04:20 PM
Uh...
That one's for signposts...
D0 is the message string to play, D1 is whether you want the character to face Link, and D2 is how close you have to be to the NPC for it to face you, in pixels.
With D1, '0' means the NPC won't face Link (it'll just sit still), and then if you put it as 1, 2, 3 or 4, the default direction will be up, down, left or right respectively.
That one's for signposts...
CODE
//NPCs, by Pkmnfrk
ffc script NPC{
void run(int m, int changedirection, int distance){
int dx; int dy;
int ax; int ay;
int orig = this->Data;
if(distance == 0) distance = 40;
while(true){
dx = this->X-Link->X; ax = Abs(dx);
dy = this->Y-Link->Y; ay = Abs(dy);
if(changedirection != 0){
if(ax < distance && ay < distance){
if(ax <= ay){
if(dy >= 0) this->Data = orig;
else this->Data = orig+1;
}else{
if(dx >= 0) this->Data = orig+2;
else this->Data = orig+3;
}
}else this->Data = orig+(changedirection-1);
}
if(Link->InputA && ax < 24 && ay < 24 && Link->Z == 0){
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA)
}
Waitframe();
}
}
}
ffc script NPC{
void run(int m, int changedirection, int distance){
int dx; int dy;
int ax; int ay;
int orig = this->Data;
if(distance == 0) distance = 40;
while(true){
dx = this->X-Link->X; ax = Abs(dx);
dy = this->Y-Link->Y; ay = Abs(dy);
if(changedirection != 0){
if(ax < distance && ay < distance){
if(ax <= ay){
if(dy >= 0) this->Data = orig;
else this->Data = orig+1;
}else{
if(dx >= 0) this->Data = orig+2;
else this->Data = orig+3;
}
}else this->Data = orig+(changedirection-1);
}
if(Link->InputA && ax < 24 && ay < 24 && Link->Z == 0){
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA)
}
Waitframe();
}
}
}
D0 is the message string to play, D1 is whether you want the character to face Link, and D2 is how close you have to be to the NPC for it to face you, in pixels.
With D1, '0' means the NPC won't face Link (it'll just sit still), and then if you put it as 1, 2, 3 or 4, the default direction will be up, down, left or right respectively.
#4
Posted 29 March 2009 - 11:28 PM
Uh...
That one's for signposts...
CODE
//NPCs, by Pkmnfrk
ffc script NPC{
void run(int m, int changedirection, int distance){
int dx; int dy;
int ax; int ay;
int orig = this->Data;
if(distance == 0) distance = 40;
while(true){
dx = this->X-Link->X; ax = Abs(dx);
dy = this->Y-Link->Y; ay = Abs(dy);
if(changedirection != 0){
if(ax < distance && ay < distance){
if(ax <= ay){
if(dy >= 0) this->Data = orig;
else this->Data = orig+1;
}else{
if(dx >= 0) this->Data = orig+2;
else this->Data = orig+3;
}
}else this->Data = orig+(changedirection-1);
}
if(Link->InputA && ax < 24 && ay < 24 && Link->Z == 0){
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA)
}
Waitframe();
}
}
}
ffc script NPC{
void run(int m, int changedirection, int distance){
int dx; int dy;
int ax; int ay;
int orig = this->Data;
if(distance == 0) distance = 40;
while(true){
dx = this->X-Link->X; ax = Abs(dx);
dy = this->Y-Link->Y; ay = Abs(dy);
if(changedirection != 0){
if(ax < distance && ay < distance){
if(ax <= ay){
if(dy >= 0) this->Data = orig;
else this->Data = orig+1;
}else{
if(dx >= 0) this->Data = orig+2;
else this->Data = orig+3;
}
}else this->Data = orig+(changedirection-1);
}
if(Link->InputA && ax < 24 && ay < 24 && Link->Z == 0){
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA)
}
Waitframe();
}
}
}
D0 is the message string to play, D1 is whether you want the character to face Link, and D2 is how close you have to be to the NPC for it to face you, in pixels.
With D1, '0' means the NPC won't face Link (it'll just sit still), and then if you put it as 1, 2, 3 or 4, the default direction will be up, down, left or right respectively.
Whooops!
is this one the newest newest one?
#5
Posted 30 March 2009 - 09:24 AM
Well no, that one was my take on it.
The message won't repeat after speaking to them, and I reduced the number of arguments.
Pretty much the same otherwise though.
The message won't repeat after speaking to them, and I reduced the number of arguments.
Pretty much the same otherwise though.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users