Lord Ganja Posted April 17, 2015 Group: Members Topic Count: 141 Topics Per Day: 0.03 Content Count: 444 Reputation: 22 Joined: 06/18/12 Last Seen: August 11, 2018 Share Posted April 17, 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 0; } This is the whole part script.c BUILDIN_FUNC(getsealeditem) { int amount, get_count, i; unsigned short nameid; struct item it; TBL_PC *sd; struct script_data *data; unsigned char flag = 0; const char* command = script_getfuncname(st); struct item_data *id = NULL; data = script_getdata(st,2); get_val(st,data); if( data_isstring(data) ) {// "<item name>" const char *name = conv_str(st,data); id = itemdb_searchname(name); if( id == NULL ){ ShowError("buildin_getitem: Nonexistant item %s requested.\n", name); return SCRIPT_CMD_FAILURE; //No item created. } nameid = id->nameid; } else if( data_isint(data) ) {// <item id> nameid = conv_num(st,data); if( !(id = itemdb_exists(nameid)) ){ ShowError("buildin_getitem: Nonexistant item %d requested.\n", nameid); return SCRIPT_CMD_FAILURE; //No item created. } } else { ShowError("buildin_getitem: invalid data type for argument #1 (%d).", data->type); return SCRIPT_CMD_FAILURE; } if( !battle_config.reserved_sealed_id ) { ShowError("script_getsealeditem: Sealeditem is disable. Set a value for reserved_sealed_id on your battle.conf file."); return SCRIPT_CMD_FAILURE; } // <amount> if( (amount = script_getnum(st,3)) <= 0) return SCRIPT_CMD_SUCCESS; //return if amount <=0, skip the useles iteration memset(&it,0,sizeof(it)); it.identify = 1; it.bound = BOUND_NONE; 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 0; } else if( script_hasdata(st,4) ) sd = map_id2sd(script_getnum(st,4)); // <Account ID> else sd = script_rid2sd(st); // Attached player if( sd == NULL ) // no target return SCRIPT_CMD_SUCCESS; //Check if it's stackable. if (!itemdb_isstackable2(id)) 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 SCRIPT_CMD_SUCCESS; } For those who can help, thanks in advance! Edited April 17, 2015 by Lord Ganja Quote Link to comment Share on other sites More sharing options...
Question
Lord Ganja
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
For those who can help, thanks in advance!
Edited by Lord GanjaLink to comment
Share on other sites
0 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.