Jump to content
  • 0
Sign in to follow this  
Lord Ganja

Enchantment System

Question

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;}

 

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
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

Share this post


Link to post
Share on other sites
  • 0

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;}

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.