PDA

View Full Version : Button->NextCombo Flag



CJC
05-18-2008, 08:19 PM
Hi! I know I've been posting a lot in here as of late, but I'm setting up a pretty complex quest template and it requires a lot of scripted components. I can usually work it out once I have a basic snapshot, but from scratch I'm completely lost.


What I'm looking for is a flag that I can attach to a combo (Be it inherant or just on top) that cause the combo to shift to the next combo if Link presses the "R" button within 8 pixels.

I'd also like it to be facing-specific, but that is not a requirement. I can probably jigger something once a basic setup is in play.



const int activateflag = 102;

ffc script ActionButtonR{
void run(){

//Flag-Based Movement Code
int lc;

while(true){

//Flag-Based Movement Code
lc = ComboAt(Link->X+8, Link->Y+15);
if(Screen->ComboF[lc] == activateflag || Screen->ComboI[lc] == activateflag){
//???
Link->InputR = False;
}
Waitframe();
}
}
}


(I'll be making one more script request after this, and then probably disappear for a while).

Joe123
05-19-2008, 07:14 AM
const int activateflag = 102;

ffc script ActionButtonR{
void run(){
int d;
while(true){
while(!Link->InputR) Waitframe();
d = Link->Dir;
if(d==0){
if(Screen->ComboF[ComboAt(Link->X,Link->Y-8)] == activateflag || Screen->ComboI[ComboAt(Link->X,Link->Y-8)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y-8)]++;
Link->InputR = false;
}else if(d==1){
if(Screen->ComboF[ComboAt(Link->X,Link->Y+24)] == activateflag || Screen->ComboI[ComboAt(Link->X,Link->Y+24)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y+24)]++;
Link->InputR = false;
}else if(d==2){
if(Screen->ComboF[ComboAt(Link->X-8,Link->Y)] == activateflag || Screen->ComboI[ComboAt(Link->X-8,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X-8,Link->Y)]++;
Link->InputR = false;
}else{
if(Screen->ComboF[ComboAt(Link->X+24,Link->Y)] == activateflag || Screen->ComboI[ComboAt(Link->X+24,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X+24,Link->Y)]++;
Link->InputR = false;
}
}
}
}

It's facing specific.

CJC
05-19-2008, 01:59 PM
This code works really well, thanks!

I tried to set up a different flag to deactivate, but it caused freezing. But then I achieve the same effect with combo cycling.


I have one more request, if you can help me. I tried to achieve this on my own, but couldn't pull it off.



const int activateflag = 102;

ffc script ActionButtonR{
void run(){
int d;
while(true){
while(!Link->InputR) Waitframe();
d = Link->Dir;
if(d==0){
if(Screen->ComboI[ComboAt(Link->X,Link->Y-8)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y-8)]++;
Link->InputR = false;
}else if(d==1){
if(Screen->ComboI[ComboAt(Link->X,Link->Y+24)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y+24)]++;
Link->InputR = false;
}else if(d==2){
if(Screen->ComboI[ComboAt(Link->X-8,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X-8,Link->Y)]++;
Link->InputR = false;
}else{
if(Screen->ComboI[ComboAt(Link->X+24,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X+24,Link->Y)]++;
Link->InputR = false;
}
}
}
}


The above is a version of your code with the flag detection turned off (So it only triggers over inherent flags.)

I'd like to set it up so that triggering an inherent flag with the code causes any regular flags of number 102 on screen to move to the next combo (So I can have remote switches). Obviously detection in relation to Link's position would be impossible, so I did the following:



if(Screen->ComboF == activateflag) Screen->ComboD[ComboAt(ComboF == activateflag)]++;

I thought this would work (Any combos with ComboF == activateflag would move up one combo), but I get an error message telling me that "ComboAt" does not have use an integer F. Any ideas?

Joe123
05-19-2008, 05:47 PM
const int activateflag = 102;

ffc script ActionButtonR{
void run(){
int d; bool r; int i;
while(true){
while(!Link->InputR) Waitframe();
d = Link->Dir;
if(d==0){
if(Screen->ComboI[ComboAt(Link->X,Link->Y-8)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y-8)]++;
r = true;
Link->InputR = false;
}else if(d==1){
if(Screen->ComboI[ComboAt(Link->X,Link->Y+24)] == activateflag) Screen->ComboD[ComboAt(Link->X,Link->Y+24)]++;
r = true;
Link->InputR = false;
}else if(d==2){
if(Screen->ComboI[ComboAt(Link->X-8,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X-8,Link->Y)]++;
r = true;
Link->InputR = false;
}else{
if(Screen->ComboI[ComboAt(Link->X+24,Link->Y)] == activateflag) Screen->ComboD[ComboAt(Link->X+24,Link->Y)]++;
r = true;
Link->InputR = false;
}
if(r){
for(i=0;i<176;i++) if(Screen->ComboF[i] == activateflag) Screen->ComboD[i]++;
r = false;
}
}
}
}

CJC
05-19-2008, 08:00 PM
Something we both overlooked.
While the code changes a combo, it has absolutely no effect on the flag over that combo (Which I hadn't considered, having believed all secret activation removes the flag).

To circumvent this, I've traded the rolls of inherent and basic flags, and added more requirements.

For the switches (Which turn the change on, and through combo cycling can turn it off again), both the regular and the inherent flag must be on the tile to activate.
For the changed tiles, they must contain the inherent flag 102 to change. The changed tiles could continue to contain this flag, but it is recommended to use at least one combo cycle before placing another 102 inherent flag.
As far as I know, if flag 102 is place on a regular tile with no 102 inherent flag, it should serve no purpose. Just to be safe, DON'T use the flag without the inherent switch flag on the combo.


ffc script ActionButtonR{
void run(){
int d; bool r; int i;
while(true){
while(!Link->InputR) Waitframe();
d = Link->Dir;
if(d==0){
if((Screen->ComboF[ComboAt(Link->X,Link->Y-8)] == activateflag) && (Screen->ComboI[ComboAt(Link->X,Link->Y-8)] == activateflag)) Screen->ComboD[ComboAt(Link->X,Link->Y-8)]++;
r = true;
Link->InputR = false;
}else if(d==1){
if((Screen->ComboF[ComboAt(Link->X,Link->Y+24)] == activateflag) && (Screen->ComboI[ComboAt(Link->X,Link->Y+24)] == activateflag)) Screen->ComboD[ComboAt(Link->X,Link->Y+24)]++;
r = true;
Link->InputR = false;
}else if(d==2){
if((Screen->ComboF[ComboAt(Link->X-8,Link->Y)] == activateflag) && (Screen->ComboI[ComboAt(Link->X-8,Link->Y)] == activateflag)) Screen->ComboD[ComboAt(Link->X-8,Link->Y)]++;
r = true;
Link->InputR = false;
}else{
if((Screen->ComboF[ComboAt(Link->X+24,Link->Y)] == activateflag) && (Screen->ComboI[ComboAt(Link->X+24,Link->Y)] == activateflag)) Screen->ComboD[ComboAt(Link->X+24,Link->Y)]++;
r = true;
Link->InputR = false;
}
if(r){
for(i=0;i<176;i++) if(Screen->ComboI[i] == activateflag) Screen->ComboD[i]++;
r = false;
Waitframes (60);
}
}
}
}


Thank you so much Joe, this is awesome!

Joe123
05-20-2008, 02:51 AM
Something we both overlooked.
While the code changes a combo, it has absolutely no effect on the flag over that combo (Which I hadn't considered, having believed all secret activation removes the flag).

I didn't overlook this, I thought it was unusual.
You just didn't ask me to change it so I assumed you wanted it that way.