Alright! So far I had 2 scripts working:
For exp:
import "std.zh"
ffc script RealNPC{
void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
ffc NPC = this;
if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
NPC->Misc[0] = NPC->Data;
if(d == 0) d = 40;
while(true){
SetGraphic(NPC,defdir,d);
if(CanTalk(NPC,input)){
SetInput(input,false);
if(sfx != 0) Game->PlaySound(sfx);
Screen->Message(m);
}
Waitframe();
}
}
bool CanTalk(ffc NPC,int input){
return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
}
void SetGraphic(ffc NPC, int defdir, int d){
int dx = NPC->X-Link->X; int ax = Abs(dx);
int dy = NPC->Y-Link->Y; int ay = Abs(dy);
if(defdir != 0){
if(ax < d && ay < d){
if(ax <= ay){
if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
else NPC->Data = NPC->Misc[0]+DIR_DOWN;
}else{
if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
}
}else NPC->Data = NPC->Misc[0]+(defdir-1);
}
}
}
//Only include these two functions once in your script file
bool SelectPressInput(int input){
if(input == 0) return Link->PressA;
else if(input == 1) return Link->PressB;
else if(input == 2) return Link->PressL;
else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
if(input == 0) Link->InputA = state;
else if(input == 1) Link->InputB = state;
else if(input == 2) Link->InputL = state;
else if(input == 3) Link->InputR = state;
}
//**************************************************************************************//
//**************************************************************************************//
ffc script stepWithItem{
void run(int triggerItem1){
while(!Screen->State[ST_SECRET]){
if ( Link->Item[triggerItem1] && DistanceFromLink(this->X+8, this->Y+8) <= 8 ){
Screen->TriggerSecrets();
Screen->State[ST_SECRET] = true;
Game->PlaySound(27);
}
Waitframe();
}
}
}
//Returns distance to Link's center
int DistanceFromLink ( int x, int y )
{
return Distance ( Link->X+8, Link->Y+8, x, y );
}
Now I go to add:
http://www.purezc.ne...showtopic=53411
this scrip, and combine it as normal, I get an error.
First error was on line I think 16 ""){""
I removed that and it seems to have solved that issue.
Now I am getting error on this line
else splashTimer = splashFreq;
Here is a bastebin link to how I how the script set up: http://pastebin.com/3wDwhQMg
Edited by LTTP, 26 May 2013 - 10:14 AM.

