Jump to content

[Script Command] isselling - Discovery if a npc is selling a item by ID 1.0.0


1 Screenshot

About This File

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

 

image.thumb.png.ecf7a84e7fd721c9f0beae6339252850.png

image.png.3e575f0ba8bfa9f058cc91e535fe9c8f.png

 

image.thumb.png.49e88f7bcf3b501559b155f5cdfc2e5a.png

 

image.png.ddc035197a0656f5304c23864531c1e8.png

 

image.png.37037818f72c5851f924444deb9b0b93.png

  • Upvote 1
  • Love 3

×
×
  • Create New...