quest maker

By Streiker/uploaded by aero, 1 Month ago, written in php.
  1. /*
  2.    ||------------------------------------------------------||
  3.    ||                       NPC:                           ||
  4.    ||======================================================||
  5.    ||                    Quest Maker                       ||
  6.    ||======================================================||
  7.    ||                    Version 1.0                       ||
  8.    ||======================================================||
  9.    ||                   Made by Streiker                   ||
  10.    ||======================================================||
  11.    ||                      Updates:                        ||
  12.    ||                    (5 latests)                       ||
  13.    ||======================================================||
  14.    ||                     Description:                     ||
  15.    ||                                                      ||
  16.    || Quest Maker, enable the easy incorporation of quests.||
  17.    ||======================================================||
  18.    ||                  Additional Comments:                ||
  19.    ||                                                      ||
  20.    || At the moment none.                                  ||
  21.    ||======================================================||
  22.    ||======================================================||
  23. */
  24.         //                                                                     
  25.  
  26.                                      Separator              Required items
  27. // callfunc "Quest_Maker",Color ( Optional ), "Name of the quest", ID Prize
  28.  
  29. 1, Amount 1,ID Prize 2[...], Amount 2[...], 111, Required Zeny, Item 1,
  30.  
  31. Amount 1, Item 2[...], Amount 2[...];
  32. // 111 is used for separate the items of the required zeny
  33.  
  34. function        script  Quest_Maker     {
  35.  
  36.         set .@x1$, "["+( ( getarg ( 0, 0 ) ) ? "^"+ getarg ( 0 ) : "^2b86b5"
  37.  
  38. );
  39.         set .@x2$, .@x1$ +""+ getarg ( 1 ) +"^000000]";
  40.         mes .@x2$;
  41.         mes ( ( getarg ( 7, 0 ) ) ? "You need "+  getarg ( 5 ) +" zeny." :
  42.  
  43. "" );
  44.         mes "^000000Prizes of the Quest:";
  45.         for ( set .@i, 2; getarg ( .@i, 0 ) != 111 ; set .@i,.@i + 2 )
  46.                 mes "^007c66"+ getarg ( .@i + 1 ) +" "+ getitemname ( getarg
  47.  
  48. ( .@i ) ) +".";
  49.         mes "^000000Neccesary Items:";
  50.         for ( set .@i, 8; getarg ( .@i, 0 ) != 0 ; set .@i,.@i + 2 )
  51.                 mes ( ( countitem ( getarg ( .@i ) ) < getarg ( .@i + 1 ) )
  52.  
  53. ? "^800000":"^008000" ) +" "+ getarg ( .@i + 1 ) +" "+ getitemname ( getarg
  54.  
  55. ( .@i ) ) +" ["+ countitem ( getarg ( .@i ) ) +"/^008000"+ getarg ( .@i + 1
  56.  
  57. ) +"]";
  58.         next ;
  59.         mes .@x2$;
  60.         mes "^000000Do you like to exchange it items?";
  61.         select ( "Sure", "No..." ) ;
  62.         switch ( @menu ) {
  63.  
  64.                 case 1:
  65.  
  66.                 for ( set .@i, 8; getarg ( .@i, 0 ) != 0 ; set .@i,.@i + 2 )
  67.  
  68. {
  69.                         if ( countitem ( getarg ( .@i ) ) < getarg ( .@i + 1
  70.  
  71. ) ) {
  72.                                 set .@a, getarg ( .@i + 1 ) - countitem (
  73.  
  74. getarg ( .@i ) );
  75.                                 mes "^880000I'm so sorry, but you don't have
  76.  
  77. "+ .@a +" "+ getitemname ( getarg ( .@i ) );
  78.                                 return ;
  79.                         }
  80.                         if ( zeny < getarg ( 7, 0 ) ) {
  81.                                 set .@a, getarg ( 7, 0 ) - zeny;
  82.                                 mes "^880000I'm so sorry, but you don't have
  83.  
  84. "+ .@a +" zenys.";
  85.                                 return ;
  86.                         }
  87.                 }
  88.                 for ( set .@i, 8; getarg ( .@i, 0 ) != 0 ; set .@i,.@i + 2 )
  89.  
  90. delitem getarg ( .@i ), getarg ( .@i + 1 ) ;
  91.                 for ( set .@i, 2; getarg ( .@i, 0) != 111 ; set .@i,.@i + 2
  92.  
  93. ) getitem getarg ( .@i ), getarg ( .@i + 1 ) ;
  94.                 set zeny, zeny - getarg ( 7, 0 );
  95.                 mes "Congratulations";
  96.                 mes "You won for complete the quest:";
  97.                 for ( set .@i, 2; getarg ( .@i, 0 ) != 111 ; set .@i,.@i + 2
  98.  
  99. )
  100.                         mes "^067c00"+ getarg ( .@i + 1 ) +" "+ getitemname
  101.  
  102. ( getarg ( .@i ) ) +".";
  103.                 break ;
  104.  
  105.                 case 2:
  106.  
  107.                 mes "Goodbye.";
  108.                 break ;
  109.  
  110.         }
  111.         return ;
  112. }
  113.  
  114.  
  115. // Example NPC:
  116.  
  117.         /*
  118.  
  119. -       script  asdf    -1,{
  120.  
  121. OnWhisperGlobal:
  122.  
  123.         select ( "Quest One", "Quest Two" );
  124.         switch ( @menu ) {
  125.  
  126.                 case 1:
  127.  
  128.                 callfunc "Quest_Maker",0,"Quest
  129.  
  130. One",512,1,513,3,111,1000000,502,30,503,40;
  131.                 break;
  132.  
  133.                 case 2:
  134.  
  135.                 callfunc "Quest_Maker","89cc44","Quest
  136.  
  137. Two",513,59,4441,3,111,5000000,509,30,510,40,511,30;
  138.                 break;
  139.         }
  140.         close ;
  141.  
  142. }
  143.         */