Jump to content
  • 0

A Specific Currency Trader?


Snap

Question


  • Group:  Members
  • Topic Count:  64
  • Topics Per Day:  0.01
  • Content Count:  186
  • Reputation:   0
  • Joined:  04/07/12
  • Last Seen:  

Can someone make me a npc that you need to pay via my custom token which is Guild Token 10515?

Its look like a Dynamic npc that emistry has. Thanks.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  40
  • Reputation:   0
  • Joined:  12/10/11
  • Last Seen:  

Try This one dude

Credis to Emistry's Currency Shop

Just change the ITEM ID name PRICE.

// Leave this alone...

- shop QwertyRO_Shop -1,512:100

prontera,155,181,5 script Donation NPC 757,{

function ShopSettings;

function ValidateCost;

function CurrencyInfo;

function ClearData;

function ValueConvert;

function ErrorNotice;

mes "Welcome to^FF0000Donate Shop^000000.";

mes "^00FF00____________________________^000000";

mes "So,Which shop you would like to look at it";

next;

// Menu Selection

select("Armor:Garment:Shoes:Shield:Weapon:Accesory"); // Change The Name Here for EX. Donation 1:Donation2:Donation3...etc.etc.

ClearData();

ShopSettings( @menu );

npcshopitem "QwertyRO_Shop",512,100;

npcshopdelitem "QwertyRO_Shop",512;

for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)

npcshopadditem "QwertyRO_Shop",@ItemLists[.@i],@ItemCost[.@i];

mes "Okay...wait awhile";

mes "^00FF00____________________________^000000";

CurrencyInfo( @Currency$ );

mes "^00FF00____________________________^000000";

callshop "QwertyRO_Shop",1;

npcshopattach "QwertyRO_Shop";

end;

function ShopSettings {

switch( getarg(0) ){

Case 1:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512=; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000=; // Put The Price Here.

break;

Case 2:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512=; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000=; // Put The Price Here

break;

Case 3:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000=; // Put The Price Here

break;

Case 4:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000; // Put The Price Here

break;

Case 5:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000; // Put The Price Here

break;

Case 6:

// Currency [ Item ID / Variable Name ]

set @Currency$,"10515";

// Item ID Lists

setarray @ItemLists[0],512; // Your Item ID Goes Here. You can put 20 ID Items

// Item Price

setarray @ItemCost[0],1000; // Put The Price here

break;

default:

ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." );

close;

}

if( @Currency$ == "" )

ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." );

if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) )

ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." );

return;

}

function ErrorNotice {

mes "^FF0000ERROR^000000 - "+getarg(0);

mes "^00FF00____________________________^000000";

mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !";

close;

}

function CurrencyInfo {

if( getitemname( atoi( getarg(0) ) ) != "null" ){

mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000";

mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000";

}else if( getitemname( atoi( getarg(0) ) ) == "null" ){

mes "Variable Currency : ^FF0000"+getarg(0)+"^000000";

mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000";

}

return;

}

function ValidateCost {

if( getitemname( atoi( getarg(0) ) ) != "null" ){

if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1;

}else if( getitemname( atoi( getarg(0) ) ) == "null" ){

if( getd( getarg(0) ) < getarg(1) ) return 1;

}

return;

}

function ClearData {

set @Currency$,"";

set @TotalCost,0;

deletearray @bought_nameid[0],getarraysize( @bought_nameid );

deletearray @bought_quantity[0],getarraysize( @bought_quantity );

deletearray @ItemLists[0],getarraysize( @ItemLists );

deletearray @ItemCost[0],getarraysize( @ItemCost );

return;

}

function ValueConvert {

set .@num, atoi(""+getarg(0));

if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);

set .@l, getstrlen(""+.@num);

for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {

set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;

if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;

}

return .@num$;

}

OnBuyItem:

ShopSettings( @menu );

for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)

for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)

if( @ItemLists[@j] == @bought_nameid[@i] )

set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] );

mes "^FF0000 BILLING LIST^000000";

mes "^00FF00____________________________^000000";

for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )

mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";

mes "^00FF00____________________________^000000";

if( getitemname( atoi( @Currency$ ) ) != "null" )

mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";

else if( getitemname( atoi( @Currency$ ) ) == "null" ){

mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";

}

mes "^00FF00____________________________^000000";

if( ValidateCost( @Currency$,@TotalCost ) ){

if( getitemname( atoi( @Currency$ ) ) != "null" )

mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+getitemname( @Currency$ )+"^000000";

else if( getitemname( atoi( @Currency$ ) ) == "null" ){

mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000";

}

}else{

if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){

if( getitemname( atoi( @Currency$ ) ) != "null" )

delitem atoi( @Currency$ ),@TotalCost;

else if( getitemname( atoi( @Currency$ ) ) == "null" ){

set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost;

}

for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)

getitem @bought_nameid[@i],@bought_quantity[@i];

message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items.";

mes "Thank you for shopping.";

}

}

ClearData();

close;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  64
  • Topics Per Day:  0.01
  • Content Count:  186
  • Reputation:   0
  • Joined:  04/07/12
  • Last Seen:  

I only want 1

Its like a TCG Trader but different currency.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

swt...if you want only 1 shop in the NPC..

then just edit the select menu..

and remove the remaining cases in the ShopSettings function..

if you are looking for the previous version of dynamic npc trader...use search engine..there is alot..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  64
  • Topics Per Day:  0.01
  • Content Count:  186
  • Reputation:   0
  • Joined:  04/07/12
  • Last Seen:  

I did. But once i will buy the specific item. it doesn't appear in the inventory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...