Advertisement
johnlol

Counting Game 4.1

May 10th, 2019
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ________________     ______            ________      
  3. ___    |_____  /________  /______      ___  __ \_____
  4. __  /| |  __  /_  __ \_  __ \  _ \     __  /_/ /  __ \
  5. _  ___ / /_/ / / /_/ /  /_/ /  __/     _  _, _// /_/ /
  6. /_/  |_\__,_/  \____//_.___/\___/      /_/ |_| \____/
  7.  
  8. */
  9.  
  10. prontera,156,157,5  script  Counting Game   437,{
  11. mes "This is a Monsters Counting Game";
  12. mes "I will summon some Monsters here, and you have to count the Correct Amount of Monsters i summoned.";
  13. mes "^FF0000Only Count for the Monsters i mentioned^000000";
  14. next;
  15. switch( select( "Information",
  16.                 ( getgmlevel() < .GMLevel || .Event )?"":"^FF0000[GM]^000000 Start Game",
  17.                 ( getgmlevel() < .GMLevel || !.Event )?"":"^FF0000[GM]^000000 End Game" )){
  18.                
  19. Case 1:
  20.     mes "When the Event Start, i will summon some Monsters at a small area, and players have to count the amount of the flowers.";
  21.     mes "Whoever tell me the correct amount of Monsters i mentioned, he/she win the game.";
  22.     break;
  23.    
  24. Case 2:
  25.     mes "Event will begin right now.";
  26.     close2;
  27.     donpcevent strnpcinfo(0)+"::OnStartGame";
  28.     end;
  29.  
  30. Case 3:
  31.     set .Event,0;
  32.     set .Round,0;
  33.     deletepset 1;
  34.     delwaitingroom;
  35.     set .Winner[0],0;
  36.     set .Winner[1],0;
  37.     npctalk "Counting Game Cancelled.";
  38.     killmonster .Map$,"All";
  39.     mes "Game Cancelled.";
  40.     break;
  41. }
  42. close;
  43.  
  44. OnSpammed:
  45.     set @Spam,0;
  46.     end;
  47.    
  48. iSpam:
  49.     if( getgmlevel() > 90 ) end;
  50.     set @Spam,@Spam + 1;
  51.     if( @Spam >= .Spam ){   // 3 Continuos Answer will trigger...
  52.         set @SpamDelay,gettimetick(2) + .Spam;
  53.         dispbottom "SPAM Detected, your answer within next "+.Spam+" Seconds will be Ignored.";
  54.     }
  55.     deltimer strnpcinfo(0)+"::OnSpammed";
  56.     addtimer ( .Spam * 1000 ),strnpcinfo(0)+"::OnSpammed";
  57.     end;
  58.    
  59. iRight:
  60. set @Spam,0;
  61. deltimer strnpcinfo(0)+"::OnSpammed";
  62. if( !.Event ){
  63.     message strcharinfo(0),"Sorry, there is no Event right now.";
  64. }else if( @SpamDelay > gettimetick(2) ){
  65.     message strcharinfo(0),"SPAM Protection : Remain "+( @SpamDelay - gettimetick(2) )+" seconds.";
  66. }else if( getcharid(0) == .Winner[0] && gettimetick(2) < .Winner[1] ){
  67.     message strcharinfo(0),"Sorry, Winner Time Penalty : Remain "+( .Winner[1] - gettimetick(2) )+" seconds.";
  68. }else{
  69.     delwaitingroom;
  70.     set .Event,0;
  71.     set .Round,.Round - 1;
  72.     set .Winner[0],getcharid(0);
  73.     set .Winner[1],gettimetick(2) + .Delay;
  74.     npctalk "[ "+strcharinfo(0)+" ] , You're Correct.";
  75.     killmonster .Map$,"All";
  76.     deletepset 1;
  77.     if( getarraysize( .Reward$ ) > 1 )
  78.         for( set .@i,0; .@i < getarraysize( .Reward$ ) - 1; set .@i,.@i + 2 )
  79.             if( getitemname( atoi( .Reward$[.@i] ) ) == "null" ){
  80.                 set getd( .Reward$[.@i] ),getd( .Reward$[.@i] ) + atoi( .Reward$[.@i+1] );
  81.                 dispbottom "Reward : "+.Reward$[.@i]+" + "+.Reward$[.@i+1];
  82.             }else{
  83.                 getitem atoi( .Reward$[.@i] ),atoi( .Reward$[.@i+1] );
  84.                 dispbottom "Reward : "+getitemname( atoi( .Reward$[.@i] ) )+" x "+.Reward$[.@i+1];
  85.             }
  86. if( .Round ) donpcevent strnpcinfo(0)+"::OnStartGame";
  87. }
  88. end;
  89.  
  90.  
  91. OnInit:
  92. //  Min. GM Level to access GM Panel
  93. set .GMLevel,80;
  94. //  Game Location
  95. set .Map$,"prontera";
  96. //  Monster ID Lists
  97. setarray .MonsterList[0],1084,1085;
  98. //  Winners Answer Delay ( Not advised for High Value )
  99. set .Delay,10;
  100. //  Spam Prevention ( Not advised for High Value )
  101. set .Spam,3;
  102. //  How many rounds
  103. set .MaxRound,10;
  104. //  Area Coordination   <x1>,<y1>,<x2>,<y2>;
  105. setarray .Coordinate,153,146,159,153;
  106. //  Rewards ...
  107. setarray .Reward$[0],
  108.         //  "#CASHPOINTS","100",
  109.             "Zeny","10000",
  110.             "7227","1",
  111.         //  "CustomVariable","100000",
  112.         //  "#CustomVariable","100000",
  113.             "7539","5";
  114. end;
  115.  
  116.  
  117. OnMinute30:
  118. for( set .@i,60; .@i > 0; set .@i,.@i - 10 ){
  119.     announce "Flower Counting Game : start within "+.@i+" Seconds in "+.Map$,0;
  120.     sleep 10000;
  121. }  
  122.  
  123. OnStartGame:
  124.     if( !.Round ) set .Round,.MaxRound;
  125.     announce "Counting Game has started in "+.Map$,0;
  126.     deletearray .MobCount[0],getarraysize( .MobCount );
  127.     for( set .@x,.Coordinate[0]; .@x <= .Coordinate[2]; set .@x,.@x + 1 )
  128.         for( set .@y,.Coordinate[1]; .@y <= .Coordinate[3]; set .@y,.@y + 1 ){
  129.             set .@Summon,rand( getarraysize( .MonsterList ) );
  130.             monster .Map$,.@x,.@y,"Count Me",.MonsterList[.@Summon],1,strnpcinfo(0)+"::OnKilled";
  131.             set .MobCount[.@Summon],.MobCount[.@Summon] + 1;
  132.             sleep2 1;
  133.         }
  134.     set .@Target,rand( getarraysize( .MonsterList ) );
  135.     deletepset 1;
  136.     defpattern 1, "([^:]+): (\\|\\d{2})?"+.MobCount[.@Target]+ ".$", "iRight";
  137.     // defpattern 1,"([^:]+): "+.MobCount[.@Target], "iRight";
  138.     defpattern 1,"([^:]+):.*.*", "iSpam";
  139.     activatepset 1;
  140.     delwaitingroom;
  141.     waitingroom getmonsterinfo( .MonsterList[.@Target],0 ),0;
  142.     npctalk "Count for the Targeted Monster's Amount to Win the Game.";
  143.     set .Event,1;
  144.     end;
  145.    
  146. OnKilled:
  147.     mes "You will be punished upon killing these Monsters and interupt the Game.";
  148.     set @Spam,30;
  149.     close2;
  150.     npctalk "Round Restarted due to interruption.";
  151.     donpcevent strnpcinfo(0)+"::OnStartGame";
  152.     end;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement