-
Posts
9 -
Joined
-
Last visited
giullyan2's Achievements
Poring (1/15)
1
Reputation
-
This function is used to buy an item from npc and it goes straight to storage Help pls
-
Thx , but sorry , i'm new here , i just trying xD
-
no one?
-
I have a function on my npc bg Stuffs who's get a item purchased and send direct to kafra: The problem is: this script work on my rathena 2013 , but my actualy emulator his don't work becouse the function "checkspace" and "storage" doesn't exist. I suppose there is a function similar to "checkspace" or "storage" to replaced by those. Does anyone know what this function whould be? Error: NPC: consumiveis_bg.txt NPC Functions: npc_comando.txt Checkspace on bgStuffShop on npc_comando.txt: //=================== Consul shop BG ==================== function script bgStuffShop { if(!$@BG_SHOPS_READY) end; .@type = select( "Consumíveis", "Ferramentas" ); switch(.@type){ case 1: .@var$ = "$@BG_CONSUMABLES_NORMAL"; break; case 2: .@var$ = "$@BG_TOOLS_NORMAL"; break; } mes( "^777777======= Ferramentas BG =======", "^FFA500Qtd × ^ff0000Item ^0000ff- ^777777Preço", "^777777=========================" ); for(.@i=0; .@i<getarraysize(getd(.@var$)); .@i+=3){ switch(getd(.@var$+"["+.@i+"]")){ default: .@mName$ = getitemname(getd(.@var$+"["+.@i+"]")); .@mQuant = getd(.@var$+"["+(.@i+1)+"]"); .@mPrice = getd(.@var$+"["+(.@i+2)+"]"); .@menu$[getarraysize(.@menu$)] = "^FFA500"+.@mQuant+" × ^ff0000"+.@mName$+"^0000ff - ^777777"+.@mPrice; break; } } next(); .@idx = ((select(implode(.@menu$,":"))-1) * 3); .@item = getd(.@var$+"["+.@idx+"]"); .@quant = getd(.@var$+"["+(.@idx+1)+"]"); .@price = getd(.@var$+"["+(.@idx+2)+"]"); mes( "^777777======= Ferramentas BG =======", "^FFA500Qtd × ^ff0000Item ^0000ff- ^777777Preço", "^777777=========================" ); mes("^0000ffPacks de ^777777"+.@quant+" × ^FFA500"+getitemname(.@item)); input(.@packs, 0, 30000); if(.@packs == 0){ mes("^ff0000Cancelado!"); close; } mes("^0000ffReceber no inventário ou armazém?"); switch(select("Inventário", "Armazém")){ case 1: .@destiny$ = "inventory"; break; case 2: .@destiny$ = "storage"; break; } if((.@destiny$ == "inventory" && checkweight(.@item, .@packs * .@quant)) || (.@destiny$ == "storage" && checkspace(.@item,.@packs * .@quant,1,0,0,0,0,0,0))){ .@totalPrice = .@price * .@packs; mes("^0000ffModo de Pagamento"); switch(select("Pagar com Emblemas de Bravura", "Pagar com Emblemas de Valor")){ case 1: .@coin = 7828; break; case 2: .@coin = 7829; break; } if(countitem(.@coin) >= .@totalPrice){ delitem(.@coin, .@totalPrice); if(.@destiny$ == "inventory") getitem(.@item,.@packs * .@quant); else if(.@destiny$ == "storage") storeitem(.@item,.@packs * .@quant); mes("^007700Finalizado!"); } else { mes("^ff0000Você não possui ^FFA500"+getitemname(.@coin)+" ^ff0000suficiente."); } } else { if(.@destiny$ == "inventory") mes("^A58500Você não aguenta tanto peso"); else if(.@destiny$ == "storage") mes("^A58500Seu armazém não tem espaço"); } close; } Checkspace on script.c: BUILDIN_FUNC(checkspace) { int nameid = 0, amount; struct map_session_data *sd; if( (sd = script_rid2sd(st)) == NULL ) script_pushint(st,0); else if( sd->status.storage.storage_amount > MAX_STORAGE ) script_pushint(st,0); // Storage at max else { struct script_data *data = script_getdata(st,2); struct item_data *id; struct item it; int i; get_val(st,data); if( data_isstring(data) ) { const char *name = conv_str(st,data); struct item_data *id = itemdb_searchname(name); if( id ) nameid = id->nameid; } else nameid = conv_num(st,data); memset(&it,0,sizeof(it)); amount = script_getnum(st,3); it.nameid = nameid; it.identify = script_getnum(st,4); it.refine = script_getnum(st,5); it.attribute = script_getnum(st,6); it.card[0] = (short)script_getnum(st,7); it.card[1] = (short)script_getnum(st,8); it.card[2] = (short)script_getnum(st,9); it.card[3] = (short)script_getnum(st,10); if( nameid < 500 || amount <= 0 || (id = itemdb_exists(nameid)) == NULL || !itemdb_canstore(&it, pc_get_group_level(sd)) || !itemdb_isstackable2(id) ) { script_pushint(st,0); return 0; } if( itemdb_isstackable2(id) ) { ARR_FIND(0,MAX_STORAGE,i,compare_item(&sd->status.storage.items[i],&it)); if( i < MAX_STORAGE ) { // Item on Storage script_pushint(st,amount + sd->status.storage.items[i].amount > MAX_AMOUNT ? 0 : 1); return 0; } } ARR_FIND(0,MAX_STORAGE,i,sd->status.storage.items[i].nameid == 0); if( i >= MAX_STORAGE ) { script_pushint(st,0); return 0; } script_pushint(st,1); // Can be Stored } return 0; } I really am researching a lot of time and would be very grateful to anyone at least consumiveis_bg.txttry to help
-
Sorry for my bad English , i just want a script who make the item buying going directly to storage like npc telma from battleground. For example: I buy 25.000 white potions and 900 speed potions on npc shop. Where are these items going? For storage. I realy want this script but the function "checkstorage" and "storeitem" on script.c don't work on my emulator (rathena 2017)
-
Does anyone have an npc with storefront script that moves the purchased item straight to the store. I'm searching for a long time something of the type "npc_telma", I need for a bg npc for sale of consultable by emblem