Version 1.0.0
145 downloads
This commands verify if a npc is selling, returning 1 to yes and 0 to no.
Its very useful to black market scripts for players who knows item id and don't want to lost time searching where items are sold.
Obs: Didn't test the sample script, but you can have a idea in how to use.
Sample Script:
prontera,150,150,5 Script Who's Selling 90,{
.@n$ = "[Who is Selling]";
mes .@n$;
// Its nice to put a delay in this script if you use a lot of stores in one map and in your .npc$ array
// I'm using 5 seconds in this sample.
if((gettimetick(2) - whosell_delay) < 5)
{
mes "You have to wait 5 seconds to use me again.";
close;
}
mes "Tell me the item ID you want to know what npc's is selling it!";
input .@id; // You can test this sample with 607 ID
whosell_delay = gettimetick(2);
for( .@i = 1; .@i < getarraysize(.npcs$); .@i++)
{
.@found = isselling( getcharid(0), .npcs$[.@i], .@id );
if( .@found )
{
next;
mes "Ha, this item is " + getitemname( .@id ) + ", right?";
next;
mes .@n$;
mes "Who is selling it is " + .npcs$[.@i] + "!";
close2;
showevent QTYPE_EVENT,QMARK_YELLOW,getcharid(0),.npcs$[.@i]; // Show in npc a ballon to player
end;
}
}
next;
mes .@n$;
mes "No npc selling it :)";
end;
OnInit:
setarray .npcs$[1],"Store 1","Store 2";
end;
}
prontera,151,150,5 shop Store 1 90,607:1000
prontera,152,150,5 shop Store 2 90,610:1000