Emistry icon

[RO] NPC Shop - Jump Town upon purchases

Emistry | PRO | 06/24/17 08:58:39 PM UTC | 0 ⭐ | 772 👁️ | Never ⏰ | []
text |

1.44 KB

|

None

|

0 👍

/

0 👎

// https://rathena.org/board/topic/111442-npc-jump-onbuy-item/
  -	shop	sample_shop	-1,909:-1
 prontera,155,181,5	script	Sample#npc	4_F_KAFRA1,{
	npcshopattach "sample_shop",1;
	callshop "sample_shop", 2;
	end;
 	OnBuyItem:
		getmapxy( .@map$,.@x,.@y,0 );
		for ( .@i + 0; .@i < ; .@i++ ) {
			for ( .@x = 0; .@x < .item_id_size; .@x++ ) {
				if ( @bought_nameid[.@i] == .item_id[.@x] ) {
					.@total_cost = ( .price[.@x] * @bought_quantity[.@i] );
					if ( Zeny >= .@total_cost ) {
						Zeny -= .@total_cost;
						getitem @bought_nameid[.@i],@bought_quantity[.@i];
						announce strcharinfo(0)+" has bought "+getitemname( @bought_nameid[.@i] )+" from the tool dealer on "+.@map$+" ("+.@x+","+.@y+")",bc_all;
						.@success++;
					}
				}
			}
		mes "Done.";
		close2;
		if ( .@success ) {
			callsub L_Warp, .@map$;
		}
		end;
 	L_Warp:
		.@map$ = getarg(0,"");
		do {
			.@new_map$ = F_Rand( "prontera", "payon", "izlude" );
		} while ( .@new_map$ == .@map$ );
 		do {
			.@x = rand( 400 );
			.@y = rand( 400 );
		} while( !checkcell( .@new_map$, .@x, .@y, cell_chkpass ) );
		unitwarp getnpcid(0), .@new_map$, .@x, .@y;
		return;
 	OnInit:
		setarray .item_id, 501,502,503,504;
		setarray .price,1,2,3,4;
 		npcshopdelitem "sample_shop",909;
		.item_id_size = getarraysize( .item_id );
		for ( .@i = 0; .@i < .item_id_size; .@i++ )
			npcshopadditem "sample_shop",.item_id[.@i],.price[.@i];
		end;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎