SHARE
TWEET

Untitled

a guest Feb 19th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. //===== eAthena Script ============================================
  3. //= Power Plant
  4. //===== By: =======================================================
  5. //= Kenedos
  6. //===== Current Version: ==========================================
  7. //= 1.2
  8. //===== Description: ==============================================
  9. //=
  10. //= Set of scripts and mapflags for the Power Plant arena.
  11. //=
  12. //====== Changelog: ================================================
  13. //= Fixed a bug where using @reloadscript while barricades were active
  14. //= would bug the map walkable titles.
  15. //==================================================================
  16.  
  17. //-------------------- Mapflags -----------------------------------
  18.  
  19. power_plant mapflag pvp
  20. power_plant mapflag nomemo
  21. power_plant mapflag nobranch
  22. power_plant mapflag noteleport
  23.  
  24. // -----------------------------------------------------------------
  25.  
  26.  
  27.  
  28. // ------------------- Scripts -------------------------------------
  29.  
  30. power_plant,70,45,0 script  #PP_Fence01 -1,28,0,{
  31.  
  32.     OnTouch:
  33.     while (1)
  34.     {
  35.         if (Hp <= 0)
  36.         {
  37.             break;
  38.         }
  39.         dispbottom "The electrified fence discharges a thunder on you!";
  40.         specialeffect2 622;
  41.         set .@rand, rand(33,66);
  42.         percentheal -(.@rand),0;
  43.         if (Hp == 1)
  44.         {
  45.             //donpcevent Audience...
  46.             dispbottom "The thunder bolt discharges directly on your body!";
  47.             heal -1,0;
  48.             end;
  49.         }
  50.         sleep2 1560;
  51.         getmapxy .@map$, .@npcx, .@npcy, 1;
  52.         getmapxy .@map$, .@x, .@y, 0;
  53.         if ((strnpcinfo(2) == "PP_Fence01") ||
  54.             (strnpcinfo(2) == "PP_Fence02"))
  55.         {
  56.             if (.@y != .@npcy)
  57.             {
  58.                 break;
  59.             }
  60.         }
  61.         if ((strnpcinfo(2) == "PP_Fence03") ||
  62.             (strnpcinfo(2) == "PP_Fence04"))
  63.         {
  64.             if (.@x != .@npcx)
  65.             {
  66.                 break;
  67.             }
  68.         }
  69.     }
  70.     end;
  71.    
  72. }
  73.  
  74. power_plant,70,101,0    duplicate(#PP_Fence01)  #PP_Fence02 -1,28,0
  75. power_plant,98,73,0 duplicate(#PP_Fence01)  #PP_Fence03 -1,0,28
  76. power_plant,42,73,0 duplicate(#PP_Fence01)  #PP_Fence04 -1,0,28
  77.  
  78.  
  79. power_plant,55,66,0 script  #PP_Mine01  -1,0,0,{
  80.    
  81.     OnTouch:
  82.     switch(rand(1,3))
  83.     {
  84.         // Lightning Mine
  85.         case 1:
  86.             dispbottom "You stepped on a lightning mine!";
  87.             specialeffect2 257;
  88.             specialeffect2 52;
  89.             set .@rand, rand(25,45);
  90.             percentheal -(.@rand),0;
  91.             heal -1, 0;
  92.         break;
  93.        
  94.         // Shockwave
  95.         case 2:
  96.             dispbottom "You stepped on a shockwave mine! Your SP has been drained!";
  97.             specialeffect2 94;
  98.             set .@rand, rand(70,90);
  99.             percentheal 0,-(.@rand);
  100.         break;
  101.        
  102.         // Flasher
  103.         case 3:
  104.         dispbottom "You stepped on a flasher mine! You may suffer negative status effects.";
  105.         specialeffect2 99;
  106.         set .@quantity, rand(1,3);
  107.         for (set .@i, 0; .@i < .@quantity; set .@i, .@i + 1)
  108.         {
  109.             set .@effectnumber, rand(1,8);
  110.             set .@duration, rand(4000,8000);
  111.             sc_start .@effectnumber, .@duration, 0;
  112.         }
  113.         break;
  114.            
  115.     }
  116.     end;
  117.    
  118. }
  119.  
  120. // First Mine
  121. power_plant,55,67,0 duplicate(#PP_Mine01)   #PP_Mine02  -1,0,0
  122. power_plant,54,67,0 duplicate(#PP_Mine01)   #PP_Mine03  -1,0,0
  123. power_plant,54,66,0 duplicate(#PP_Mine01)   #PP_Mine04  -1,0,0
  124.            
  125. // Second Mine         
  126. power_plant,59,86,0 duplicate(#PP_Mine01)   #PP_Mine05  -1,0,0
  127. power_plant,59,85,0 duplicate(#PP_Mine01)   #PP_Mine06  -1,0,0
  128. power_plant,58,85,0 duplicate(#PP_Mine01)   #PP_Mine07  -1,0,0
  129. power_plant,58,86,0 duplicate(#PP_Mine01)   #PP_Mine08  -1,0,0
  130.            
  131. // Third Mine          
  132. power_plant,76,87,0 duplicate(#PP_Mine01)   #PP_Mine09  -1,0,0
  133. power_plant,75,87,0 duplicate(#PP_Mine01)   #PP_Mine10  -1,0,0
  134. power_plant,75,86,0 duplicate(#PP_Mine01)   #PP_Mine11  -1,0,0
  135. power_plant,76,86,0 duplicate(#PP_Mine01)   #PP_Mine12  -1,0,0
  136.            
  137. // Fourth Mine         
  138. power_plant,85,87,0 duplicate(#PP_Mine01)   #PP_Mine13  -1,0,0
  139. power_plant,84,87,0 duplicate(#PP_Mine01)   #PP_Mine14  -1,0,0
  140. power_plant,84,86,0 duplicate(#PP_Mine01)   #PP_Mine15  -1,0,0
  141. power_plant,85,86,0 duplicate(#PP_Mine01)   #PP_Mine16  -1,0,0
  142.            
  143. // Fifth Mine          
  144. power_plant,83,60,0 duplicate(#PP_Mine01)   #PP_Mine17  -1,0,0
  145. power_plant,82,60,0 duplicate(#PP_Mine01)   #PP_Mine18  -1,0,0
  146. power_plant,82,59,0 duplicate(#PP_Mine01)   #PP_Mine19  -1,0,0
  147. power_plant,83,59,0 duplicate(#PP_Mine01)   #PP_Mine20  -1,0,0
  148.  
  149.  
  150. power_plant,67,73,0 script  #PP_Guardian    -1,1,0,{
  151.  
  152.     OnTouch:
  153.     if (.pp_guardian_delay < gettimetick(2) ) {
  154.         dispbottom "The guardian of the power plant will aid you.";
  155.         for (set .@i, 0; .@i < 6; set .@i, .@i + 1)
  156.         {
  157.             // Raydric
  158.             summon "Power Plant Guardian",1677;
  159.             if ((.@i % 2) == 0)
  160.             {
  161.                 // Raydric Archer
  162.                 summon "Power Plant Guardian",1670;
  163.             }
  164.         }
  165.         set .pp_guardian_delay, gettimetick(2) + 149;
  166.     }
  167.     else
  168.     {
  169.         dispbottom "The guardian power must recharge. Wait "+((.pp_guardian_delay - gettimetick(2)) + 1)+" seconds before calling it again.";
  170.     }
  171.     end;
  172.    
  173. }
  174.  
  175. power_plant,75,77,0 script  #PP_Cannon01    -1,1,1,{
  176.  
  177.     OnTouch:
  178.     if (.pp_can_delay < gettimetick(2) ) {
  179.         dispbottom "You fire the cannon!";
  180.         specialeffect2 97;
  181.         sleep2 900;
  182.         setarray .@x[0], 85, 90, 90, 94, 96, 89;
  183.         setarray .@y[0], 92, 95, 89, 93, 97, 85;
  184.         for (set .@i, 0; .@i < getarraysize(.@x); set .@i, .@i + 1)
  185.         {
  186.             set .@idbomb, bg_monster(0,"power_plant",.@x[.@i],.@y[.@i]," ",1937,"");
  187.             unitskilluseid .@idbomb,173,1;
  188.         }
  189.         set .pp_can_delay, gettimetick(2) + 29;
  190.        
  191.     }
  192.     else
  193.     {
  194.         dispbottom "The cannon is reloading. Wait "+((.pp_can_delay - gettimetick(2)) + 1)+" seconds.";
  195.     }
  196.     end;
  197.  
  198. }
  199.  
  200. power_plant,64,77,0 script  #PP_Cannon02    -1,1,1,{
  201.  
  202.     OnTouch:
  203.     if (.pp_can_delay < gettimetick(2) ) {
  204.         dispbottom "You fire the cannon!";
  205.         specialeffect2 97;
  206.         sleep2 900;
  207.         setarray .@x[0], 55, 52, 49, 44, 47, 50, 46, 49, 43;
  208.         setarray .@y[0], 91, 96, 99, 97, 94, 91, 91, 88, 95;
  209.         for (set .@i, 0; .@i < getarraysize(.@x); set .@i, .@i + 1)
  210.         {
  211.             set .@idbomb, bg_monster(0,"power_plant",.@x[.@i],.@y[.@i]," ",1937,"");
  212.             unitskilluseid .@idbomb,173,1;
  213.         }
  214.         set .pp_can_delay, gettimetick(2) + 29;
  215.        
  216.     }
  217.     else
  218.     {
  219.         dispbottom "The cannon is reloading. Wait "+((.pp_can_delay - gettimetick(2)) + 1)+" seconds.";
  220.     }
  221.     end;
  222.  
  223. }
  224.  
  225. power_plant,75,66,0 script  #PP_Cannon03    -1,1,1,{
  226.  
  227.     OnTouch:
  228.     if (.pp_can_delay < gettimetick(2) ) {
  229.         dispbottom "You fire the cannon!";
  230.         specialeffect2 97;
  231.         sleep2 900;
  232.         setarray .@x[0], 89, 94, 95, 91, 87, 90, 87, 84;
  233.         setarray .@y[0], 56, 52, 48, 50, 52, 46, 48, 50;
  234.         for (set .@i, 0; .@i < getarraysize(.@x); set .@i, .@i + 1)
  235.         {
  236.             set .@idbomb, bg_monster(0,"power_plant",.@x[.@i],.@y[.@i]," ",1937,"");
  237.             unitskilluseid .@idbomb,173,1;
  238.         }
  239.         set .pp_can_delay, gettimetick(2) + 29;
  240.        
  241.     }
  242.     else
  243.     {
  244.         dispbottom "The cannon is reloading. Wait "+((.pp_can_delay - gettimetick(2)) + 1)+" seconds.";
  245.     }
  246.     end;
  247.  
  248. }
  249.  
  250. power_plant,64,66,0 script  #PP_Cannon04    -1,1,1,{
  251.  
  252.     OnTouch:
  253.     if (.pp_can_delay < gettimetick(2) ) {
  254.         dispbottom "You fire the cannon!";
  255.         specialeffect2 97;
  256.         sleep2 900;
  257.         setarray .@x[0], 50, 49, 46, 49, 43;
  258.         setarray .@y[0], 52, 48, 52, 56, 54;
  259.         for (set .@i, 0; .@i < getarraysize(.@x); set .@i, .@i + 1)
  260.         {
  261.             set .@idbomb, bg_monster(0,"power_plant",.@x[.@i],.@y[.@i]," ",1937,"");
  262.             unitskilluseid .@idbomb,173,1;
  263.         }
  264.         set .pp_can_delay, gettimetick(2) + 29;
  265.        
  266.     }
  267.     else
  268.     {
  269.         dispbottom "The cannon is reloading. Wait "+((.pp_can_delay - gettimetick(2)) + 1)+" seconds.";
  270.     }
  271.     end;
  272.  
  273. }
  274.  
  275. power_plant,45,99,0 script  #PP_Healpod01   -1,0,0,{
  276.    
  277.     OnTouch:
  278.     while (1)
  279.     {
  280.         if (@pp_healpod)
  281.         {
  282.             break;
  283.         }
  284.         specialeffect2 325;
  285.         dispbottom "The Healing pod regenerates your life quickly!";
  286.         set .@rand, rand(25,40);
  287.         percentheal .@rand, 0;
  288.         set @pp_healpod, 1;
  289.         sleep2 1300;
  290.         set @pp_healpod, 0;
  291.         getmapxy .@map$, .@x, .@y, 0;
  292.         if ( ( (.@x != 45) || (.@y != 99) ) &&
  293.             ( (.@x != 44) || (.@y != 99) ) &&
  294.             ( (.@x != 45) || (.@y != 98) ) &&
  295.             ( (.@x != 44) || (.@y != 98) ) )
  296.         {
  297.             break;
  298.         }
  299.  
  300.     }
  301.     end;
  302.    
  303. }
  304.  
  305. power_plant,44,99,0 duplicate(#PP_Healpod01)    #PP_Healpod02   -1,0,0
  306. power_plant,44,98,0 duplicate(#PP_Healpod01)    #PP_Healpod03   -1,0,0
  307. power_plant,45,98,0 duplicate(#PP_Healpod01)    #PP_Healpod04   -1,0,0
  308.  
  309.  
  310. power_plant,94,48,0 script  #PP_Healpod05   -1,0,0,{
  311.    
  312.     OnTouch:
  313.     while (1)
  314.     {
  315.         if (@pp_healpod)
  316.         {
  317.             break;
  318.         }
  319.         specialeffect2 325;
  320.         dispbottom "The Healing pod regenerates your life quickly!";
  321.         set .@rand, rand(25,40);
  322.         percentheal .@rand, 0;
  323.         set @pp_healpod, 1;
  324.         sleep2 1300;
  325.         set @pp_healpod, 0;
  326.         getmapxy .@map$, .@x, .@y, 0;
  327.         if ( ( (.@x != 94) || (.@y != 48) ) &&
  328.             ( (.@x != 93) || (.@y != 48) ) &&
  329.             ( (.@x != 94) || (.@y != 47) ) &&
  330.             ( (.@x != 93) || (.@y != 47) ) )
  331.         {
  332.             break;
  333.         }
  334.  
  335.     }
  336.     end;
  337.    
  338. }
  339.  
  340. power_plant,94,47,0 duplicate(#PP_Healpod05)    #PP_Healpod06   -1,0,0
  341. power_plant,93,48,0 duplicate(#PP_Healpod05)    #PP_Healpod07   -1,0,0
  342. power_plant,93,47,0 duplicate(#PP_Healpod05)    #PP_Healpod08   -1,0,0
  343.  
  344.  
  345.  
  346. power_plant,63,73,0 script  #PP_Panel01 -1,0,0,{
  347.  
  348.     OnTouch:
  349.     if (.pp_panel_delay < gettimetick(2) ) {
  350.         if (.monstercount == 0)
  351.         {
  352.             monster "power_plant",61,67,"Power Plant Guardian",1675,1,strnpcinfo(0)+"::OnMyMobDead";
  353.             monster "power_plant",61,76,"Power Plant Guardian",1675,1,strnpcinfo(0)+"::OnMyMobDead";
  354.             set .monstercount, 2;
  355.         }
  356.         if (.idbarrier0 == 0)
  357.         {
  358.             for (set .@i, 0; .@i < 6; set .@i, .@i + 1)
  359.             {
  360.                 setd ".idbarrier"+.@i, bg_monster(0,"power_plant",62,(73 - .@i)," ",1905,strnpcinfo(0)+"::OnBarricadeBreak"+.@i);
  361.             }
  362.             setcell "power_plant",62,73,62,68,cell_walkable,0;
  363.             setcell "power_plant",62,73,62,68,cell_shootable,1;
  364.             dispbottom "You activate the power plant barrier security!";
  365.             set .pp_panel_delay, gettimetick(2) + 299;
  366.         }
  367.         else
  368.         {
  369.             dispbottom "The barrier security is still active.";
  370.         }
  371.     }
  372.     else
  373.     {
  374.         dispbottom "The barrier power must recharge. Wait "+((.pp_panel_delay - gettimetick(2)) + 1)+" seconds before calling it again.";
  375.     }
  376.     end;
  377.    
  378.     OnInit:
  379.     setcell "power_plant",62,73,62,68,cell_walkable,1;
  380.     setcell "power_plant",62,73,62,68,cell_shootable,0;
  381.     end;
  382.    
  383.     OnBarricadeBreak0:
  384.     set .idbarrier0, 0;
  385.     set .barriernumber, 0;
  386.     goto OnBarricadeBreak;
  387.    
  388.     OnBarricadeBreak1:
  389.     set .idbarrier1, 0;
  390.     set .barriernumber, 1;
  391.     goto OnBarricadeBreak;
  392.    
  393.     OnBarricadeBreak2:
  394.     set .idbarrier2, 0;
  395.     set .barriernumber, 2;
  396.     goto OnBarricadeBreak;
  397.    
  398.     OnBarricadeBreak3:
  399.     set .idbarrier3, 0;
  400.     set .barriernumber, 3;
  401.     goto OnBarricadeBreak;
  402.    
  403.     OnBarricadeBreak4:
  404.     set .idbarrier4, 0;
  405.     set .barriernumber, 4;
  406.     goto OnBarricadeBreak;
  407.    
  408.     OnBarricadeBreak5:
  409.     set .idbarrier5, 0;
  410.     set .barriernumber, 5;
  411.     goto OnBarricadeBreak;
  412.    
  413.     OnBarricadeBreak:
  414.     for (set .@i, 0; .@i < 6; set .@i, .@i + 1)
  415.     {
  416.         if (.@i != .barriernumber)
  417.         {
  418.             unitkill getd(".idbarrier"+.@i);
  419.             setd ".idbarrier"+.@i, 0;
  420.         }
  421.     }
  422.     set .barriernumber, 0;
  423.     setcell "power_plant",62,73,62,68,cell_walkable,1;
  424.     setcell "power_plant",62,73,62,68,cell_shootable,0;
  425.     end;
  426.    
  427.     OnMyMobDead:
  428.     if (.monstercount > 0)
  429.     {
  430.         set .monstercount, .monstercount - 1;
  431.     }
  432.     end;
  433.    
  434. }
  435.  
  436.  
  437. power_plant,69,71,0 script  #PP_Panel02 -1,0,0,{
  438.  
  439.     OnTouch:
  440.     if (.pp_panel_delay < gettimetick(2) ) {
  441.         dispbottom "The power generator discharges directly in the water!";
  442.         specialeffect2 666;
  443.         specialeffect2 461;
  444.         sleep2 500;
  445.         donpcevent "#PP_Thundergen::OnThunder";
  446.         set .pp_panel_delay, gettimetick(2) + 89;
  447.     }
  448.     else
  449.     {
  450.         dispbottom "The power generator must recharge. Wait "+((.pp_panel_delay - gettimetick(2)) + 1)+" seconds before calling it again.";
  451.     }
  452.    
  453. }
  454.  
  455. power_plant,81,81,0 script  #PP_Water01 -1,0,2,{
  456.    
  457.     OnTouch:
  458.     doevent "#PP_Thundergen::OnActivate";
  459.     end;
  460.  
  461. }
  462.  
  463. power_plant,81,62,0 duplicate(#PP_Water01)  #PP_Water02 -1,0,2
  464. power_plant,61,71,0 duplicate(#PP_Water01)  #PP_Water03 -1,0,4
  465.  
  466.  
  467.  
  468. power_plant,0,0,0   script  #PP_Thundergen  -1,{
  469.  
  470.     end;
  471.  
  472.     OnActivate:
  473.     for (set .@i, 0; .@i < 30; set .@i, .@i + 1)
  474.     {
  475.         if (getd(".playerid"+.@i) == getcharid(3))
  476.         {
  477.             end;
  478.         }
  479.     }
  480.     for (set .@i, 0; .@i < 30; set .@i, .@i + 1)
  481.     {
  482.         if (getd(".playerid"+.@i) == 0)
  483.         {
  484.             setd ".playerid"+.@i, getcharid(3);
  485.             doevent "#PP_Thundergen::OnWet";
  486.             break;
  487.         }
  488.     }
  489.     end;
  490.    
  491.     OnWet:
  492.     while (1)
  493.     {
  494.         sleep2 2000;
  495.         getmapxy .@map$, .@x, .@y, 0;
  496.         if ( (.@map$ != "power_plant") ||
  497.             (.@x > 81) || (.@x < 58) ||
  498.             (.@y > 83) || (.@y < 60) ||
  499.             ( (.@x > 61) && (.@x < 78) &&
  500.             ((.@y < 80) && (.@y > 63)) ) ||
  501.             (Hp <= 0) )
  502.         {
  503.             for (set .@i, 0; .@i < 30; set .@i, .@i + 1)
  504.             {
  505.                 if (getd(".playerid"+.@i) == getcharid(3))
  506.                 {
  507.                     setd ".playerid"+.@i, 0;
  508.                     break;
  509.                 }
  510.             }
  511.             end;
  512.         }
  513.     }
  514.    
  515.     OnThunder:
  516.     for (set .@i, 0; .@i < 30; set .@i, .@i + 1)
  517.     {
  518.         if (getd(".playerid"+.@i) != 0)
  519.         {
  520.             if (isloggedin(getd(".playerid"+.@i)))
  521.             {
  522.                 if (attachrid(getd(".playerid"+.@i)))
  523.                 {
  524.                     dispbottom "The power generator was activated!";
  525.                     specialeffect2 622;
  526.                     if (rand(1,4) == 1)
  527.                     {    
  528.                         set .@rand, rand(90, 95);
  529.                         percentheal -(.@rand), 0;
  530.                         heal -1, 0;
  531.                     }
  532.                     else
  533.                     {
  534.                         percentheal -100, 0;
  535.                         heal -1, 0;
  536.                     }
  537.                     detachrid;
  538.                 }
  539.             }
  540.         }
  541.     }
  542.     end;
  543.    
  544. }
  545.  
  546. // ----------------------------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top