Lord Ganja 5 Posted May 7, 2015 Can anyone help me modify this successenchant src. This source works like this: 'successenchant <equip location>,<enchant orb id>;' I need to work like this one: 'successenchant <equip location>,<card slot>,<enchant orb id>;' I'm bad at src mod so I can't do it on my own. Help please. Thanks in advance! BUILDIN(successenchant){ int i = -1, j, num, enchant, ep; TBL_PC *sd; num = script_getnum(st,2); // Equip Slot enchant = script_getnum(st,3); // Equip Enchant sd = script_rid2sd(st); if( sd == NULL || !itemdb_isenchant(enchant) ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i < 0 ) return 0; if( !sd->inventory_data[i] || sd->inventory_data[i]->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory[i].equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory[i].card[j] = 0; sd->status.inventory[i].refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory[i].card[MAX_SLOTS - 1] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;} Quote Share this post Link to post Share on other sites
0 Ragnar Lothbrok 21 Posted May 7, 2015 if i'm not mistaken there's already topic about this, just used search button.. Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 7, 2015 BUILDIN(successenchant){ int i = -1, j, num, cardslot, enchant, ep; TBL_PC *sd; num = script_getnum(st,2); // Equip Slot cardslot = script_getnum(st,3) % MAX_SLOTS; // card slot enchant = script_getnum(st,4); // Equip Enchant sd = script_rid2sd(st); if( sd == NULL || !itemdb_isenchant(enchant) ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i < 0 ) return 0; if( !sd->inventory_data[i] || sd->inventory_data[i]->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory[i].equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory[i].card[j] = 0; sd->status.inventory[i].refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory[i].card[cardslot] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;} card slot : 0~3 Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted May 7, 2015 if i'm not mistaken there's already topic about this, just used search button.. I couldn't find one which is the same as my request. BUILDIN(successenchant){ int i = -1, j, num, cardslot, enchant, ep; TBL_PC *sd; num = script_getnum(st,2); // Equip Slot cardslot = script_getnum(st,3) % MAX_SLOTS; // card slot enchant = script_getnum(st,4); // Equip Enchant sd = script_rid2sd(st); if( sd == NULL || !itemdb_isenchant(enchant) ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i < 0 ) return 0; if( !sd->inventory_data[i] || sd->inventory_data[i]->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory[i].equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory[i].card[j] = 0; sd->status.inventory[i].refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory[i].card[cardslot] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;} card slot : 0~3 Thanks for this. Anyway i'm having errors when I use it in script. Does it works like this: 'successenchant <equip location>,<card slot>,<enchant orb id>;' ?? I'm having this error: successenchant .@part, .@cardslot',' .@orb; This is the script: prontera,150,180,6 script enchanttest 97,{ mes "select equipment"; setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3"; set .@menu$,""; for( set .@i,1; .@i <= 10; set .@i,.@i+1 ) { if( getequipisequiped(.@i) ) set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]"; set .@menu$, .@menu$ + ":"; } set .@part,select(.@menu$); next; mes "select a slot"; switch(select("Slot 1:Slot 2:Slot 3:Slot 4")) { case 1: .@cardslot = 0; case 2: .@cardslot = 1; case 3: .@cardslot = 2; case 4: .@cardslot = 3; } next; mes "select orb"; switch(select("1:2:3:4:5:6:7")) { case 1: .@orb = 4700; case 2: .@orb = 4701; case 3: .@orb = 4702; case 4: .@orb = 4703; case 5: .@orb = 4704; case 6: .@orb = 4705; case 7: .@orb = 4706; } next; successenchant .@part, .@cardslot, .@orb; mes "done"; close;} Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 7, 2015 BUILDIN_DEF(successenchant,"ii"), change into BUILDIN_DEF(successenchant,"iii"), 1 Lord Ganja reacted to this Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted May 7, 2015 BUILDIN_DEF(successenchant,"ii"), change into BUILDIN_DEF(successenchant,"iii"), Thank you so much! @@Angelmelody Quote Share this post Link to post Share on other sites
0 Ragnar Lothbrok 21 Posted May 7, 2015 is it possible to make this plugins? or plugin only for @ commands? Quote Share this post Link to post Share on other sites
0 Mhalicot 392 Posted May 8, 2015 is it possible to make this plugins? or plugin only for @ commands? yes its possible.. Quote Share this post Link to post Share on other sites
0 Ragnar Lothbrok 21 Posted May 8, 2015 nice... can anyone make this plugins? thank you... Quote Share this post Link to post Share on other sites
Can anyone help me modify this successenchant src.
This source works like this: 'successenchant <equip location>,<enchant orb id>;'
I need to work like this one: 'successenchant <equip location>,<card slot>,<enchant orb id>;'
I'm bad at src mod so I can't do it on my own. Help please. Thanks in advance!
Share this post
Link to post
Share on other sites