summaryrefslogblamecommitdiff
path: root/npc/018-6-1/main.txt
blob: e38d102f4db180aebb0b99271febdaa59c2b90f7 (plain) (tree)








































































                                                                                                                         

                                                            










                                                                        
                               

                                 

                                         





                                              
                    
                                                                   













                                                                       
 


                                                                         







                      
                                        


 
// TMW2 Scripts
// Author:
//    Jesusalva
// Description:
//    Controls Elenium Mines, specially the instances

// Main Controller for Instanced maps
018-6-1,0,0,0	script	#01861_InstCtrl	NPC_HIDDEN,{
    end;

// Map, x, y, width, height, mob, amount
function AreaMonsterB {
    .@m$=getarg(0);
    .@x1=getarg(1);
    .@x2=.@x1+getarg(3);
    .@y1=getarg(2);
    .@y2=.@y1+getarg(4);
    .@mi=getarg(5);
    .@am=getarg(6);
    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am, instance_npcname(.name$)+"::OnKill"+.@mi);
    return;
}

// (var, value)
function SetIfVoid {
    if (!getarg(0))
        return getarg(1);
    return 0;
}

// Bifs won't respawn
OnKill1226:
OnKill1227:
OnKill1228:
    end;

// Others: Wait 30 seconds and respawn
OnKill1178:
    .@mi=SetIfVoid(.@mi, 1178);
OnKill1051:
    .@mi=SetIfVoid(.@mi, 1051);
OnKill1074:
    .@mi=SetIfVoid(.@mi, 1074);
OnKill1123:
    .@mi=SetIfVoid(.@mi, 1123);
OnKill1176:
    .@mi=SetIfVoid(.@mi, 1176);
OnKill1026:
    .@mi=SetIfVoid(.@mi, 1026);

    // Common utils
    getmapxy(.@m$, .@x, .@y, 0);
    sleep(30000);
    AreaMonsterB(.@m$, .@x-2, .@y-2, 4, 4, .@mi, 1);
    end;

OnInstanceInit:
    // Generate map ID
    getmapxy(.@m$, .@x, .@y, UNITTYPE_NPC);

    // Bif monsters
    AreaMonsterB(.@m$,  40,  49, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$,  95,  51, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$, 145,  83, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  62,  86, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  65, 130, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$, 125, 158, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$, 129, 183, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$,  34, 181, 5, 5, SmallEleniumBif, 4);

    // Common Monsters
    AreaMonsterB(.@m$,  80, 172, 54, 25, BlackSlime, 16);
    AreaMonsterB(.@m$,  89, 167, 54, 25, DarkLizard, 8);
    AreaMonsterB(.@m$,  96, 103, 56, 29, BlackScorpion, 17);
    AreaMonsterB(.@m$, 101, 105, 54, 25, MountainSnake, 9);
    AreaMonsterB(.@m$,  70,  45, 44, 25, WickedMushroom, 14);
    AreaMonsterB(.@m$,  68,  45, 31, 21, Archant, 7);
    end;

}
/////////////////////////////
018-6-1,83,26,0	script	#ToForgottenChamber	NPC_SUMMONING_CIRC,0,0,{
    dispbottom l("It looks dangerous.");
    end;

OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q >= 1) {
        warp BarbaraInstCheck(0), 90, 91;
        // Complete the first arc if possible
        if (.@q == 1) {
            setq1 LoFQuest_Barbara, 2;
            setq3 LoFQuest_Barbara, 0;
        }
        // Update M0 NPCs based on quest state
        if (.@q > 2)
            enablenpc instance_npcname("#ToForgottenShrine", .@q2);
        if (.@q == 2) {
            if (.@q3 == 5)
                enablenpc instance_npcname("#ToForgottenShrine", .@q2);
            if (.@q3 == 3)
                enablenpc instance_npcname("#ToSouthHall", .@q2);
            // Note: state 64 and 128 are temporary and must be removed
            if (.@q3 & 64)
                setq3 LoFQuest_Barbara, .@q3^64;
            // Safety update
            .@q3=getq3(LoFQuest_Barbara);
            if (.@q3 & 128)
                setq3 LoFQuest_Barbara, .@q3^128;

        }

    } else {
        Exception("ERROR, YOU SHOULD NOT BEEN SEEING THIS. 018-6-1.TFC");
    }
    end;

OnInit:
    disablenpc .name$;
    end;

}

///////////////////////////// Minievents