Jump to content
  • 0

How to modify this enchantment script only for upper costume headgear?


Question

Posted
prontera,156,178,5	script	ldfhsdfkljs	100,{
	mes "do you want to enchant your equipment ?";
	next;
	.@s = select( .menu$ ) -1;
	if ( !getequipisequiped( .const_equip[.@s] ) || .const_equip[.@s] == EQI_HAND_L && getiteminfo( getequipid( EQI_HAND_L ),2 ) != 5 ) {
		mes "you did not equip an "+ .menu_name$[.@s] +" at the moment";
		close;
	}
	.@id = getequipid( .const_equip[.@s] );
	.@ref = getequiprefinerycnt( .const_equip[.@s] );
	.@card1 = getequipcardid( .const_equip[.@s], 0 );
	.@card2 = getequipcardid( .const_equip[.@s], 1 );
	.@card3 = getequipcardid( .const_equip[.@s], 2 );
	.@card4 = getequipcardid( .const_equip[.@s], 3 );
	if ( .@card1 == 255 || .@card1 == 254 ) {
		mes "I can't enchant a signed equipment";
		close;
	}
	if ( .@card4 ) {
		mes "this armor has already enchanted";
		close;
	}
	
	.@rand = rand(.totalchance);
	while ( ( .@rand = .@rand - .rate[.@r] ) >= 0 ) .@r++;
	.@o = rand(0,5); // orb of str/int/dex ....

	delitem2 .@id, 1,1, .@ref, 0, .@card1, .@card2, .@card3, 0;
	getitem2 .@id, 1,1, .@ref, 0, .@card1, .@card2, .@card3, 4700 + .@o * 10 + .@r;
	equip .@id;
	close;
OnInit:
	setarray .rate, 55,50,45,40,35; // rate of getting +1 is 55%, +2 is 50% .... +10 is 10% ...

	setarray .const_equip, EQI_ARMOR, EQI_HAND_L, EQI_GARMENT, EQI_SHOES;
	setarray .menu_name$, "Armor", "Shield", "Garment", "Shoes";
	.menu$ = implode( .menu_name$,":" );
	while ( .@i < 10 ) {
		.totalchance = .totalchance + .rate[.@i];
		.@i++;
	}
	end;
}

as the title says, i want to make this script only for enchanting upper costume headgear
also i want to make it only maximum to +3 Attribute

thanks

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

I didn't test it, but this should do what you want.
 

prontera,156,178,5	script	Enchanter	100,{
	disable_items;

	mes "What do you want to enchant?";
	next;
	.@s = select( .menu$ ) -1;
	.@part = .const_equip[.@s];
	.@part_name = .menu_name$[.@s];

	if (!getequipisequiped(.@part)) {
		mes "You did not equip an " + .@part_name + " at the moment";
		close;
	}

	.@id = getequipid(.@part);
	.@ref = getequiprefinerycnt(.@part);
	setarray(.@card[0], getequipcardid(.@part, 0), getequipcardid(.@part, 1), getequipcardid(.@part, 2), getequipcardid(.@part, 3));

	if (.@card[0] == 255 || .@card[0] == 254) {
		mes "I can't enchant a signed equipment";
		close;
	}

	if (.@card[3]) {
		mes "This " + .@part_name + " is already enchanted";
		close;
	}
	
	.@rand = rand(1, .totalchance);
	while ((.@rand -= .rate[.@orb_level]) > 0) .@orb_level++;
	.@orb = 4700 + rand(0, 5) * 10 + .@orb_level; // orb of str/int/dex ....

	if (callfunc("F_IsEquipIDHack", .@part, .@id) ||
		callfunc("F_IsEquipRefineHack", .@part, .@ref) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3])) {
		emotion ET_FRET;
		mes "Wait a second...";
		mes "Do you think I'm stupid?!";
		mes "You switched the item while I wasn't looking! Get out of here!";
		close;
	}

	delitem2(.@id, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], 0);
	getitem2(.@id, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], .@orb);
	equip(.@id);
	end;

	OnInit:
		setarray(.rate, 55, 50, 45); //, 40, 35); // rate of getting +1 is 55%, +2 is 50% .... +10 is 10% ...

		setarray(.const_equip, EQP_COSTUME_HEAD_TOP);
		setarray(.menu_name$, "Upper Costume Headgear");
		.menu$ = implode(.menu_name$, ":");

		for(.@i = 0; .@i < getarraysize(.rate); .@i++)
			.totalchance += .rate[.@i];
}

 

Edited by Winterfox
  • 0
Posted
On 8/31/2023 at 8:02 PM, Winterfox said:

I didn't test it, but this should do what you want.
 

prontera,156,178,5	script	Enchanter	100,{
	disable_items;

	mes "What do you want to enchant?";
	next;
	.@s = select( .menu$ ) -1;
	.@part = .const_equip[.@s];
	.@part_name = .menu_name$[.@s];

	if (!getequipisequiped(.@part)) {
		mes "You did not equip an " + .@part_name + " at the moment";
		close;
	}

	.@id = getequipid(.@part);
	.@ref = getequiprefinerycnt(.@part);
	setarray(.@card[0], getequipcardid(.@part, 0), getequipcardid(.@part, 1), getequipcardid(.@part, 2), getequipcardid(.@part, 3));

	if (.@card[0] == 255 || .@card[0] == 254) {
		mes "I can't enchant a signed equipment";
		close;
	}

	if (.@card[3]) {
		mes "This " + .@part_name + " is already enchanted";
		close;
	}
	
	.@rand = rand(1, .totalchance);
	while ((.@rand -= .rate[.@orb_level]) > 0) .@orb_level++;
	.@orb = 4700 + rand(0, 5) * 10 + .@orb_level; // orb of str/int/dex ....

	if (callfunc("F_IsEquipIDHack", .@part, .@id) ||
		callfunc("F_IsEquipRefineHack", .@part, .@ref) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3])) {
		emotion ET_FRET;
		mes "Wait a second...";
		mes "Do you think I'm stupid?!";
		mes "You switched the item while I wasn't looking! Get out of here!";
		close;
	}

	delitem2(.@id, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], 0);
	getitem2(.@id, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], .@orb);
	equip(.@id);
	end;

	OnInit:
		setarray(.rate, 55, 50, 45); //, 40, 35); // rate of getting +1 is 55%, +2 is 50% .... +10 is 10% ...

		setarray(.const_equip, EQP_COSTUME_HEAD_TOP);
		setarray(.menu_name$, "Upper Costume Headgear");
		.menu$ = implode(.menu_name$, ":");

		for(.@i = 0; .@i < getarraysize(.rate); .@i++)
			.totalchance += .rate[.@i];
}

 

how to make this enable to trying to enchant agin? i mean ist not only 1 time enchant

 

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.   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...