summaryrefslogblamecommitdiff
path: root/npc/007-1/torches.txt
blob: 5dd82e21738795426c8ef7abbd9cf0d16f771fbc (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 ($@GM_OVERRIDE)
        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(62);
    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, 4, "Zarkor::OnMonster";
            break;
        case 2:
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 5, "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, 6, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 5, "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, 6, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 7, "Zarkor::OnMonster";
            break;
        case 5:
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Black Scorpion", BlackScorpion, 3, "Zarkor::OnMonster";
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Magic Maggot", CaveMaggot, 8, "Zarkor::OnMonster";
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Magic Goblin", MagicGoblin, 10, "Zarkor::OnMonster";
            break;
        default:
            dispbottom l("BUG, Please report: TorchTally, err_val @@", @torch_count);
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Black Scorpion", BlackScorpion, rand(1,2), "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, rand(1,3), "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, rand(1,5), "Zarkor::OnMonster";
    }

    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,171,145,0	script	Torch#1	NPC_NO_SPRITE,{
    @torch = 1;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
        npctalk(l("What is @@ doing?", strcharinfo(0)), "Miner#SkyDG");
    }
    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,70,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,67,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,40,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,144,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;
}