summaryrefslogblamecommitdiff
path: root/npc/018-6-1/main.txt
blob: 6cdeaed945d4ebde97a727983bb324da67c40e90 (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);
    // Skipped cutscenes, show you the EXIT
    if (.@q == 1 && .@q3 != 1)
        cwarp "017-1", 32, 45;

    if (.@q >= 1) {
        warp BarbaraInstCheck(0), 90, 91;
        // Complete the first arc if possible
        if (.@q == 1) {
            setnpcdialogtitle l("Forgotten Chamber");
            mesn l("Forgotten Chamber");
            mesq l("You see yourself in a strange chamber. Strange drawings litter the walls.");
            next;
            mesn l("Forgotten Chamber");
            mesq l("You can see in distance two portals working, and two portals offline.");
            next;
            mesn l("Forgotten Chamber");
            mesq l("It seems to be a puzzle, you can only imagine what needs to be done in order to enable the right portals.");
            next;
            setq1 LoFQuest_Barbara, 2;
            setq3 LoFQuest_Barbara, 0;
            closeclientdialog;
        }
        // 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
018-6-1,128,131,0	script	Wounded Soldier#01861	NPC_GUARD_DEAD,{
    //npctalk3 l("Please find her and don't worry with me! And be careful!");
    npctalk3 l("*scream in pain*");
    close;

OnMain:
    mesn l("Wounded Soldier");
    mesq l("Hey, you! Are you here on Kenton's orders?!");
    next;
    setnpcdialogtitle l("Benjamin, Wounded Soldier");
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My name is Benjamin, and I was in charge of an incursion here to capture Barbara.");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My unit, however, was attacked! An assassin snuck up on us!");
    mesc l("You help Benjamin in getting up.");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("I hope my men are safe, that was yesterday. I am barely alive.");
    mesc l("You know what is worse? THIS WHOLE CAVE HAVE DEATH PENALTY ON!!!"), 1;
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("I shall report to Kenton. I now entrust this quest in your hands!");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("And please, bring those criminals to justice! Barbara and the Assassin!");
    next;
    mesc l("With a wave, Benjamin returns to report Kenton about the outcome.");
    setq3 LoFQuest_Barbara, 1;
    disablenpc instance_npcname(.name$); // NPC will now go to rest
    close;

OnInit:
    .sex=G_MALE;
    disablenpc .name$;
    end;
OnInstanceInit:
    setnpcdisplay instance_npcname(.name$), NPC_WOUNDEDSOLDIER;
    disablenpc instance_npcname(.name$);
    end;
}

// Event trigger
018-6-1,121,132,0	script	#01861TriggerWS1	NPC_HIDDEN, 0, 10,{
    end;
OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q == 1 && .@q3 == 0) {
        enablenpc instance_npcname("Wounded Soldier#01861", .@q2);
        addtimer2(500, instance_npcname("Wounded Soldier#01861", .@q2)+"::OnMain");
    }
    end;

OnInit:
    disablenpc .name$;
    end;
}