summaryrefslogblamecommitdiff
path: root/npc/002-1/peter.txt
blob: 67a000eff91c1fe34bb0f669fa9352581b5bd24a (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                                                                          

                 



                                 













                                                
          

                                                           

                                                        
        
        
                                 


          
                                                  



                


                                   
                                      
 
                                                            
                                     

                                                                                

           


                                        


                                       
                                                                                                    



                                                            





                                                                   
          
 
          
                                                                    


                                                         


                                                                                                           
          

       
                 






                                  
             
                                   
                             

                               
         
                                                                                           



                                                                              





                                                                   




            




                                                                                         
                                                                                                                 
                                                        
               



                                                                                                                  
               



                                                                                                                   
               
     
                                             


                                                                                                     

         

                                                     
                                                                     






                                                                  

                 

                 


           
                                                                                                                               







                                                                                                                       
                        
                                                                                                                      
                             



                                                                                                                  
     
 
                
               



                                                                              










                                                                                                     



                                                             
                                             


                                                         
                      
                 
                         
                             

                      
                             





                      
 
                            

                                         
 




                                                                                                               
 

                                         
          
 
          
                                                                      
            
                                    
                                   
                             

                               

                                                                                                                                                                    

          
       
                                   
                             

                                                                    
 
                                 
         






                                                         
 

                                                            

                                 
             



                  
                  

        
// TMW2 script
// Author:
//   Jesusalva
// Original evol script authors: 4144, Ablu, Alastrim, Qwerty Dragon, Reid, Vasily_Makarov
// Description:
//    Rat hunter.
// Variable:
//    ShipQuests_Peter
// Values:
//    0   Doesn't know the quest.
//    & 1   Task given.
//    & 2   Task completed (easy level).
//    & 4   Task completed (medium level).
//    & 8   Task completed (hard level).
// Setq2:
//      Number of killed Rattos:
//      & 1 - Ratto 1
//      & 2 - Ratto 2
//      & 4 - Ratto 3
//      & 8 - Ratto 4
//      = 15: All rattos killed
// Setq3:
//      Instance ID (so we can destroy it later)
//
// Others:
// @peter = Accepted Task ID
// @pt_mob = ID of the monster you were tasked with killing

002-1,35,24,0	script	AreaNPC#Peter	NPC_HIDDEN,0,1,{
    end;
OnTouch:
    doevent "Peter::OnPeterMain";
    close;
}

002-1,33,25,0	script	Peter	NPC_RATTO_SAILOR,{
    goto L_Main;

OnPeterMain:
L_Main:
    .@q = getq(ShipQuests_Peter);
    .@q2 = getq2(ShipQuests_Peter);
    .@q3 = getq3(ShipQuests_Peter);
    if (BaseLevel < 8) goto OnTooWeak;

    if (!.@q || !isinstance(.@q3) || .@q3 <= 0) goto L_Task;
    if (.@q2 < 15) goto L_ReturnFail;
    dispbottom l("I am broken?! Please report! Debug data: @@ (@@)", .@q, .@q2);
    close;

OnGiveTask:
L_Task:
    if (!.@q)
        setq ShipQuests_Peter, 1, 0, -1;
    mesn;
    mesq lg("Hey, girl!", "Hey, man!");
    next;
    mesq l("I need somebody who can rid the hold of the ship of these creatures. Can you help me?");
    next;

    menu
        l("Yeah, but what reward will I get?"), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

OnLowTime:
    if ((compare(getmap(), "002-2")) || (compare(getmap(), "nard")))
        dispbottom l("Time is running out... Hurry up!");
    end;

OnTooWeak:
    mesn;
    mesq lg("I need someone to help me clean the edge of the ship, but you aren't strong enough for now.");
    close;

OnStop:
    slide 35, 26;

    mesn;
    mesq l("You can't go there!");

    close;

OnReturnFail:
L_ReturnFail:
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    mesn;
    mesq l("I see it's not so easy to get rid of the monsters. Do you want to try again?");
    next;

    menu
        l("Yeah, but I would like to make sure I get a reward."), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

L_BonusTask:
    mes "";
    mesn;
    mesq l("There are three kind of monsters which frequently attacks our fair vessel.");
    next;
    mesn;
    .@q = getq(ShipQuests_Peter);
    if (!(.@q & 2)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Squirrel)); // 750 HP, don't attack, 110 ms
        mes l("I'll give you @@ GP for this job.", 350);
        mes "";
    }
    if (!(.@q & 4)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Ratto)); // 500 HP, 80 DMG, 1572 dps, 120 ms
        mes l("I'll give you @@ GP for this job.", 550);
        mes "";
    }
    if (!(.@q & 8)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Croc)); // 1900 HP, 145 DMG, 1872 dps, 600 ms
        mes l("I'll give you @@ GP for this job.", 1000);
        mes "";
    }
    // TODO: This could be done a daily quest
    if (.@q == 15) {
        mes l("- I currently need your help with @@, but there's no reward.", getmonsterlink(Ratto));
    }
    next;

    select
        l("I'm not feeling like it today... Sorry."),
        rif(!(.@q & 2), l("I will take the @@ Bounty.", "Squirrel")),
        rif(!(.@q & 4), l("I will take the @@ Bounty.", "Ratto")),
        rif(!(.@q & 8), l("I will take the @@ Bounty.", "Croc")),
        rif(.@q == 15, l("Why not, I need to train anyway."));

    if (@menu == 1)
        close;

    @peter=@menu;

    goto L_Start;


L_Start:
    mes "";
    mesc l("Some of them are pretty strong. Do you need an explanation about hit'n'run and the monster you're about to face?");
    if (askyesno() == ASK_YES) {
        mes "";
        mesc l(".:: Hit'n'Run Tactic ::.");
        mesc l("Sometimes, you just cannot afford to be hit. But even with a melee weapon, you don't need to be hit.");
        next;
        mesc l("The strategy is simple. When you hit the enemy, walk one or two tiles backwards.");
        mesc l("If you miss, walk two or three tiles backwards. This way, you avoid being hit.");
        next;
        if (@peter == 2)
            mesc l("Squirrels are healthy, but they never attack. They run away from you, so good luck catching it!");
        else if (@peter == 4)
            mesc l("Crocs are dangerous and very healthy, but very slow. Use that on your advantage.");
        else
            mesc l("Rattos are very fast. They walk fast and attack fast. I advise bringing some healing items!");
        next;
    }

// Init Instance
OnStartOutside:
    .@ID=getcharid(0);
    @MAP_NAME$="nard@"+str(.@ID); // Max 4 chars for map name
    .@INSTID = instance_create("002-2@a"+(.@ID), getcharid(3), IOT_CHAR);
    .@instanceMapName$ = instance_attachmap("002-2", .@INSTID, 0, @MAP_NAME$);

    // Instance already exists, or something went wrong
    if (.@instanceMapName$ == "") {
        mesn;
        mesq l("Actually, you just took a bounty, right?");
        next;
        mesn;
        mesq l("Why don't you take a break? Breath in some fresh air. The basement is pretty damp.");
        close;
    }

    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, .@INSTID;

    // It'll be self-destroyed when time runs out (2 minutes)
    instance_set_timeout(180, 180, .@INSTID);
    instance_init(.@INSTID);

    // Save in a less reliable way the challenge you took
    if (@peter == 2) {
        @peter=2;
        @pt_mob=Squirrel;
    } else if (@peter == 3) {
        @peter=4;
        @pt_mob=Ratto;
    } else if (@peter == 4) {
        @peter=8;
        @pt_mob=Croc;
    } else {
        @peter=0;
        @pt_mob=Ratto;
    }

    warp @MAP_NAME$, 33, 24;
    addtimer(120000, "Peter::OnLowTime");
    addtimer(140000, "Peter::OnTimeout");

    // Spawn the Monsters
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto1Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto2Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto3Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto4Death";

    dispbottom l("Okay, you can start!");
    closeclientdialog;
    close;

OnTimeout:
    if (!(compare(getmap(), "002-2")) && !(compare(getmap(), "nard")))
        end;
    warp "002-1@"+LOCATION$, 35, 26;
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    mesn;
    mesq l("Hey! Be careful. You can't stay in this basement for so long, you're going to get sick. Come outside and take a break, maybe you can try again later.");
    close;

OnDone:
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    if (@peter)
        setq ShipQuests_Peter, getq(ShipQuests_Peter)|@peter, 0, -1;

    .@q = getq(ShipQuests_Peter);
    mesn;
    mesq l("Good job!") + " " + l("Here's your reward!");
    getexp @peter*52, @peter;
    switch (@peter) {
        case 2: @peter=350; break;
        case 4: @peter=550; break;
        case 8: @peter=1000; break;
    }

    Zeny = Zeny + @peter;
    message strcharinfo(0), l("You receive @@ GP!", @peter);
    deltimer("Peter::OnLowTime");
    deltimer("Peter::OnTimeout");
    @peter=0;
    close;

OnInit:
    .sex = G_MALE;
    .distance = 5;
    end;
}