Jump to content

Photo

A complex (or not?) burn puzzle


  • Please log in to reply
25 replies to this topic

#16 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 06:04 PM

CODE

ffc script MultiTorch{
    int torch_cap(ffc this){
        int count=0;
        for(int i=1; i<=32; i++){
            ffc f=Screen->LoadFFC(i);
            if(f->Script==this->Script){
                count++;
            }
        }
        return count;
    }
    bool AllLit(ffc this){
        for(int i=0; i<=torch_cap(this); i++){
            if(Screen->D[i]==0){
                return false;
            }
        }
        return true;
    }
    void run(int torch_number){
        if(Screen->D[torch_number]==1){
            Screen->ComboD[ComboAt(this->X+8, this->Y+8)]++;
        }
        else while(true){
            if(AllLit(this)&&Screen->State[ST_SECRET]==false){
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET]=true;
                Game->PlaySound(SFX_SECRET);
            }
            for(int i=1; i<=Screen->NumLWeapons(); i++){
                lweapon l=Screen->LoadLWeapon(i);
                if(l->ID==LW_FIRE&&Distance(l->X, l->Y, this->X, this->Y)<16&&Screen->D[torch_number]==0){
                    Screen->ComboD[ComboAt(this->X+8, this->Y+8)]++;
                    Screen->D[torch_number]=1;
                }
            }
            Waitframe();
        }
    }
}

I have no idea how I missed the error that caused all this or why it worked in my test file, but this one should work.

#17 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 06:09 PM

Thanks icon_smile.gif I'll try it.

#18 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 10 October 2012 - 05:03 AM

I'm afraid it still does the same thing, the only thing changed in the script is the line:

if(f->Script==this->Script){

Correct? Or did I miss something else?

Also, I have simply updated the script. Do I need to create the ffc combos again or do something else than update the script?

#19 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 10 October 2012 - 07:27 AM

CODE
ffc script MultiTorch{
    bool AllLit(ffc this){
        for(int i=0; i<=CountFFCsRunning(this->Script)-1; i++){
            if(Screen->D[i]==0){
                return false;
            }
        }
        return true;
    }
    void run(){
        int combo=Screen->ComboD[ComboAt(this->X+8, this->Y+8)];
        ffc f=Screen->LoadFFC(FindNthFFCRunning(this->Script, 1));
        for(int i=1; i<=CountFFCsRunning(this->Script); i++){
            ffc assign=Screen->LoadFFC(FindNthFFCRunning(this->Script, i));
            assign->Misc[0]=i-1;
        }
        while(true){
            if(Screen->D[this->Misc[0]]==1&&Screen->ComboD[ComboAt(this->X+8, this->Y+8)]!=combo+1){
                Screen->ComboD[ComboAt(this->X+8, this->Y+8)]=combo+1;
            }
            if(this==f&&AllLit(this)&&Screen->State[ST_SECRET]==false){
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET]=true;
                Game->PlaySound(SFX_SECRET);
            }
            for(int i=1; i<=Screen->NumLWeapons(); i++){
                lweapon l=Screen->LoadLWeapon(i);
                if(l->ID==LW_FIRE&&Distance(l->X, l->Y, this->X, this->Y)<16&&Screen->D[this->Misc[0]]==0){
                    Screen->ComboD[ComboAt(this->X+8, this->Y+8)]=combo+1;
                    Screen->D[this->Misc[0]]=1;
                }
            }
            Waitframe();
        }
    }
}

Ok. This one is a major overhaul. You shouldn't have to set the D0 value any more, it uses ffcscript.zh (don't forget to import it right under std.zh), and best of all it should probably work! icon_biggrin.gif

I have no idea why the other one didn't work considering I tested it in your quest file that you sent me and it worked fine. Hopefully third time's the charm?

#20 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 10 October 2012 - 08:01 AM

Bah, still not, but FFCs and scripting are still dark and mysterious to me. I didn't have ffcscript.zh but downloaded it from your link and imported it under std.zh like you said.

Now the torches don't stay lit? icon_confused.gif I've removed the D0 numbers (changed them all to 0.0000) and typed the script carefully (by the way, is it not possible to copy/paste from an outside source?? that would save time).

Would you mind sending me back the quest snippet I've sent you with everything working? That might be easier as I don't know what I'm doing wrong.

Edited by Jamian, 10 October 2012 - 08:03 AM.


#21 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 10 October 2012 - 01:43 PM

That would explain the problem. In the script buffer, click export and save your script as a .z file. Open up that file in Notepad (or TextEdit on a Mac) and paste in my script. Then import the new script file and compile it. You're probably making a tiny error when typing it out again, which this should fix.

#22 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 10 October 2012 - 02:08 PM

Ok I must have been making a tiny mistake indeed because it......................... almostworks now icon_biggrin.gif

The secret is revealed upon lighting the third torch, and the torches remain lit after you leave the room, which is already pretty good... the thing is the secret is not permanent. If I leave the room then reenter, it will have disappeared. (and as you know from looking at my snippet, the secret is a block disappearing and clearing the way, so I can't have it reappearing it afterwards or the player will be blocked) Are there any flags or something that I should check to make this block permanently disappear?

#23 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 10 October 2012 - 02:36 PM

Oh. I think it has something to do with your screens being NES dungeon screens. Try making it an interior screen.

#24 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 10 October 2012 - 02:38 PM

Phew!!!! And that did it! icon_smile.gif

One last question, if I ever distribute this, do I need to include ffcscript.zh in the quest package?

#25 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 10 October 2012 - 02:58 PM

Once compiled, all scripts are stored within the quest file itself, so no, you don't need to package ffcscript.zh or your main script file with your quest.

#26 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 10 October 2012 - 03:08 PM

Thanks.

And thanks a lot Moosh, if I ever release this quest I'll make sure to credit you icon_smile.gif


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users