majisoka Posted June 6, 2013 Posted June 6, 2013 (edited) // Settings : // - Only required to edit the ShopSetting() Function // Notes : You may also add / remove Menu ( If any ) // - Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" ) // Ex. of Variable. -> Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable // - ERROR Message are used to show Invalid Settings in your NPC. // Leave this alone... - shop Emistry_Shop -1,512:100 prontera,155,181,5 script Sample 757,{ function ShopSettings; function ValidateCost; function CurrencyInfo; function ClearData; function ValueConvert; function ErrorNotice; mes "Each Shop from the Menu may purchase using ^FF0000Different Currency^000000."; mes "^00FF00____________________________^000000"; mes "So,Which shop you would like to look at it"; next; // Menu Selection select("Shop 1","Shop 2","Shop 3"); ClearData(); ShopSettings( @menu ); npcshopitem "Emistry_Shop",512,100; npcshopdelitem "Emistry_Shop",512; for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1) npcshopadditem "Emistry_Shop",@ItemLists[.@i],@ItemCost[.@i]; mes "Okay...wait awhile"; mes "^00FF00____________________________^000000"; CurrencyInfo( @Currency$ ); mes "^00FF00____________________________^000000"; callshop "Emistry_Shop",1; npcshopattach "Emistry_Shop"; end; function ShopSettings { switch( getarg(0) ){ Case 1: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],6153,7227; // Item Price setarray @ItemCost[0],100,1; break; Case 2: // Currency [ Item ID / Variable Name ] set @Currency$,"7227"; // Item ID Lists setarray @ItemLists[0],2306,2302,2303,2304,2305,2301; // Item Price setarray @ItemCost[0],2,2,3,4,5,6; break; Case 3: // Currency [ Item ID / Variable Name ] set @Currency$,"#CASHPOINTS"; // Item ID Lists setarray @ItemLists[0],2306,2302,2303,2304,2305,2301; // Item Price setarray @ItemCost[0],20,22,34,445,52,641; break; // Case 4,5,6.....etc... 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( getd( getarg(0) ) < getarg(1) ) return 1; } return 0; } 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( atoi( @Currency$ ) )+"^000000"; else{ mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000"; } }else{ if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) delitem atoi( @Currency$ ),@TotalCost; else{ 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; } im trying to make it a costume npc. instead of giving out an item. it will give out costume items. 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."; change the getitem to the costumeitem source code. but i dont know what it is. thanks for your help. Edited June 7, 2013 by Capuche Script: Quote -> Code Quote
Emistry Posted June 6, 2013 Posted June 6, 2013 (edited) you are using Amod ...the @costume only come from there ...in rAthena we dont have this...and we dont have custom src mod that convert normal headgear into custome headgear ... well you can still try like this atcommand "@costumeitem "+@bought_nameid[.@i]; Edited June 7, 2013 by Emistry Quote
Critica Posted June 6, 2013 Posted June 6, 2013 just put the costume item ID on it. you dont need to change anything. Case 1: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],COSTUMEID,COSTUMEID; // Item Price setarray @ItemCost[0],100,100; Quote
majisoka Posted June 6, 2013 Author Posted June 6, 2013 no. its giving me a normal item with effects. i can only get costume items by @costumeitem command Quote
Critica Posted June 6, 2013 Posted June 6, 2013 you sure? can you give exmaple of you costume item here Quote
majisoka Posted June 6, 2013 Author Posted June 6, 2013 yup. they're not costume items in default. so thats why im looking for the code. if @item is getitem. whats for @costumeitem Quote
Critica Posted June 6, 2013 Posted June 6, 2013 hmm i dont think its possible.. but maybe im not sure...why not make it an costume item instead? it'll much more easier Quote
Rebel Posted June 6, 2013 Posted June 6, 2013 http://rathena.org/board/topic/82370-costume-npc-and-costumeitem/ Quote
majisoka Posted June 6, 2013 Author Posted June 6, 2013 http://rathena.org/board/topic/82370-costume-npc-and-costumeitem/ thanks. i'll check that out Quote
Jaburak Posted June 6, 2013 Posted June 6, 2013 Post your script as code or upload it to pastebin. Quote
majisoka Posted June 6, 2013 Author Posted June 6, 2013 hmm i dont think its possible.. but maybe im not sure... why not make it an costume item instead? it'll much more easier coz i want to make it easier. its easier to have an NPC than me/a GM give the items manually. Post your script as code or upload it to pastebin. its in my forum topic already sir. Quote
majisoka Posted June 7, 2013 Author Posted June 7, 2013 (edited) you are using Amod ...the @costume only come from there ...in rAthena we dont have this...and we dont have custom src mod that convert normal headgear into custome headgear ... well you can still try like this atcommand "@costumeitem "+@brought_nameid[.@i]; wow. thank you sir. will try. -------------------------- EDIT: i actually used it.but its not giving me any item. but the deal was successful. you are using Amod ...the @costume only come from there ...in rAthena we dont have this...and we dont have custom src mod that convert normal headgear into custome headgear ... well you can still try like this atcommand "@costumeitem "+@brought_nameid[.@i]; SIIIIIIIIRRRRRRR!!!! thank you so much!!!!! atcommand "@costumeitem "+@brought_nameid[.@i]; >>>>>>>>> changed the BROUGHT to BOUGHT. haha. shoot! it works now. i love you. haha Edited June 6, 2013 by majisoka Quote
Question
majisoka
im trying to make it a costume npc. instead of giving out an item. it will give out costume items.
change the getitem to the costumeitem source code. but i dont know what it is.
thanks for your help.
Edited by CapucheScript: Quote -> Code
11 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.