Lord Ganja 5 Posted April 16, 2015 (edited) I currently created a new script command but it's not working well I'm not good on src modifcation This script is basically just a copy paste from getitem script and get some ideas from costume system but this one works differently. I need it to only work on equipments (armor,garment,shoes,accessory,weapon,shields and headgears) My problem here is whenever the script runs on this part below, it doesn't went through. It always returns the error even if the script im using is getsealeditem 2383,1; // 2383 is an armor if( !(it.equip&EQP_HEAD_TOP) || !(it.equip&EQP_ARMOR) || !(it.equip&EQP_HAND_L) || !(it.equip&EQP_HAND_R) || !(it.equip&EQP_GARMENT) || !(it.equip&EQP_SHOES) || !(it.equip&EQP_ACC_L) || !(it.equip&EQP_ACC_R) || !(it.equip&EQP_HEAD_MID) || !(it.equip&EQP_HEAD_LOW) ) { ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments."); return false; } This is the whole part script.c BUILDIN(getsealeditem) { int nameid,amount,get_count,i,flag = 0, offset = 0; struct item it; TBL_PC *sd; struct item_data *item_data; if( script_isstringtype(st, 2) ) { // "<item name>" const char *name = script_getstr(st, 2); if( (item_data = itemdb->search_name(name)) == NULL ) { ShowError("buildin_%s: Nonexistant item %s requested.n", script->getfuncname(st), name); return false; //No item created. } nameid=item_data->nameid; } else { // <item id> nameid = script_getnum(st, 2); //Violet Box, Blue Box, etc - random item pick if( nameid < 0 ) { nameid = -nameid; flag = 1; } if( nameid <= 0 || !(item_data = itemdb->exists(nameid)) ) { ShowError("buildin_%s: Nonexistant item %d requested.n", script->getfuncname(st), nameid); return false; //No item created. } } // <amount> if( (amount=script_getnum(st,3)) <= 0) return true; //return if amount <=0, skip the useles iteration memset(&it,0,sizeof(it)); it.nameid=nameid; if(!flag) it.identify=1; else it.identify=itemdb->isidentified2(item_data); if( !(it.equip&EQP_HEAD_TOP) || !(it.equip&EQP_ARMOR) || !(it.equip&EQP_HAND_L) || !(it.equip&EQP_HAND_R) || !(it.equip&EQP_GARMENT) || !(it.equip&EQP_SHOES) || !(it.equip&EQP_ACC_L) || !(it.equip&EQP_ACC_R) || !(it.equip&EQP_HEAD_MID) || !(it.equip&EQP_HEAD_LOW) ) { ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments."); return false; } if( script_hasdata(st,4+offset) ) sd=map->id2sd(script_getnum(st,4+offset)); // <Account ID> else sd=script->rid2sd(st); // Attached player if( sd == NULL ) // no target return true; //Check if it's stackable. if (!itemdb->isstackable(nameid)) get_count = 1; else get_count = amount; it.nameid = nameid; it.refine = 0; it.attribute = 0; it.card[0] = CARD0_CREATE; it.card[1] = 0; it.card[2] = GetWord(battle_config.reserved_sealed_id, 0); it.card[3] = GetWord(battle_config.reserved_sealed_id, 1); for (i = 0; i < amount; i += get_count) { // if not pet egg if (!pet->create_egg(sd, nameid)) { if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } return true;} Thanks in advance! Edited April 16, 2015 by Lord Ganja Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted April 16, 2015 use && Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted April 16, 2015 use && I already tried that one, but won't work I think I still have to add or edit something from the whole script. But I don't know what and how. Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted April 18, 2015 if( !(it.equip&EQP_HEAD_TOP || it.equip&EQP_ARMOR || it.equip&EQP_HAND_L || it.equip&EQP_HAND_R || it.equip&EQP_GARMENT || it.equip&EQP_SHOES || it.equip&EQP_ACC_L || it.equip&EQP_ACC_R || it.equip&EQP_HEAD_MID || it.equip&EQP_HEAD_LOW) ) Use this condition Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted April 18, 2015 if( !(it.equip&EQP_HEAD_TOP || it.equip&EQP_ARMOR || it.equip&EQP_HAND_L || it.equip&EQP_HAND_R || it.equip&EQP_GARMENT || it.equip&EQP_SHOES || it.equip&EQP_ACC_L || it.equip&EQP_ACC_R || it.equip&EQP_HEAD_MID || it.equip&EQP_HEAD_LOW) ) Use this condition Even if I use this I got the same error. When I try to click the npc this one appears: [Debug]: Source (NPC): sealeditem at prontera (156,177) And when I stopped the server this one appears [Error]: script_getsealeditem: Cannot create this sealeditem, it only works for equipments. Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted April 18, 2015 Maybe show script, something wrong on its side?? Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted April 19, 2015 Maybe show script, something wrong on its side?? on script.c BUILDIN(getsealeditem) { int nameid,amount,get_count,i,flag = 0, offset = 0; struct item it; TBL_PC *sd; struct item_data *item_data; if( script_isstringtype(st, 2) ) { // "<item name>" const char *name = script_getstr(st, 2); if( (item_data = itemdb->search_name(name)) == NULL ) { ShowError("buildin_%s: Nonexistant item %s requested.n", script->getfuncname(st), name); return false; //No item created. } nameid=item_data->nameid; } else { // <item id> nameid = script_getnum(st, 2); //Violet Box, Blue Box, etc - random item pick if( nameid < 0 ) { nameid = -nameid; flag = 1; } if( nameid <= 0 || !(item_data = itemdb->exists(nameid)) ) { ShowError("buildin_%s: Nonexistant item %d requested.n", script->getfuncname(st), nameid); return false; //No item created. } } // <amount> if( (amount=script_getnum(st,3)) <= 0) return true; //return if amount <=0, skip the useles iteration memset(&it,0,sizeof(it)); it.nameid=nameid; if(!flag) it.identify=1; else it.identify=itemdb->isidentified2(item_data); if( !(it.equip&EQP_HEAD_TOP) || !(it.equip&EQP_ARMOR) || !(it.equip&EQP_HAND_L) || !(it.equip&EQP_HAND_R) || !(it.equip&EQP_GARMENT) || !(it.equip&EQP_SHOES) || !(it.equip&EQP_ACC_L) || !(it.equip&EQP_ACC_R) || !(it.equip&EQP_HEAD_MID) || !(it.equip&EQP_HEAD_LOW) ) { ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments."); return false; } if( script_hasdata(st,4+offset) ) sd=map->id2sd(script_getnum(st,4+offset)); // <Account ID> else sd=script->rid2sd(st); // Attached player if( sd == NULL ) // no target return true; //Check if it's stackable. if (!itemdb->isstackable(nameid)) get_count = 1; else get_count = amount; it.nameid = nameid; it.refine = 0; it.attribute = 0; it.card[0] = CARD0_CREATE; it.card[1] = 0; it.card[2] = GetWord(battle_config.reserved_sealed_id, 0); it.card[3] = GetWord(battle_config.reserved_sealed_id, 1); for (i = 0; i < amount; i += get_count) { // if not pet egg if (!pet->create_egg(sd, nameid)) { if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } return true;}-------------------------------------------------------------BUILDIN_DEF(getsealeditem,"vi?"), sample script: prontera,150,150,4 script testing 521,{getsealeditem 2383,1;end;} after clicking the debug occured. Quote Share this post Link to post Share on other sites
I currently created a new script command but it's not working well
I'm not good on src modifcation
This script is basically just a copy paste from getitem script and get some ideas from costume system
but this one works differently. I need it to only work on equipments (armor,garment,shoes,accessory,weapon,shields and headgears)
My problem here is whenever the script runs on this part below, it doesn't went through. It always returns the error even if the script im using is
getsealeditem 2383,1; // 2383 is an armor
This is the whole part
script.c
Thanks in advance!
Edited by Lord GanjaShare this post
Link to post
Share on other sites