summaryrefslogblamecommitdiff
path: root/npc/000-2-1/peter.txt
blob: 377acb5c57fbe8aaa059b14898ac5531c1901100 (plain) (tree)
1
2
3
4
5
6
7
8
9
                        
           
          
          
              

                    
               
                 
                  

                
                      
          






                                                        

                           

                                                    
                                                                                 


                                                                                         







                                                                   
                                                                          
                                                                        
 
                                               

        
                                   


                                                                                                                             
                                                    




                                                 
                                 

          
       
                            
 

          
           
                                    
 

          
       
                                
 

          
        
                                  
 

          
       
                                 
 

 
                                               
 
                                      
                                                                            
                                                                                                                           
                                    
 


                                                                     
 
           
                             
                                       

                           
                           

         
                                                                                                     

         
        

                                                            
                                                       


           
                                                         
 
                
 
          
         
                                                                                                 
 
                
 
       
                         
 

                                  
 


             
         
                                                                                        

         
        

                                                                              
                                                       


           
                                                         
 
                
 
            
         
                                                                                                                                                                                     
         
 
                                   
 
        

                                                                          
                                                                                 
 
                    
 
        
                                                        
                                                                                 
 

           
                                                         
 

          
            
           
         
                                          

         
        
                                          
                                                     
 
                                                        


                                              
                 
 
       
           
                                                        

                                              
                 
 
        
           

                                   

               
                                                        




                                             
 
                
 
            
                                                                         
                                                             




                                                                                                                              
 
        
 
              



                                                                                          



                                                                               

         
                  
 
        
 
               

                                                                 
         
                                                      
 
                
 
          
         
                                                                                                                                                                    
                           
 
                         
 

                       
 
       
                                                                                    
                                                               
 
                       
 
       
                                                               


                                                   
                               
 
                  
 
              
                 

                                 
                                           



                                                              
 
        
 
                
                 
                                                       
                                 
                               
                                           



                                                              
                                                
 
          
 
         
                               
                             
                                       
         
                                                         
                  
                         
                                                     
 
                         
 
         

                                     


                                              
 
                         
 
       
                  
 

          





                                                                 
 
// Evol scripts.	
// Authors:
//    4144
//    Ablu
//    Alastrim
//    Reid
//    Vasily_Makarov
// Description:
//    Rat hunter.
// 4+2 bits array:
//    ShipQuests
// Variable:
//    ShipQuests_Peter
// Values:
//    0   Doesn't know the quest.
//    1   Task given.
//    2   Task given and reward expected.
//    3   Task completed without reward.
//    4   Asked for reward after completion of the task.
//    5   Task done and reward given.
//    6   Did not start the quest.
// Others:
// @peter = Peter variable.
// "000-2-2.gat" - map with mobs.
// "$@RAT_SAILOR_HELPER$" - Name of the participant.
// "$@RAT_SAILOR_DEATHS - Number of deaths when the participant starts the fight.
// "$@RAT_SAILOR_CONTROL" - Explanation of each index of the array.
// "$@RAT_SAILOR_OLD_HELPER$" - Name of the participant.
// "$@RAT_SAILOR_COUNTDOWN$" - Seconds since the epoch of when the player done the quest.
// [1] = Shows status of ratto number 1 (1 is dead and 0 is alive).
// [2] = Shows status of ratto number 2 (1 is dead and 0 is alive).
// [3] = Shows status of ratto number 3 (1 is dead and 0 is alive).
// [4] = Shows status of ratto number 4 (1 is dead and 0 is alive).
// [5] = Shows how many seconds passed since ratto number 1 died.
// [6] = Shows how many seconds passed since ratto number 2 died.
// [7] = Shows how many seconds passed since ratto number 3 died.
// [8] = Shows how many seconds passed since ratto number 4 died.
// [9] = Shows how many seconds passed since the player started the quest.
// [10] = Shows how many seconds passed since the player done the quest.

000-2-1.gat,72,34,0,1	script	AreaNPC	0,0,1,{

OnTouch:
    if (BaseLevel < 5) goto l_Stop;
    if ((gettimetick(2) - $@RAT_SAILOR_COUNTDOWN$) < 600) goto l_NoGoodTick;
    if ($@RAT_SAILOR_OLD_HELPER$ == strcharinfo(0) || (gettimetick(2) - $@RAT_SAILOR_COUNTDOWN$) < 1000) goto l_ThousandTick;
    set $@RAT_SAILOR_COUNTDOWN$, "";
    if ($@RAT_SAILOR_HELPER$ != "") goto l_Occupied;
    set @peter, getq(ShipQuests_Peter);
    if (@peter < 1 || @peter > 5) goto l_Task;
    if (@peter == 1 || @peter == 2) goto l_Rfail;
    if (@peter == 3 || @peter == 4) goto l_Rwin;
    if (@peter > 5) goto l_SecondTime;
    doevent "Peter::OnReturnWin";
    close;

l_Stop:
    doevent "Peter::OnStop";

    close;

l_Occupied:
    doevent "Peter::OnDontneedHelp";

    close;

l_Task:
    doevent "Peter::OnGiveTask";

    close;

l_Rfail:
    doevent "Peter::OnReturnFail";

    close;

l_Rwin:
    doevent "Peter::OnReturnWin";

}

000-2-1.gat,70,35,0,1	script	Peter	303;3,{

    if (BaseLevel < 5) goto OnTooWeak;
    if ((gettimetick(2) - $@RAT_SAILOR_COUNTDOWN$) < 600) goto l_NoGoodTick;
    if ($@RAT_SAILOR_OLD_HELPER$ == strcharinfo(0) || (gettimetick(2) - $@RAT_SAILOR_COUNTDOWN$) < 1000) goto l_NoGoodTick;
    set $@RAT_SAILOR_COUNTDOWN$, "";

    set @peter, getq(ShipQuests_Peter);
    if (@peter == 1 || @peter == 2) goto OnReturnFail;
    if (@peter == 3 || @peter == 4 || @peter == 5)  goto OnReturnWin;

OnGiveTask:
    setq ShipQuests_Peter, 6;
    set @peter, getq(ShipQuests_Peter);
    mesn;
    mesq g(l("Hey, girl!"),
           l("Hey, man!"));
    next;
    mesn;
    mesq l("I need somebody who can clean the bottom of the ship of these rattos. Can you help me?");
    next;

    menu
        l("Yeah, but what reward will I get?"), l_BonusTask,
        l("Why not, I need to train anyway."), l_Task,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Ok, ok. Come back if you change your mind.");

    goto l_Quit;

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

    goto l_Quit;

OnStop:
    warp "000-2-1",72,36;

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

    close;

OnReturnFail:
    mesn;
    mesq l("I see it's not easy to get rid of these rattos. Do you want to try again?");
    next;

    menu
        l("Yeah, but I would like to make sure I get a reward."), l_BonusTask,
        l("Why not, I need to train anyway."), l_Task,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Ok, ok. Come back if you change your mind.");

    goto l_Quit;

OnReturnWin:
    mesn;
    mesq l("Thanks again for helping me. But these rattos are a permanent problem and your help is always welcome. The only problem is that I can give you a reward only one time.");
    next;

    if (@peter == 3 || @peter == 4)

    menu
        l("Did you say reward? I want it!"), l_BonusTask,
        l("I am not worried about rewards. I just want to help."), l_Task,
        l("Sorry, I am not in the mood for another fight with these rattos."), -;

    if (@peter == 5)

    menu
        l("No problem, I can help you anyway."), l_Task,
        l("Sorry, I am not in the mood for another fight with these rattos."), -;

    mes "";
    mesn;
    mesq l("Ok, ok. Come back if you change your mind.");

    close;

l_BonusTask:
    mes "";
    mesn;
    mesq l("I will give you @@ GP.", 200);
    next;

    menu
        lg("Okay, I'm ready to work!"), -,
        l("What? This reward is too small!"), l_Quit;

    if ($@RAT_SAILOR_HELPER$ != "") goto OnDontneedHelp;
    if (@peter == 6) setq ShipQuests_Peter, 2;
    if (@peter == 3) setq ShipQuests_Peter, 4;
    set @peter, getq(ShipQuests_Peter);
    goto l_Start;

l_Task:
    mes "";
    if ($@RAT_SAILOR_HELPER$ != "") goto OnDontneedHelp;
    if (@peter == 6) setq ShipQuests_Peter, 1;
    set @peter, getq(ShipQuests_Peter);
    goto l_Start;

l_Start:
    mes "";
    mesn;
    mesq l("Okay, you can start!");

OnStartOutside:
    if ($@RAT_SAILOR_HELPER$ != "") goto OnDontneedHelp;
    set $@RAT_SAILOR_HELPER$, strcharinfo(0);
    set $@RAT_SAILOR_DEATHS, PC_DIE_COUNTER;
    initnpctimer;
    warp "000-2-2.gat", 48, 28;
    doevent "RattosControl::OnSpawn";

    goto l_Quit;

OnTimer2000:
    if (attachrid(getcharid(3,$@RAT_SAILOR_HELPER$)) == 0) goto l_Logoff;
    set $@RAT_SAILOR_CONTROL[9], $@RAT_SAILOR_CONTROL[9] + 2;
    if ($@RAT_SAILOR_CONTROL[9] > 100) goto l_Timeout;
    if (PC_DIE_COUNTER > $@RAT_SAILOR_DEATHS) goto l_Dead;
    if ($@RAT_SAILOR_CONTROL[1] && $@RAT_SAILOR_CONTROL[2] && $@RAT_SAILOR_CONTROL[3] && $@RAT_SAILOR_CONTROL[4]) goto l_Done;
    if (getmapusers("000-2-2.gat") == 0) goto l_CleaningEnd;
    goto l_CheckRattos;

    end;

l_CheckRattos:
    if ($@RAT_SAILOR_CONTROL[1]) set $@RAT_SAILOR_CONTROL[5], $@RAT_SAILOR_CONTROL[5] + 2;
    if ($@RAT_SAILOR_CONTROL[2]) set $@RAT_SAILOR_CONTROL[6], $@RAT_SAILOR_CONTROL[6] + 2;
    if ($@RAT_SAILOR_CONTROL[3]) set $@RAT_SAILOR_CONTROL[7], $@RAT_SAILOR_CONTROL[7] + 2;
    if ($@RAT_SAILOR_CONTROL[4]) set $@RAT_SAILOR_CONTROL[8], $@RAT_SAILOR_CONTROL[8] + 2;
    if ($@RAT_SAILOR_CONTROL[5] > 40) doevent "RattosControl::OnRatto1Respawn";
    if ($@RAT_SAILOR_CONTROL[6] > 40) doevent "RattosControl::OnRatto2Respawn";
    if ($@RAT_SAILOR_CONTROL[7] > 40) doevent "RattosControl::OnRatto3Respawn";
    if ($@RAT_SAILOR_CONTROL[8] > 40) doevent "RattosControl::OnRatto4Respawn";

l_NotYet:
    setnpctimer 0;

    end;

OnDontneedHelp:
    mesn;
    mesq l("I don't need your help right now, come back later.");
    next;
    mesq l("@@ is helping me.", $@RAT_SAILOR_HELPER$);

    goto l_Quit;

l_Timeout:
    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.");
    warp "000-2-1", 72, 36;

    goto l_CleaningClose;

l_Logoff:
    goto l_CleaningEnd;

l_Dead:
// Warps the dead body outside, so it does not interfere with the getmapusers check.
    if (getmapusers("000-2-2.gat") > 0) warp "000-2-1", 61, 36;

    goto l_CleaningEnd;

l_Done:
    set $@RAT_SAILOR_CONTROL[10], $@RAT_SAILOR_CONTROL[10] + 2;
    if($@RAT_SAILOR_CONTROL[10] < 5) goto l_NotYet;
    set @peter, getq(ShipQuests_Peter);
    if (@peter == 2 || @peter == 4) goto l_Reward;
    warp "000-2-1.gat", 72, 36;

    goto l_Thanks;

l_CleaningEnd:
    stopnpctimer;
    set $@RAT_SAILOR_HELPER$, "";
    set $@RAT_SAILOR_DEATHS, 0;
    cleararray $@RAT_SAILOR_CONTROL, 0, 11;
    killmonster "000-2-2.gat", "RattosControl::OnRatto1Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto2Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto3Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto4Death";

    end;

l_CleaningClose:
    stopnpctimer;
    set $@RAT_SAILOR_OLD_HELPER$, $@RAT_SAILOR_HELPER$;
    set $@RAT_SAILOR_HELPER$, "";
    set $@RAT_SAILOR_DEATHS, 0;
    cleararray $@RAT_SAILOR_CONTROL, 0, 11;
    killmonster "000-2-2.gat", "RattosControl::OnRatto1Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto2Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto3Death";
    killmonster "000-2-2.gat", "RattosControl::OnRatto4Death";
    set $@RAT_SAILOR_COUNTDOWN$, gettimetick(2);

    close;

l_Reward:
    warp "000-2-1.gat", 72, 36;
    setq ShipQuests_Peter, 5;
    set @peter, getq(ShipQuests_Peter);
    mesn;
    mesq l("Good job!") + " " + l("Here's your reward!");
    getexp 100, 0;
    set zeny, zeny + 200;
    message strcharinfo(0), l("You receive 200 GP!");

    goto l_CleaningClose;

l_Thanks:
    mesn;
    mesq l("Thanks for helping me!");
    set @peter, getq(ShipQuests_Peter);
    if (@peter == 1) setq ShipQuests_Peter, 3;
    set @peter, getq(ShipQuests_Peter);

    goto l_CleaningClose;

l_Quit:
    set @peter, 0;

    close;

l_NoGoodTick:
    mesn;
    mesq l("I don't need your help right now, come back later.");

    close;

}