summaryrefslogblamecommitdiff
path: root/npc/007-1/torches.txt
blob: dbcf1b9a9f692b0c0f51915d62a9b7e74143861b (plain) (tree)

































                                                                                                  
                               















































































































                                                                                                                 
// TMW-2 script.
// Author:
//    Crazyfefe
//    Jesusalva
// Description:
//    Torches
// Variables:
//    TulimsharQuest_DarkInvocator
// Values:
//    0    Default.
//    1    Quest Found.
//    2    Quest Accepted.
//    3    Bomb Defused.
//    4    Quest Completed.


function	script	CheckTorch	{
    @torch_count = 0;
    @count_tmp = 0;
    if (debug)
        npctalk3 l("Hello, I am T-@@, of the @@ order.", @torch, $@TorchBits[@torch]);
    if (getq2(TulimsharQuest_DarkInvocator) & $@TorchBits[@torch])
        goto L_Empty;
    if (countitem(EverburnPowder) <= 0) {
        dispbottom(l("I do not have Everburn Powder to lit the torch."));
        end;
    }
    setq2 TulimsharQuest_DarkInvocator, getq2(TulimsharQuest_DarkInvocator) | $@TorchBits[@torch];

    goto L_Loop;

L_TorchTally:
    specialeffect(53);
    specialeffect(54);
    getmapxy(.@m, .@x, .@y, 0);

    switch (@torch_count) {
        case 1:
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 3, "Zarkor::OnMonster";
            break;
        case 2:
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 3, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 1, "Zarkor::OnMonster";
            break;
        case 3:
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 4, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 3, "Zarkor::OnMonster";
            break;
        case 4:
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Black Scorpion", BlackScorpion, 1, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 1, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 4, "Zarkor::OnMonster";
            break;
        case 5:
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Black Scorpion", BlackScorpion, 2, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 2, "Zarkor::OnMonster";
            areamonster .@m, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 5, "Zarkor::OnMonster";
            break;
    }

    delitem EverburnPowder, 1;
    if (@torch_count == 5) {
        message strcharinfo(0), l("All torches are lit!");
        //killmonsterall("007-1");
        setq1 TulimsharQuest_DarkInvocator, 6;
    }

    return;

L_Loop:
    while (@count_tmp < 5) {
        @count_tmp = (@count_tmp + 1);
        if (getq2(TulimsharQuest_DarkInvocator) & $@TorchBits[@count_tmp])
            @torch_count = (@torch_count + 1);
    }
    goto L_TorchTally;

L_Empty:
    message strcharinfo(0), l("This torch is already lit.");
    return;

}

007-1,166,145,0	script	Torch#1	NPC_NO_SPRITE,{
    @torch = 1;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    // Remember: array start at zero, but barrels count start at 1. "Fixing" may break torch 5!
    setarray $@TorchBits, (1 << 1), (1 << 2), (1 << 3), (1 << 4), (1 << 5), (1 << 6);
    .sex = G_OTHER;
    .distance = 1;
    end;
}

007-1,65,116,0	script	Torch#2	NPC_NO_SPRITE,{
    @torch = 2;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}

007-1,62,133,0	script	Torch#3	NPC_NO_SPRITE,{
    @torch = 3;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}
007-1,35,125,0	script	Torch#4	NPC_NO_SPRITE,{
    @torch = 4;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}
007-1,139,24,0	script	Torch#5	NPC_NO_SPRITE,{
    @torch = 5;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}