Advertisement
Guest User

Untitled

a guest
Apr 11th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.12 KB | None | 0 0
  1. prontera,155,181,5  script  Monster Counting Game   4_F_JPN2,{
  2.     function xy_wall;
  3.     end;
  4.    
  5.     OnInit:
  6.         .max_round = 3;
  7.         .max_duration = 3;
  8.         .wall_mob_id = 1085;
  9.         setarray .xy_area,
  10.             151,169,
  11.             161,179;
  12.         setarray .monster,
  13.             PORING,
  14.             DROPS,
  15.             MARIN,
  16.             POPORING;
  17.            
  18.         .monster_size = getarraysize( .monster );
  19.         .npc_name$ = strnpcinfo(0);
  20.         getmapxy( .Map$,.npc_x,.npc_y,1 );
  21.         setmapflag .Map$,mf_monster_noteleport;
  22.         end;
  23.        
  24.     OnMinute00:
  25.     OnStartEvent:
  26.         if ( !.status ) {
  27.             areawarp .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],.Map$,.npc_x,.npc_y;
  28.             killmonster .Map$,.npc_name$+"::OnDied";
  29.             killmonster .Map$,.npc_name$+"::OnWallDied";
  30.             setcell .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,1;
  31.             setcell .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
  32.             .status = 1;
  33.            
  34.             for( .@i = .xy_area[0]; .@i <= .xy_area[2]; .@i++ ){
  35.                 xy_wall( .@i,.xy_area[1] );
  36.                 xy_wall( .@i,.xy_area[3] );
  37.             }
  38.             for( .@i = .xy_area[1]; .@i <= .xy_area[3]; .@i++ ){
  39.                 xy_wall( .xy_area[0],.@i,0 );
  40.                 xy_wall( .xy_area[2],.@i );
  41.             }
  42.            
  43.             do{
  44.                 .@round++;
  45.                 npctalk "Round # "+.@round;
  46.                 sleep 5000;
  47.                
  48.                 .status = 2;
  49.                 .@mob = .monster[ rand( .monster_size ) ];
  50.                 .@amount = rand( 20,50 );
  51.                 // add-on size influence ?
  52.                 areamonster .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],"",.@mob,.@amount,.npc_name$+"::OnDied";
  53.            
  54.                 deletepset 1;
  55.                 defpattern 1,"([^:]+):.*"+.@amount+".$", "OnRight";
  56.                 activatepset 1;
  57.                 waitingroom "How many's there?",0;
  58.                 npctalk "Tell me the correct amount of monster in there.";
  59.                 // debugmes " > "+.@amount+" "+getmonsterinfo( .@mob,MOB_NAME );
  60.                
  61.                 sleep ( .max_duration * 60000 );
  62.                
  63.                 killmonster .Map$,.npc_name$+"::OnDied";
  64.                 delwaitingroom;
  65.                 deletepset 1;
  66.                 .status = 1;
  67.                 sleep 5000;
  68.                
  69.             }while( .@round < .max_round );
  70.            
  71.             npctalk "That's the Last, thank you for participating.";
  72.             emotion e_thx;
  73.            
  74.             killmonster .Map$,.npc_name$+"::OnDied";
  75.             killmonster .Map$,.npc_name$+"::OnWallDied";
  76.             setcell .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,0;
  77.             setcell .Map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
  78.             .status = 0;
  79.         }
  80.         end;
  81.        
  82.     OnDied:
  83.     OnWallDied:
  84.         end;
  85.  
  86.     OnRight:
  87.         getmapxy( .@Map$,.@x,.@y,0 );
  88.         if ( .status == 0 ) {
  89.             dispbottom "[Counting Game] Event isnt running.";
  90.         }
  91.         else if ( .status == 1 ) {
  92.             dispbottom "[Counting Game] Please wait for the round to start.";
  93.         }
  94.         else if ( distance( .npc_x,.npc_y,.@x,.@y ) > 14 ) {
  95.             dispbottom "[Counting Game] You're too far away.";
  96.         }
  97.         else {
  98.             npctalk "Bravo!! "+strcharinfo(0)+" is correct!!";
  99.            
  100.             // rewards
  101.             getitem 512,1;
  102.             getitem 512,2;
  103.             getitem 512,3;
  104.            
  105.             specialeffect EF_POTION_CON;
  106.             awake .npc_name$;
  107.         }
  108.         end;
  109.        
  110.     function    xy_wall {
  111.         .@x = getarg(0);
  112.         .@y = getarg(1);
  113.         monster .Map$,.@x,.@y,"",.wall_mob_id,1,.npc_name$+"::OnWallDied";
  114.         setcell .Map$,.@x,.@y,.@x,.@y,cell_walkable,0;
  115.         // setcell .Map$,.@x,.@y,.@x,.@y,cell_basilica,1;
  116.         return;
  117.     }
  118.  
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement