Lord Ganja
New member
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!
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!
Last edited by a moderator: