ffc script eyesore{
void run( int foo,int bar,int barieo){ // There's no need to use names for fake integers for your real integers, you could give them names that actually describe what they do.
combo1 = ComboD[foo]; //What is this doing? It makes no sense.
combo2 = ComboD[bar]; //Same with this. int x; int y;
int speed = 2;
npc ghosted_hp_enemy1 = Screen->CreateNPC(barieo); //These lines are fine
npc ghosted_hp_enemy2 = Screen->CreateNPC(barieo);
npc ghosted_hp_enemy3 = Screen->CreateNPC(barieo);
npc ghosted_hp_enemy4 = Screen->CreateNPC(barieo);
ffc eye1 = Screen->LoadFFC(1); //And this one, although, if the script is on ffc1, there's no need to declare it within the script.
//The script references it's own ffc as 'this->'.
while(true){
eye1->Vx = speed; //Probably best not to throw too many extra space around, although I think it should compile OK anyway
eye1->Vy = speed;
ghosted_hp_enemy1->X = eye1->X;
ghosted_hp_enemy1->Y = eye1->Y;
ghosted_hp_enemy1->HP = 20; //Forgot the ';' at the end of this line
if(Abs(eye1->Y - combo1->Y)<18){ //Scope scope scope!
eye1->Vy *= -1; //I assume this line is meant to mean 'multiply eye1's speed by -1'.
//You can't just do it the way you did, you need the equals sign.
//Check this on assignment: http://www.shardstorm.com/ZCwiki/ZScript_Concepts
}
if(Abs(eye1->X - combo1->X)<18){ //Same as the last one
eye1->Vx *= -1; // You had a ':' here instead of a ';'
}
if(Abs(eye1->Y - combo2->Y)<18){
eye1-> Vy *= -1;
}
if(Abs(eye1->X - combo2->X)<18){
eye1-> Vx *= -1;
}
if( ghosted_hp_enemy1->HP == 0){ //No need to take 'Abs' here, the NPC's HP will never be less than 0.
eye1->Data = 0; //Make sure to end the line with a ';'
}
Waitframe(); //';' again.
}
}
}
//Right, I've just removed the rest of the script, because it won't function.
//If you declare 'while(true)', then only that part of the script will run and no other parts.
//At all.
//You need to compile it all into one while loop.
Scope:
}else{
if(!upcheck){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
}In this code, the scope is wrong.
}else{
if(!upcheck){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
}In this code, the scope is correct.
You can see the difference, yes?
What you have is two scopes.
The first is the 'else' requirement, and the second is the 'if' requirement.
The else is declared at two indentations.
All functions within the else are then placed at three indentations, so this includes only the if.
The if is declared at three indentations, so the functions within it are placed at four indentations.
This means that the if is closed at three indentations, not four, and the else is closed at two indentations, not three.
It is essential that you get your scope correct, otherwise reading your scripts will be a nightmare.
That spiel on scope isn't relevant to your script; it's a copy-paste from someone else's thread.
It's still very relevant however.