Nanashi Posted May 9, 2014 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 59 Reputation: 19 Joined: 01/03/13 Last Seen: August 27, 2024 Share Posted May 9, 2014 (edited) Hola a todos, me gustaría saber si es posible modificar el comando 'getitem2' para hacer que, en vez de enviar el objeto creado directamente al inventario, lo envíe al suelo como si se tratase de un drop item. Si es posible podríais echarme una mano o indicarme qué debo modificar (?), gracias de antemano. Edit: ya he encontrado el lugar donde modificar el script command getitem2 en .../src/map/script.c buscando BUILDIN_FUNC(getitem2) el problema es que no se que debo modificar para hacer que el objeto caiga al suelo (cerca del jugador) en lugar de ir directo al inventario. El código es el siguiente: /*========================================== * *------------------------------------------*/ BUILDIN_FUNC(getitem2) { int nameid,amount,get_count,i,flag = 0; int iden,ref,attr,c1,c2,c3,c4; char bound=0; struct item_data *item_data; struct item item_tmp; TBL_PC *sd; struct script_data *data; if( !strcmp(script_getfuncname(st),"getitembound2") ) { bound = script_getnum(st,11); if( bound < 1 || bound > 3) { //Not a correct bound type ShowError("script_getitembound2: Not a correct bound type! Type=%d\n",bound); return 1; } if( script_hasdata(st,12) ) sd=map_id2sd(script_getnum(st,12)); else sd=script_rid2sd(st); // Attached player } else if( script_hasdata(st,11) ) sd=map_id2sd(script_getnum(st,11)); // <Account ID> else sd=script_rid2sd(st); // Attached player if( sd == NULL ) // no target return 0; data=script_getdata(st,2); get_val(st,data); if( data_isstring(data) ) { const char *name=conv_str(st,data); struct item_data *item_data = itemdb_searchname(name); if( item_data ) nameid=item_data->nameid; else nameid=UNKNOWN_ITEM_ID; } else nameid=conv_num(st,data); amount=script_getnum(st,3); iden=script_getnum(st,4); ref=script_getnum(st,5); attr=script_getnum(st,6); c1=(short)script_getnum(st,7); c2=(short)script_getnum(st,8); c3=(short)script_getnum(st,9); c4=(short)script_getnum(st,10); if(nameid<0) { // Invalide nameid nameid = -nameid; flag = 1; } if(nameid > 0) { memset(&item_tmp,0,sizeof(item_tmp)); item_data=itemdb_exists(nameid); if (item_data == NULL) return -1; if(item_data->type==IT_WEAPON || item_data->type==IT_ARMOR || item_data->type==IT_SHADOWGEAR ) { if(ref > MAX_REFINE) ref = MAX_REFINE; } else if(item_data->type==IT_PETEGG) { iden = 1; ref = 0; } else { iden = 1; ref = attr = 0; } item_tmp.nameid=nameid; if(!flag) item_tmp.identify=iden; else if(item_data->type==IT_WEAPON || item_data->type==IT_ARMOR || item_data->type==IT_SHADOWGEAR ) item_tmp.identify=0; item_tmp.refine=ref; item_tmp.attribute=attr; item_tmp.card[0]=(short)c1; item_tmp.card[1]=(short)c2; item_tmp.card[2]=(short)c3; item_tmp.card[3]=(short)c4; item_tmp.bound=bound; //Check if it's stackable. if (!itemdb_isstackable(nameid)) get_count = 1; else get_count = amount; for (i = 0; i < amount; i += get_count) { // if not pet egg if (!pet_create_egg(sd, nameid)) { if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) { clif_additem(sd, 0, 0, flag); if( pc_candrop(sd,&item_tmp) ) map_addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } } return SCRIPT_CMD_SUCCESS; } Edited May 9, 2014 by Nanashi Quote Link to comment Share on other sites More sharing options...
Ziu Posted May 9, 2014 Group: Members Topic Count: 178 Topics Per Day: 0.04 Content Count: 909 Reputation: 247 Joined: 11/08/11 Last Seen: Wednesday at 10:10 AM Share Posted May 9, 2014 No sé exactamente para que lo quieres usar pero no has pensado en usar los comandos-> makeitem/makeitem2 Quote Link to comment Share on other sites More sharing options...
Nanashi Posted May 9, 2014 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 59 Reputation: 19 Joined: 01/03/13 Last Seen: August 27, 2024 Author Share Posted May 9, 2014 (edited) Verás te explico, yo quiero que el objeto caiga del mob al matar dicho monstruo (algo así como el comando addmonsterdrop). Pero el problema de makeitem2 es determinar la ubicación del mob para que caiga de él y no del jugador. Y el problema que da addmonsterdrop es que no me permite configurar las cartas que lleva el objeto, su refine, si esta identificado o no, etc... Tal vez sea más fácil configurar el command script addmonsterdrop agregando las propiedades del getitem2, pero como no se mucho de programación C/C++ pues estoy bastante perdido con lo q tengo q editar . Edited May 9, 2014 by Nanashi Quote Link to comment Share on other sites More sharing options...
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.