does any body know why I get the error "Error line 26:Function Input was already declared with that type signature"
when I compile this script?
Spoiler
ffc script GB_NPC_Normal { void run(int msg, int direction_enabled, int direction, int distance, int solid) { int dir_x; // The direction x int dir_y; // The direction y int anim_x; // The animtion x int anim_y; // The animtion y int offset_w = (this->TileWidth * 16 - 16 ); // The tile offset width int offset_h = (this->TileHeight * 16 - 16 ); // The tile offset height int orig_dir = this->Data; // The original direction int input; // weather there is currently input while(true) { Message(message); Direct(direction_enabled, direction, distance); Solid(solid); Waitframe(); } } } //This detects if A was pressed, allowing you to exit messages with the A button bool Input(int var) { if (Link->InputA) { if (var == 1) { var = 0; } else { if (var == 0) { var = 1; } } } else { var = 0; } return var; } //This detects if link is on the edge of the screen bool OnScreenEdge() { if (Link->X<8 || Link->Y<8 || Link->X>232 || Link->Y>152) { return 1; } return 0; } //This checks if you're above or below the NPC to create an overhead effect void Depth() { if (Link->Y<this->Y-8+tho && onscreenedge==0){this->Flags[FFCF_OVERLAY] = true;} else {this->Flags[FFCF_OVERLAY] = false;} } void Message(int message) { if(Input(input) && anim_x < 24 && anim_y < 24) if ((Link->X < this->X + offset_w - 8 && Link->Y > this->Y + offset_h - 12 && Link->Y < this->Y + offset_h + 8 && Link->Dir == DIR_RIGHT) || (Link->X > this->X + offset_w + 8 && Link->Y > this->Y + offset_h - 12 && Link->Y < this->Y + offset_h + 8 && Link->Dir == DIR_LEFT) || (Link->Y < this->Y + offset_h - 8 && Link->X > this->X + offset_w - 8 && Link->X < this->X + offset_w + 8 && Link->Dir == DIR_DOWN) || (Link->Y > this->Y + offset_h + 8 && Link->X > this->X + offset_w - 8 && Link->X < this->X + offset_w + 8 && Link->Dir == DIR_UP)) { imput = 0; Screen->Message(message); Link->InputA = false; } } void Direct(int enabled, int direction, int distance) { dir_x = this->X + (this->TileWidth * 16 - 16) - Link->X; dir_y = this->Y + (this->TileHeight * 16 - 16) - Link->Y; anim_x = Abs(dir_x); anim_y = Abs(dir_y); if(enabeld != 0) { if(anim_x < distance && anim_y < distance) { if(anim_x <= anim_y) { if(dir_y >= 0) { this->Data = orig_dir + DIR_DOWN; } else { this->Data = orig_dir + DIR_UP; } } else { if(dir_x >= 0) { this->Data = orig_dir + DIR_LEFT; } else { this->Data = orig_dir + DIR_RIGHT; } } } else { this->Data = orig_dir + direction; } } if (this->Vy>0)this->Data = orig_d + DIR_UP; if (this->Vy<0)this->Data = orig_d + DIR_DOWN; if (this->Vx>0)this->Data = orig_d + DIR_RIGHT; if (this->Vx<0)this->Data = orig_d + DIR_LEFT; } void SnapHorizontal(int min, int max) { int offset_h = (this->TileWidth*16-16); int snap = 0; if (max > 0) { if ((Link->X > min-32) && (Link->X < max + 32) && (Link->Y > this->Y + offset_h - 32) && (Link->Y < this->Y + offset_h + 32)) { snap = 1; } if ((Link->X < this->X - 2) && (this->X > min) && (snap == 1)) { if (Link->X > min){ this->Vx = ( -this->X + Link->X) / 4; } else { this->Vx = ( -this->X + min)/4; } } if ((Link->X > this->X + 2) && (this->X < max) && (snap == 1)) { if (Link->X < max) { this->Vx = ((Link->X - this->X)/4); } else{ this->Vx = (max - this->X)/4; } } if ((Link->X < this->X + 2) && (Link->X > this->X - 2)) { this->Vx = 0; } if (snap == 0) { this->Vx = 0; } if (this->X < min + 1) { if (this->Vx < 0) { this->Vx = 0; } this->X = min; } if (this->X > max - 1){ if (this->Vx > 0) { this->Vx=0; } this->X = max; } } } void SnapVertical(int min, int max) { int offset_w = (this->TileHeight*16-16); int snap = 0; if (max > 0) { if ((Link->Y > min-32) && (Link->Y < max + 32) && (Link->X > this->X + offset_w - 32) && (Link->X < this->X + offset_w + 32)) { snap = 1; } if ((Link->Y < this->Y - 2) && (this->Y > min) && (snap == 1)) { if (Link->Y > min){ this->Vy = ( -this->Y + Link->Y) / 4; } else { this->Vy = ( -this->Y + min)/4; } } if ((Link->Y > this->Y + 2) && (this->Y < max) && (snap == 1)) { if (Link->Y < max) { this->Vy = ((Link->Y - this->Y)/4); } else{ this->Vy = (max - this->Y)/4; } } if ((Link->Y < this->Y + 2) && (Link->Y > this->Y - 2)) { this->Vy = 0; } if (snap == 0) { this->Vy = 0; } if (this->Y < min + 1) { if (this->Vy < 0) { this->Vy = 0; } this->Y = min; } if (this->Y > max - 1){ if (this->Vy > 0) { this->Vy=0; } this->Y = max; } } } void Solid(int solid) { // hopefully this is the tile offset. // tell me if its not. int woffset = (this->TileWidth*16-16); int hoffset = (this->TileHeight*16-16); if (solid > 0) { //hopefully this is the order. //top if ((Abs(Link->Y - this->Y-hoffset) < 10) && (Link->X >= this->X + woffset - 12) && (Link->X < this->X + woffset - 8)) { Link->X = this->X + woffset - 12; } //bottom if ((Abs(Link->Y - this->Y-hoffset) < 10) && (Link->X <= this->X + woffset + 12) && (Link->X > this->X + woffset + 8)) { Link->X = this->X + woffset + 12; } //left if ((Abs(Link->X - this->X-woffset) < 10) && (Link->Y >= this->Y + hoffset - 12) && (Link->Y < this->Y + hoffset - 8)) { Link->Y = this->Y + hoffset - 12; } //right if ((Abs(Link->X - this->X-woffset) < 10) && (Link->Y <= this->Y + hoffset + 12) && (Link->Y > this->Y + hoffset + 8)) { Link->Y = this->Y + hoffset + 12; } } }
its a rewrite of Lemmy Koopa's NPC script
I basicly just put everything into a function so I can easily expand it and make different type of npc's
I even tried to change it to MessageInput()
Edited by Shadowblitz16, 31 October 2016 - 06:20 PM.