Enchant System Request

nasagnilac

New member
Messages
121
Points
0
Github
gmblank
Anyone can help me this one work on the latest svn.

/*========================================== * сrmor Enchanting *------------------------------------------*/BUILDIN_FUNC(successenchant){ int i = -1, j, num, enchant, ep; char chat_announce[256]; 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(equip) ) i = pc_checkequip(sd, equip[num - 1]); if( i < 0 ) return 0; if( !sd->inventory_data || sd->inventory_data->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory.equip; log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory.card[j] = 0; sd->status.inventory.refine = 0; // -------------------------------------------------------------------- pc_unequipitem(sd,i,2); clif_delitem(sd,i,1,3); sd->status.inventory.card[MAX_SLOTS - 1] = enchant; log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory); clif_additem(sd,i,1,0); pc_equipitem(sd,i,ep); clif_misceffect(&sd->bl,3); if( battle_config.channel_announces&8 && server_channel[CHN_VENDING] ) { sprintf(chat_announce, msg_txt(NULL,892), server_channel[CHN_VENDING]->name, sd->status.name, sd->inventory_data->jname, sd->inventory_data->slot, itemdb_search(enchant)->jname); clif_channel_message(server_channel[CHN_VENDING], chat_announce, 26); } return 0;}BUILDIN_FUNC(failedenchant){ int i = -1, num; TBL_PC *sd; num = script_getnum(st,2); sd = script_rid2sd(st); if( sd == NULL ) return 0; if( num > 0 && num <= ARRAYLENGTH(equip) ) i = pc_checkequip(sd, equip[num - 1]); if( i >= 0 ) { pc_unequipitem(sd,i,3); pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT); clif_misceffect(&sd->bl,2); } return 0;} // Enchanting BUILDIN_DEF(successenchant,"ii"), BUILDIN_DEF(failedenchant,"i"),

This is the error I got while compiling.

2>d:ragnarok backupbatanggapo ro projectsrcmapscript.c(7945): warning C4013: 'itemdb_isenchant' undefined; assuming extern returning int2>d:ragnarok backupbatanggapo ro projectsrcmapscript.c(7955): error C2198: 'function through pointer' : too few arguments for call2>d:ragnarok backupbatanggapo ro projectsrcmapscript.c(7966): error C2198: 'function through pointer' : too few arguments for call

7945 if( sd == NULL || !itemdb_isenchant(enchant) )

7955   logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory);

7966   logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory);

 
Last edited by a moderator:
Solved. HAHAHA good for me to learn.

screenHercules000.jpg

Add this before BUILDIN(successrefitem) in script.c

/*========================================== * сrmor Enchanting *------------------------------------------*/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 || sd->inventory_data->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory.equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory,sd->inventory_data); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory.card[j] = 0; sd->status.inventory.refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory.card[MAX_SLOTS - 1] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory,sd->inventory_data); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;}BUILDIN(failedenchant){ int i = -1, num; TBL_PC *sd; num = script_getnum(st,2); sd = script_rid2sd(st); if( sd == NULL ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i >= 0 ) { pc->unequipitem(sd,i,3); pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT); clif->misceffect(&sd->bl,2); } return 0;}
And after   BUILDIN_DEF(countbound, "?"),

// Enchanting    BUILDIN_DEF(successenchant,"ii"),    BUILDIN_DEF(failedenchant,"i"),




Add this after #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET) in itemdb.h

#define itemdb_isenchant(i) (i >= 4700 && i <= 4999)


I hope someone can also approve this and add in the latest svn..

 
Last edited by a moderator:
Solved. HAHAHA good for me to learn.

attachicon.gif
screenHercules000.jpg

Add this before BUILDIN(successrefitem) in script.c

/*========================================== * сrmor Enchanting *------------------------------------------*/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 || sd->inventory_data->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory.equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory,sd->inventory_data); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory.card[j] = 0; sd->status.inventory.refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory.card[MAX_SLOTS - 1] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory,sd->inventory_data); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;}BUILDIN(failedenchant){ int i = -1, num; TBL_PC *sd; num = script_getnum(st,2); sd = script_rid2sd(st); if( sd == NULL ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i >= 0 ) { pc->unequipitem(sd,i,3); pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT); clif->misceffect(&sd->bl,2); } return 0;}
And after   BUILDIN_DEF(countbound, "?"),

// Enchanting    BUILDIN_DEF(successenchant,"ii"),    BUILDIN_DEF(failedenchant,"i"),




Add this after #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET) in itemdb.h

#define itemdb_isenchant(i) (i >= 4700 && i <= 4999)


I hope someone can also approve this and add in the latest svn..

Yes already fix mine... longtime ago.. haha..

try removing or changing the orbs or try using orb normal just click orb it will put on 4th slot...

 
Solved. HAHAHA good for me to learn.

attachicon.gif
screenHercules000.jpg

Add this before BUILDIN(successrefitem) in script.c

/*========================================== * сrmor Enchanting *------------------------------------------*/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 || sd->inventory_data->slot >= MAX_SLOTS ) return 0; // Cannot enchant an item with 4 slots. Enchant uses last slot. ep = sd->status.inventory.equip; logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory,sd->inventory_data); // By Official Info: Item will lose cards, refine and previus enchants. for( j = 0; j < MAX_SLOTS; j++ ) sd->status.inventory.card[j] = 0; sd->status.inventory.refine = 0; // -------------------------------------------------------------------- pc->unequipitem(sd,i,2); clif->delitem(sd,i,1,3); sd->status.inventory.card[MAX_SLOTS - 1] = enchant; logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory,sd->inventory_data); clif->additem(sd,i,1,0); pc->equipitem(sd,i,ep); clif->misceffect(&sd->bl,3); return 0;}BUILDIN(failedenchant){ int i = -1, num; TBL_PC *sd; num = script_getnum(st,2); sd = script_rid2sd(st); if( sd == NULL ) return 0; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd, script->equip[num - 1]); if( i >= 0 ) { pc->unequipitem(sd,i,3); pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT); clif->misceffect(&sd->bl,2); } return 0;}
And after   BUILDIN_DEF(countbound, "?"),

// Enchanting    BUILDIN_DEF(successenchant,"ii"),    BUILDIN_DEF(failedenchant,"i"),




Add this after #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET) in itemdb.h

#define itemdb_isenchant(i) (i >= 4700 && i <= 4999)


I hope someone can also approve this and add in the latest svn..

Yes already fix mine... longtime ago.. haha..

try removing or changing the orbs or try using orb normal just click orb it will put on 4th slot...

I dont know why its not working.. clicking the orb is the same as cards.

but successenchant and failedenchant is working.

 
If the item has already an orb on it. You can change it again.

But if you use a custom orb with diff ItemID you must add it below.

#define itemdb_isenchant(i) (i >= 4700 && i <= 4999)
For now my problem is when I click the orb and insert it to the item. It will appear on its slot. How did you fix it?

 
Back
Top