Byakuran Posted May 17, 2012 Group: Members Topic Count: 110 Topics Per Day: 0.02 Content Count: 229 Reputation: 5 Joined: 12/16/11 Last Seen: May 6, 2020 Share Posted May 17, 2012 can someone make this npc announce when someone buy ... but i want it to announce this "Player name" has purchase a "item name" from donation npc heres my npc //================ DONATION Trader=================== turbo_room,99,120,6 script Donation Shop 403,{ mes .name$; mes "You currently have "+countitem(.tcg_item)+" TCG."; mes "Would you like to look at the shop?"; next; if(select("Yes:No") == 2) {close;} close2; callshop "Donation_SHOP",1; npcshopattach "Donation_SHOP"; dispbottom "You currently have "+countitem(.Donation_item)+" TCG."; end; OnBuyItem: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+1) { if(.TCG_ITEMS[@j] == @bought_nameid[@i]) { set @itemcost,(.ITEMPRICE[@j]*@bought_quantity[@i]); set @totalcost,(@totalcost+@itemcost); break; } } } if(@totalcost > countitem(.tcg_item)) { dispbottom "You don't have enough TCG."; } else { for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; } delitem .tcg_item,@totalcost; dispbottom "Thank you for shopping."; } set @totalcost,0; deletearray @bought_nameid[0],128; deletearray @bought_quantity[0],128; end; OnInit: npcshopdelitem "Donation_SHOP",909; // Leave this alone set .name$,"[Donation Trader]"; set .tcg_item,7179; // Input TCG ID setarray .TCG_ITEMS[0],5467,2720,2721,2722,2723,2724,2725,5374,5518,2629,20001,1228,13017,2630,4441,2554,5325; setarray .ITEMPRICE[0],10,7,7,7,7,7,7,10,10,8,6,5,6,4,10,6,4; // Item prices - Should followe ID's order for(set .@item,0; .@item < getarraysize(.TCG_ITEMS); set .@item,.@item+1) { npcshopadditem "Donation_SHOP",.TCG_ITEMS[.@item],.ITEMPRICE[.@item]; } end; } - shop Donation_SHOP -1,909:5 Quote Link to comment Share on other sites More sharing options...
Docubo Posted May 17, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 117 Reputation: 8 Joined: 05/07/12 Last Seen: May 12, 2024 Share Posted May 17, 2012 goto this line: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; add below: announce "["+strcharinfo(0)+"] has purchase a ["+ getitemname(@bought_nameid) +"] from the Donation NPC!", 0; should look like this: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; announce "["+strcharinfo(0)+"] has purchase a ["+ getitemname(@bought_nameid) +"] from the Donation NPC!", 0; } Quote Link to comment Share on other sites More sharing options...
Emistry Posted May 17, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Yesterday at 05:27 AM Share Posted May 17, 2012 (edited) change for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; } into this for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; announce "[ "+strcharinfo(0)+" ] has brought "+@bought_quantity[@i]+" x "+getitemname( @bought_nameid[@i] ),0; } Aw....slower than Docubo ~ Edited May 17, 2012 by Emistry Quote Link to comment Share on other sites More sharing options...
Bahmut Posted May 17, 2012 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 382 Reputation: 39 Joined: 01/17/12 Last Seen: February 13, 2020 Share Posted May 17, 2012 This should work. please test it first because I haven't tested it myself: //================ DONATION Trader=================== turbo_room,99,120,6<tab>script<tab>Donation Shop<tab>403,{ mes .name$; mes "You currently have "+countitem(.tcg_item)+" TCG."; mes "Would you like to look at the shop?"; next; if (select("Yes:No") == 2) close; close2; callshop "Donation_SHOP",1; npcshopattach "Donation_SHOP"; dispbottom "You currently have "+countitem(.Donation_item)+" TCG."; end; OnBuyItem: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+1) { if(.TCG_ITEMS[@j] == @bought_nameid[@i]) { set @itemcost,(.ITEMPRICE[@j]*@bought_quantity[@i]); set @totalcost,(@totalcost+@itemcost); break; } } } if(@totalcost > countitem(.tcg_item)) { dispbottom "You don't have enough TCG."; } else { for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; announce strcharinfo(0) + " has purchase a " + getitemname(@bought_nameid[@i]) + " from the donation NPC"; } delitem .tcg_item,@totalcost; dispbottom "Thank you for shopping."; } set @totalcost,0; deletearray @bought_nameid[0],128; deletearray @bought_quantity[0],128; end; OnInit: npcshopdelitem "Donation_SHOP",909; // Leave this alone set .name$,"[Donation Trader]"; set .tcg_item,7179; // Input TCG ID setarray .TCG_ITEMS[0],5467,2720,2721,2722,2723,2724,2725,5374,5518,2629,20001,1228,13017,2630,4441,2554,5325; setarray .ITEMPRICE[0],10,7,7,7,7,7,7,10,10,8,6,5,6,4,10,6,4; // Item prices - Should followe ID's order for(set .@item,0; .@item < getarraysize(.TCG_ITEMS); set .@item,.@item+1) { npcshopadditem "Donation_SHOP",.TCG_ITEMS[.@item],.ITEMPRICE[.@item]; } end; } - shop Donation_SHOP -1,909:5 EDIT: xD too late Quote Link to comment Share on other sites More sharing options...
Byakuran Posted May 17, 2012 Group: Members Topic Count: 110 Topics Per Day: 0.02 Content Count: 229 Reputation: 5 Joined: 12/16/11 Last Seen: May 6, 2020 Author Share Posted May 17, 2012 tnks need to try it Quote Link to comment Share on other sites More sharing options...
Question
Byakuran
can someone make this npc announce when someone buy ... but i want it to announce this
"Player name" has purchase a "item name" from donation npc
heres my npc
Link to comment
Share on other sites
4 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.