Jump to content

Photo

A complex (or not?) burn puzzle


  • Please log in to reply
25 replies to this topic

#1 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 09:09 AM

I want to have a dungeon room with different torches the player has to light for the secret to be revealed. He has to light all the torches, though the order doesn't matter.

The thing is the torches are in different corners of the room, and they have to be accessed coming from different screens (which necessarily implies that the player leaves the screen in the meantime).

I have tried about all I've got messing with flags, screen flags, combo flags, and I can only either get a room where lighting a single torch reveals the secret immediately, or a room where you can light one torch at a time but they don't remain lit once you leave the room, thus making the puzzle impossible to solve.

Is it possible to do this without scripting?

#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 09:25 AM

Nope. Want a script?

#3 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 09:29 AM

Sure, I'd love that! Thanks in advance.

#4 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 10:50 AM

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&&this!=f){
                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();
        }
    }
}

A lot more complicated than I was expecting. Here's how you set it up:
  • Each torch needs an ffc running the script placed directly on top of it
  • Each unlit torch must have a lit torch as the combo directly after it in the list (so you'd for example have the unlit torch combo as combo 35 and the lit torch combo as combo 36)
  • Each ffc needs the flag "Run Script on Screen Init" checked
  • Each ffc needs a number on D0 starting with 0 for the first torch ffc you place and adding 1 for each consecutive one. It has just occurred to me that this can probably done automatically if I modify the script a bit. >_<
Once all the torches onscreen are lit, the secret sound will play and the secrets will trigger.

#5 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 11:25 AM

Thanks, I think I've followed all your instructions, but it doesn't work yet.

Upon lighting a torch the secret is revealed immediately (and the torch doesn't appear to be lit, even though the next combo is a lit torch like you said).

Anything I need to know about screen flags and how they should be set up for this? I don't know what's preventing it from working.

#6 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 11:28 AM

Did you set up all four torches or only one? I think it might bug out if only one is set up...

D'oh! Also, you did remember to remove the burn trigger flags from before the script was added, right?

Edited by Moosh, 09 October 2012 - 11:31 AM.


#7 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 11:31 AM

There are only three torches (does it matter that there are three instead of four? I can add a fourth one if it does)

I have set up all three.

#8 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 11:33 AM

QUOTE(Moosh @ Oct 9 2012, 10:28 AM) View Post

D'oh! Also, you did remember to remove the burn trigger flags from before the script was added, right?


No I hadn't.

I just did now but the result is that nothing triggers when I fire the candle?

Do the unlit torch combos need an inherent flag?

Edited by Jamian, 09 October 2012 - 11:35 AM.


#9 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 11:34 AM

QUOTE(Jamian @ Oct 9 2012, 10:31 AM) View Post

There are only three torches (does it matter that there are three instead of four? I can add a fourth one if it does)

I have set up all three.

It should work fine for three. I just assumed there were four because I'm a symmetry nutcase and will go out of my way to make important rooms symmetrical. I dunno what the problem is...works fine for me...

#10 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 11:42 AM

At the moment I have no flags on the torch combos, and no inherent flags for them either. Do I need some?

#11 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 11:47 AM

No, no flags needed. Are you sure you're using the combos you have placed on the ground are the ones in your combo list? The ffcs use an invisible combo, not a torch combo, right? You remembered to give each ffc a different number in D0, right? One of them should have a D0 of 0, another a D0 of 1 and the third a D0 of 2.

#12 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 11:52 AM

Which combo should I use for an "invisible combo"? ZC tells me combo 0 won't work with scripts. I have tried using an empty black combo but then the screen shows a black square instead of the torches.

Yes, each FFC has a different D0 number, 0.000, 1.000 and 2.000.

#13 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 11:53 AM

Most tilesets have combo 1 as a blank combo. If one doesn't exist, make one. Copy combo 0 onto a blank combo or something.

#14 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 09 October 2012 - 12:18 PM

Thanks. As you can see I am not familiar with FFCs yet.

It's almost working now.

I light the first torch (0.00) and all is fine.

But then if I light the second torch (1.00), the secret is revealed even though the third torch hasn't been activated.

However if I light the first torch (0.00) and then the third torch (2.00) all seems fine.... except if I leave and reenter the room then the secret will be revealed.

Is this something in the script? Or something else?

#15 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 09 October 2012 - 01:22 PM

Seems to be something in the script. Could you maybe PM me an unpassworded copy of your quest so I can see what the problem is?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users