Jump to content
  • 0
Sign in to follow this  
nasagnilac

Enchant System Request

Question

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[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;	log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[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;	log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i]);	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[i]->jname, sd->inventory_data[i]->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);

Edited by gmblank

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Solved. HAHAHA good for me to learn.

post-6482-0-08978000-1408209119_thumb.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[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;}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..


 

Edited by gmblank

Share this post


Link to post
Share on other sites
  • 0

why not  use  getitem2 + specialeffect2 ?

 

Because I use a custom enchanter using this

successenchant .@Part,.Enchant;

 

 

 

Edited by gmblank

Share this post


Link to post
Share on other sites
  • 0

Solved. HAHAHA good for me to learn.

attachicon.gifscreenHercules000.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[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;}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...

Share this post


Link to post
Share on other sites
  • 0

 

Solved. HAHAHA good for me to learn.

attachicon.gifscreenHercules000.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[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;}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.

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.