Diss Posted October 31, 2013 Posted October 31, 2013 (edited) is there any commands for converter or exchanger coin to tcg for example @converter . and commands for callshop window for exmaple @questshop @donation. thanks Edited October 31, 2013 by Diss Quote
Patskie Posted October 31, 2013 Posted October 31, 2013 Try : - shop dynamicshop -1,501:20 - script Sample -1,{ OnConvert: .Coin = 674; // Bronze coin, mithril coin etc. .Card = 7227; // TCG card, PODS etc. .Rate = 10; // n coin = 1 card mes "I can covert your " +.Rate+ "x " +getitemname(.Coin)+ " to 1 " +getitemname(.Card); next; mes "How many " +getitemname(.Coin)+ " would you like to convert?"; next; input .@amount; if ( !.@amount || countitem( .Coin ) < ( .Rate * .@amount ) ) { mes "Invalid amount"; close; } mes "Here you go!"; close2; getitem .Card, .@amount; delitem .Coin, ( .@amount * .Rate ); end; OnShop: callshop "dynamicshop",1; npcshopattach "dynamicshop"; end; OnBuyItem: for ( set .@j, 0; .@j < getarraysize(.items); set .@j, .@j + 2 ) { for ( set .@k, 0; .@k < getarraysize(@bought_nameid); set .@k, .@k + 1 ) { if ( @bought_nameid[.@k] == .items[.@j] ) { if ( checkweight( @bought_nameid[.@k], @bought_quantity[.@k] ) ) { if ( countitem(.currency) < .items[.@j+1] || countitem(.currency) < ( .items[.@j+1] * @bought_quantity[.@k] ) ) dispbottom "You don't have enough " +getitemname(.currency)+ " to purchase this item."; else { delitem .currency, .items[.@j+1] * @bought_quantity[.@k]; getitem @bought_nameid[.@k], @bought_quantity[.@k]; } } else dispbottom "You cannot carry out more items with you"; } } } deletearray @bought_quantity, getarraysize(@bought_quantity); deletearray @bought_nameid, getarraysize(@bought_nameid); end; OnInit: set .currency, 7227; // TCG is used to buy items setarray .items, 4001,5,7227,100; // Usage : <item id>,<price> npcshopitem "dynamicshop",0,0; for ( set .@i, 0; .@i < getarraysize(.items); set .@i, .@i + 2 ) npcshopadditem "dynamicshop", .items[.@i], .items[.@i+1]; bindatcmd "converter", strnpcinfo(3)+ "::OnConvert"; bindatcmd "donation", strnpcinfo(3)+ "::OnShop"; end; } Some configurations for @converter : .Coin = 674; // Bronze coin, mithril coin etc. .Card = 7227; // TCG card, PODS etc. .Rate = 10; // n coin = 1 card and for @donation : set .currency, 7227; // TCG is used to buy items setarray .items, 4001,5,7227,100; // Usage : <item id>,<price> Quote
Diss Posted October 31, 2013 Author Posted October 31, 2013 ok its works but the 1st 2 line got error on spacing it should be tab spacing .. thanks to you .. +! sir Try : - shop dynamicshop -1,501:20 - script Sample -1,{ OnConvert: .Coin = 674; // Bronze coin, mithril coin etc. .Card = 7227; // TCG card, PODS etc. .Rate = 10; // n coin = 1 card mes "I can covert your " +.Rate+ "x " +getitemname(.Coin)+ " to 1 " +getitemname(.Card); next; mes "How many " +getitemname(.Coin)+ " would you like to convert?"; next; input .@amount; if ( !.@amount || countitem( .Coin ) < ( .Rate * .@amount ) ) { mes "Invalid amount"; close; } mes "Here you go!"; close2; getitem .Card, .@amount; delitem .Coin, ( .@amount * .Rate ); end; OnShop: callshop "dynamicshop",1; npcshopattach "dynamicshop"; end; OnBuyItem: for ( set .@j, 0; .@j < getarraysize(.items); set .@j, .@j + 2 ) { for ( set .@k, 0; .@k < getarraysize(@bought_nameid); set .@k, .@k + 1 ) { if ( @bought_nameid[.@k] == .items[.@j] ) { if ( checkweight( @bought_nameid[.@k], @bought_quantity[.@k] ) ) { if ( countitem(.currency) < .items[.@j+1] || countitem(.currency) < ( .items[.@j+1] * @bought_quantity[.@k] ) ) dispbottom "You don't have enough " +getitemname(.currency)+ " to purchase this item."; else { delitem .currency, .items[.@j+1] * @bought_quantity[.@k]; getitem @bought_nameid[.@k], @bought_quantity[.@k]; } } else dispbottom "You cannot carry out more items with you"; } } } deletearray @bought_quantity, getarraysize(@bought_quantity); deletearray @bought_nameid, getarraysize(@bought_nameid); end; OnInit: set .currency, 7227; // TCG is used to buy items setarray .items, 4001,5,7227,100; // Usage : <item id>,<price> npcshopitem "dynamicshop",0,0; for ( set .@i, 0; .@i < getarraysize(.items); set .@i, .@i + 2 ) npcshopadditem "dynamicshop", .items[.@i], .items[.@i+1]; bindatcmd "converter", strnpcinfo(3)+ "::OnConvert"; bindatcmd "donation", strnpcinfo(3)+ "::OnShop"; end; } sir patskie how about the donation with preview ? thanks Quote
Question
Diss
is there any commands for converter or exchanger coin to tcg for example @converter .
and commands for callshop window for exmaple @questshop @donation.
thanks
Edited by Diss2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.