Advertisement
Emistry

[RO] NPC Shop - Jump Town upon purchases

Jun 24th, 2017
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. // https://rathena.org/board/topic/111442-npc-jump-onbuy-item/
  2.  
  3.  
  4. - shop sample_shop -1,909:-1
  5.  
  6. prontera,155,181,5 script Sample#npc 4_F_KAFRA1,{
  7. npcshopattach "sample_shop",1;
  8. callshop "sample_shop", 2;
  9. end;
  10.  
  11. OnBuyItem:
  12. getmapxy( .@map$,.@x,.@y,0 );
  13. for ( .@i + 0; .@i < ; .@i++ ) {
  14. for ( .@x = 0; .@x < .item_id_size; .@x++ ) {
  15. if ( @bought_nameid[.@i] == .item_id[.@x] ) {
  16. .@total_cost = ( .price[.@x] * @bought_quantity[.@i] );
  17. if ( Zeny >= .@total_cost ) {
  18. Zeny -= .@total_cost;
  19. getitem @bought_nameid[.@i],@bought_quantity[.@i];
  20. announce strcharinfo(0)+" has bought "+getitemname( @bought_nameid[.@i] )+" from the tool dealer on "+.@map$+" ("+.@x+","+.@y+")",bc_all;
  21. .@success++;
  22. }
  23. }
  24. }
  25. mes "Done.";
  26. close2;
  27. if ( .@success ) {
  28. callsub L_Warp, .@map$;
  29. }
  30. end;
  31.  
  32. L_Warp:
  33. .@map$ = getarg(0,"");
  34. do {
  35. .@new_map$ = F_Rand( "prontera", "payon", "izlude" );
  36. } while ( .@new_map$ == .@map$ );
  37.  
  38. do {
  39. .@x = rand( 400 );
  40. .@y = rand( 400 );
  41. } while( !checkcell( .@new_map$, .@x, .@y, cell_chkpass ) );
  42. unitwarp getnpcid(0), .@new_map$, .@x, .@y;
  43. return;
  44.  
  45. OnInit:
  46. setarray .item_id, 501,502,503,504;
  47. setarray .price,1,2,3,4;
  48.  
  49. npcshopdelitem "sample_shop",909;
  50. .item_id_size = getarraysize( .item_id );
  51. for ( .@i = 0; .@i < .item_id_size; .@i++ )
  52. npcshopadditem "sample_shop",.item_id[.@i],.price[.@i];
  53. end;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement