...! Well, it's permanent! But, it places combo 0 where the lock block goes, and can only work on one at a time. (Like, you can unlock one, but not the other, and when you enter the screen again, both are unlocked). But, I honestly can't really follow your script. (I probably could if I really just sat down and looked, but I'm so tired of looking at my computer screen, I'm hardly alive posting this reply right now!
) Your script also had a bit of trouble compiling, as it said that variable sfx was undeclared (in the unlock function you made, but I declared it myself, so no worries). But I'm sure you could fix up those problems relatively quickly!
... Heh, but I've done way too much work to just have the script I've been writing sit on my computer! ^^'
Your script did remind me about the Screen->D variables, which are saved with the game!
So, I used my idea, coupled with your Screen->D variables, and expanded it (literally... probably a bit too much).
CODE
ffc script LockBlockNew{
void run(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){
while(true){
int block0 = ComboAt(this->X, this->Y);
int block1 = ComboAt(x1, y1);
int block2 = ComboAt(x2, y2);
int block3 = ComboAt(x3, y3);
int block4 = ComboAt(x4, y4);
if(this->X != 0 && this->Y != 0 && Link->Dir == 0 && Link->InputUp && Link->Action == 1 && Screen->ComboD[block0] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[0] == 0 && Link->X >= this->X - 8 && Link->X <= this->X + 8 && Link->Y == this->Y + 8){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[0] = 1;
}
else if(this->X != 0 && this->Y != 0 && Link->Dir == 1 && Link->InputDown && Link->Action == 1 && Screen->ComboD[block0] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[0] == 0 && Link->X >= this->X - 8 && Link->X <= this->X + 8 && Link->Y == this->Y - 16){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[0] = 1;
}
else if(this->X != 0 && this->Y != 0 && Link->Dir == 2 && Link->InputLeft && Link->Action == 1 && Screen->ComboD[block0] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[0] == 0 && Link->X == this->X + 16 && Link->Y <= this->Y + 2 && Link->Y >= this->Y - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[0] = 1;
}
else if(this->X != 0 && this->Y != 0 && Link->Dir == 3 && Link->InputRight && Link->Action == 1 && Screen->ComboD[block0] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[0] == 0 && Link->X == this->X - 16 && Link->Y <= this->Y + 2 && Link->Y >= this->Y - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[0] = 1;
}
else if(Screen->D[0] == 1){
Screen->ComboD[block0] = floorcombo;
}
//==============================================================
if(x1 != 0 && y1 != 0 && Link->Dir == 0 && Link->InputUp && Link->Action == 1 && Screen->ComboD[block1] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[1] == 0 && Link->X >= x1 - 8 && Link->X <= x1 + 8 && Link->Y == y1 + 8){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[1] = 1;
}
else if(x1 != 0 && y1 != 0 && Link->Dir == 1 && Link->InputDown && Link->Action == 1 && Screen->ComboD[block1] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[1] == 0 && Link->X >= x1 - 8 && Link->X <= x1 + 8 && Link->Y == y1 - 16){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[1] = 1;
}
else if(x1 != 0 && y1 != 0 && Link->Dir == 2 && Link->InputLeft && Link->Action == 1 && Screen->ComboD[block1] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[1] == 0 && Link->X == x1 + 16 && Link->Y <= y1 + 2 && Link->Y >= y1 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[1] = 1;
}
else if(x1 != 0 && y1 != 0 && Link->Dir == 3 && Link->InputRight && Link->Action == 1 && Screen->ComboD[block1] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[1] == 0 && Link->X == x1 - 16 && Link->Y <= y1 + 2 && Link->Y >= y1 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[1] = 1;
}
else if(Screen->D[1] == 1){
Screen->ComboD[block1] = floorcombo;
}
//==============================================================
if(x2 != 0 && y2 != 0 && Link->Dir == 0 && Link->InputUp && Link->Action == 1 && Screen->ComboD[block2] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[2] == 0 && Link->X >= x2 - 8 && Link->X <= x2 + 8 && Link->Y == y2 + 8){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[2] = 1;
}
else if(x2 != 0 && y2 != 0 && Link->Dir == 1 && Link->InputDown && Link->Action == 1 && Screen->ComboD[block2] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[2] == 0 && Link->X >= x2 - 8 && Link->X <= x2 + 8 && Link->Y == y2 - 16){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[2] = 1;
}
else if(x2 != 0 && y2 != 0 && Link->Dir == 2 && Link->InputLeft && Link->Action == 1 && Screen->ComboD[block2] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[2] == 0 && Link->X == x2 + 16 && Link->Y <= y2 + 2 && Link->Y >= y2 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[2] = 1;
}
else if(x2 != 0 && y2 != 0 && Link->Dir == 3 && Link->InputRight && Link->Action == 1 && Screen->ComboD[block2] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[2] == 0 && Link->X == x2 - 16 && Link->Y <= y2 + 2 && Link->Y >= y2 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[2] = 1;
}
else if(Screen->D[2] == 1){
Screen->ComboD[block2] = floorcombo;
}
//==============================================================
if(x3 != 0 && y3 != 0 && Link->Dir == 0 && Link->InputUp && Link->Action == 1 && Screen->ComboD[block3] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[3] == 0 && Link->X >= x3 - 8 && Link->X <= x3 + 8 && Link->Y == y3 + 8){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[3] = 1;
}
else if(x3 != 0 && y3 != 0 && Link->Dir == 1 && Link->InputDown && Link->Action == 1 && Screen->ComboD[block3] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[3] == 0 && Link->X >= x3 - 8 && Link->X <= x3 + 8 && Link->Y == y3 - 16){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[3] = 1;
}
else if(x3 != 0 && y3 != 0 && Link->Dir == 2 && Link->InputLeft && Link->Action == 1 && Screen->ComboD[block3] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[3] == 0 && Link->X == x3 + 16 && Link->Y <= y3 + 2 && Link->Y >= y3 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[3] = 1;
}
else if(x3 != 0 && y3 != 0 && Link->Dir == 3 && Link->InputRight && Link->Action == 1 && Screen->ComboD[block3] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[3] == 0 && Link->X == x3 - 16 && Link->Y <= y3 + 2 && Link->Y >= y3 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[3] = 1;
}
else if(Screen->D[3] == 1){
Screen->ComboD[block3] = floorcombo;
}
//==============================================================
if(x4 != 0 && y4 != 0 && Link->Dir == 0 && Link->InputUp && Link->Action == 1 && Screen->ComboD[block4] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[4] == 0 && Link->X >= x4 - 8 && Link->X <= x4 + 8 && Link->Y == y4 + 8){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[4] = 1;
}
else if(x4 != 0 && y4 != 0 && Link->Dir == 1 && Link->InputDown && Link->Action == 1 && Screen->ComboD[block4] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[4] == 0 && Link->X >= x4 - 8 && Link->X <= x4 + 8 && Link->Y == y4 - 16){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[4] = 1;
}
else if(x4 != 0 && y4 != 0 && Link->Dir == 2 && Link->InputLeft && Link->Action == 1 && Screen->ComboD[block4] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[4] == 0 && Link->X == x4 + 16 && Link->Y <= y4 + 2 && Link->Y >= y4 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[4] = 1;
}
else if(x4 != 0 && y4 != 0 && Link->Dir == 3 && Link->InputRight && Link->Action == 1 && Screen->ComboD[block4] == newblock && Game->Counter[CR_KEYS] >= 1 && Screen->D[4] == 0 && Link->X == x4 - 16 && Link->Y <= y4 + 2 && Link->Y >= y4 - 2){
Waitframes(10);
Game->PlaySound(lbnsfx);
Game->Counter[CR_KEYS] --;
Screen->D[4] = 1;
}
else if(Screen->D[4] == 1){
Screen->ComboD[block4] = floorcombo;
}
Waitframe();
}
}
}
Now I
know there has got to be a simpler way of writing that, but I couldn't think of any then, so I just left it the long way.
But, here's how you work it. (and it works correctly, as far as I can tell) You first place the FFC on any block you want to be your lockblock. Then you set the arguments.
D0 and D1 - the X and Y values for the second lock block.
D2 and D3 - the X and Y values for the third lock block.
D4 and D5 - the X and Y values for the fourth.
D6 and D7 - the X and Y values for the fifth.
And there you go! Now just assign the script and an invisible FFC, and you can potentially have five lockblocks on one screen, activated in any order you choose!
Oh, and Joe, don't feel like I was trying to 1-up your script or anything! I just wrote so much, I didn't want to discard it all! If you want to fix mine up (and I know it could use some fixing up), then feel free! I'd know I'd appreciate it, as well as all the other people who don't want to have to scroll through 200+ lines of code!
And thanks for the help!
Edited by AgentLym, 20 January 2010 - 10:31 PM.