Jump to content

Utility: Usable Enchant Item


Emistry

Recommended Posts


  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

just a quick question if i want the stone to be placed on 3slot

/* item_db.txt  // replace with your own custom id.

501,Red_Potion,Red Potion,11,50,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc( "F_DiabloEnchant",501,909 ); },{},{}
// Example Bonus
909,Jellopy,Jellopy,3,6,,10,,,,,,,,,,,,,{ .@eqp = getequippedon(); if (.@eqp & 16) { bonus bVit,100; } if (.@eqp & 256) { bonus bInt,100; } if (.@eqp & 64) { bonus bAgi,100; } },{},{}

*/


// usage:
// callfunc( "F_DiabloEnchant",<delete item id>,<bonus item id> );

function	script	F_DiabloEnchant	{
	.@itemid = getarg( 0,0 );
	.@enchant = getarg( 1,0 );
	if ( .@itemid && .@enchant ) {
		for ( .@i = EQI_HEAD_TOP; .@i < EQI_ACC_R; .@i++ ) {
			.@equip_itemid = getequipid( .@i );
			.@menu$ = .@menu$ + ( .@equip_itemid == -1 ? "": getitemname( .@equip_itemid ) ) + ":";
		}
		.@i = select( .@menu$ );
		.@equip_itemid = getequipid( .@i );
		.@equip_refine = getequiprefinerycnt( .@i );
		for ( .@c = 0; .@c < 4; .@c++ ) 
			.@card[.@c] = getequipcardid( .@i,.@c );
		
		if ( .@card[0] && .@card[0] < 4001 ) {
			mes "Signed Item can't be enchanted.";
		}
		// else if ( .@card[3] ) {
			// mes "This item has been enchanted. Cant enchant twice.";
		// }
		else {
			delequip .@i;
			delitem .@itemid,1;
			.@card[3] = .@enchant;
			getitem2 .@equip_itemid,1,1,.@equip_refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			// equip2 .@equip_itemid,.@equip_refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			specialeffect2 154;
			message strcharinfo(0),"Enchant Success!";
		}
		close;
	}
	return;
}




is this the part i need to edit?

.@card[3] = .@enchant;

this one is like once you put stone it cannot be enchant again correct?

		// else if ( .@card[3] ) {
			// mes "This item has been enchanted. Cant enchant twice.";
		// }

this part may i know whats the use?

			// equip2 .@equip_itemid,.@equip_refine,0,.@card[0],.@card[1],.@card[2],.@card[3];

thanks in advance

 

PS: Got error on custom script

Edited by AinsLord
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

On 7/6/2021 at 3:46 PM, AinsLord said:

i want the stone to be placed on 3slot

.@card[2] = .@enchant;

index 2 is 3rd card slot.

Link to comment
Share on other sites

  • 1 year later...

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  08/29/14
  • Last Seen:  

how to enchant shadow equipment ?

 

i change > for (.@i = EQI_ACC_L; .@i < EQI_MAX; .@i++) not working , item is random enchant.

Edited by system9
Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.03
  • Content Count:  44
  • Reputation:   2
  • Joined:  02/23/23
  • Last Seen:  

Bump!

 

Hello @Emistry. May I know how to make your creation possible for only Headgear costumes (upper, mid and low) only? Thank you! 
Been finding any enchantment script but yours is the only one closer to my target and goal. Hope you could help me. Bless you!

Link to comment
Share on other sites

  • 8 months later...

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   1
  • Joined:  10/25/12
  • Last Seen:  

It's possible rent a enchat on item? Like this:

 

function	script	F_UsableEnchantItem	{
	.@itemid = 30378;
	.@enchant = 30379;
	.@card_slot = getarg(2, 3); 
	.@rental_duration = 3600; 


	if (.@itemid && .@enchant) {
		
		setarray .@equip_positions[0], EQI_ACC_L, EQI_ACC_R, EQI_SHOES, EQI_GARMENT, EQI_HEAD_LOW, EQI_HEAD_MID, EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R;
		.@menu_index = 0;

		
		for (.@i = 0; .@i < getarraysize(.@equip_positions); .@i++) {
			.@pos = .@equip_positions[.@i];
			.@equip_itemid = getequipid(.@pos);
			if (.@equip_itemid != -1) {
				.@menu$ = .@menu$ + getitemname(.@equip_itemid) + " [" + getitemslots(.@equip_itemid) + "]" + ":";
				.@menu_map[.@menu_index] = .@pos;
				.@menu_index++;
			}
		}

		if (.@menu$ == "") {
			mes "You don't have any items equipped that can be enchanted.";
			close;
		}

		mes "Which item would you like to enchant?";
		.@selected = select(.@menu$);
		if (.@selected == 0) {
			mes "Alright, thanks anyways!";
			close;
		}

		
		.@eqi = .@menu_map[.@selected - 1];
		.@equip_itemid = getequipid(.@eqi);
		if (.@equip_itemid == -1) {
			mes "No item equipped in the selected slot.";
			close;
		}

		.@equip_refine = getequiprefinerycnt(.@eqi);
		for (.@c = 0; .@c < 4; .@c++)
			.@card[.@c] = getequipcardid(.@eqi, .@c);

		if (.@card[0] && .@card[0] == 255) {
			message strcharinfo(0), "Fail. " + getitemname(.@equip_itemid) + " is a signed item.";
		} else if (.@card[.@card_slot]) {
			message strcharinfo(0), "Fail. " + getitemname(.@equip_itemid) + " already has an enchant.";
			} else {
			next;
			mes "Enchanting item..";
			next;
			progressbar "ffff00",2;
			delitem .@itemid, 1; 
			delequip .@eqi; 

			
			.@equip_refine = getequiprefinerycnt(.@eqi);
			for (.@c = 0; .@c < 4; .@c++)
				.@card[.@c] = getequipcardid(.@eqi, .@c);
			.@card[.@card_slot] = .@enchant; // Aplica a runa ao slot desejado

			
			rentitem2 .@equip_itemid, .@rental_duration, 1, .@equip_refine, 0, .@card[0], .@card[1], .@card[2], .@card[3];

			specialeffect2 EF_REFINEOK;
			message strcharinfo(0), getitemname(.@equip_itemid) + " foi encantado com " + getitemname(.@enchant) + " por um período limitado!";
			next;
			mes "Success!";
		}
		end;
	}
	return;
}

I tried to do it like this but it rents the item and not the rune.

Edited by Westin
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

On 1/10/2023 at 7:42 AM, system9 said:

EQI_MAX

ensure your server have exported this constant to be allowed to use by script engine

On 5/22/2023 at 8:42 PM, playniks said:

how to make your creation possible for only Headgear costumes (upper, mid and low) only?

may try configure the card/enchant equip location 

On 2/10/2024 at 1:09 AM, Westin said:

It's possible rent a enchat on item?

rental item are only meant for item itself, not compounding items like enchant/card

Link to comment
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...