Custom Enchant System

Rebel

New member
Messages
149
Points
0
Github
shadow-mo0n
Emulator
I need help fixing my script.. The enchantment is not staying on the slot. How do I keep the enchantment inserted in the slot?? This script should have 3 enchantment in a chosen headgear. But it only inserting one.

View attachment enchant.txt

 
Last edited by a moderator:
@Rebel

Code:
prontera,146,185,6	script	Costume Enchanter	4_M_SCIENCE,{
	disable_items;
	.@header$ = "[^0000FF Costume Enchanter ^000000]";
	mes .@header$;
	if (Zeny < 500000) {
		mes "I am in charge of Enchanting Costume Headgears. Simply put, I've been studying ways to power-up headgears.";
		next;
		mes .@header$;
		mes "If by any chance, you would want to enchant your headgears, bring me 500,000 zeny and the armor you want to enchant and you are all set to go.";
		close;
	}
	mes "I'm an engineer that specializes in Enchanting Armors.";
    next;
    mes .@header$;
    mes "Enchanting may seem simple, but it's far more complicated than it looks.\n";
    mes "If you're interested in my service, let me know.";
	next;
	switch( select( "~ ^0000FFEnchant Headgear ^000000", "~ Information", "~ Maybe next time." ) ) {
	case 1:
		break;
	case 2:
		mes .@header$;
		mes "To be update";
		close;
	case 3:
  		mes .@header$;
  		mes "Please come back when you have any interest in enchanting your headgear.";
  		close;
	}
	setarray .@items[0],19504,19505,19506;
//		Red_Tailed_Ribbon;
	.@failrate = 1; // 1% fail rate (for testing)
	.@menu$ = "";
	.@size = getarraysize(.@items);
	for ( .@i = 0; .@i < .@size; ++.@i )
		.@menu$ += getitemname(.@items[.@i]) +":";
	.@itemid = .@items[select(.@menu$)-1];
	if (getequipid(EQI_COSTUME_HEAD_TOP) == .@itemid)
		.@part = EQI_COSTUME_HEAD_TOP;
	else if (getequipid(EQI_COSTUME_HEAD_MID) == .@itemid)
		.@part = EQI_COSTUME_HEAD_MID;
	else if (getequipid(EQI_COSTUME_HEAD_LOW) == .@itemid)
		.@part = EQI_COSTUME_HEAD_LOW;

//	else if (getequipid(EQI_HEAD_TOP) == .@itemid)
//		.@part = EQI_HEAD_TOP;

	mes .@header$;
	if ( !getequipisequiped(.@part) ) {
		mes "Hmm? There's nothing to be enchanted!";
		mes "Make sure you are wearing the headgear you want be enchant.";
		close;
	}
	if ( getequipcardid(.@part,1) && getequipcardid(.@part,2) && getequipcardid(.@part,3) ) {
		mes "There's nothing more I can do with this headgear.";
		close;
    }
	.@refine = getequiprefinerycnt(.@part);
	for ( .@i = 3; .@i >= 1; --.@i )
		if ( !getequipcardid( .@part, .@i ) )
			.@slot_num = .@i;
	for ( .@i = 0; .@i < 4; ++.@i )
		.@cardid[.@i] = getequipcardid( .@part,.@i );
    mes "Socket enchant will cost you 500,000z. And there will be a random option enchanted.";
    mes "Of course, there is a chance of breaking your armor.";
    next;
	mes .@header$;
	mes "Do you still want to try an Enchant?";
	next;
	if ( select( "~ Hmm... Let me think it over.", "~ Go ahead.") == 1 ) {
		mes .@header$;
		mes "Well, I can't blame you. Safety first, eh?";
		mes "Now you have a nice day.";
		close;
	}
	mes .@header$;
	if (Zeny < 500000) {
		mes .@header$;
		mes "Sorry, but you don't have enough zeny.";
		close;
	}
	mes "Quite of an adventurer huh? Well, shall we?";
	Zeny -= 500000;
	delitem2 .@itemid, 1,1, .@refine,0, .@cardid[0],.@cardid[1],.@cardid[2],.@cardid[3];
	close2;
	specialeffect EF_MAPPILLAR, AREA, playerattached();
	progressbar "ffff00",1; // is this really needed ? what happen if the player logout/disconnect during this short period ? The item is gone forever !!
	switch (rand(1,.@failrate)) { // yeah you said its testing, maybe its 1,36 ... or maybe something higher
	case 1: .@addpart = 4702;break;
	case 2: .@addpart = 4712;break;
	case 3: .@addpart = 4722;break;
	case 4: .@addpart = 4732;break;
	case 5: .@addpart = 4742;break;
	case 6: .@addpart = 4752;break;
	case 7:
	case 8: .@addpart = 4701;break;
	case 9:
	case 10: .@addpart = 4711;break;
	case 11:
	case 12: .@addpart = 4721;break;
	case 13:
	case 14: .@addpart = 4731;break;
	case 15:
	case 16: .@addpart = 4741;break;
	case 17:
	case 18: .@addpart = 4751;break;
	case 19:
	case 20:
	case 21: .@addpart = 4700;break;
	case 22:
	case 23:
	case 24: .@addpart = 4710;break;
	case 25:
	case 26:
	case 27: .@addpart = 4720;break;
	case 28:
	case 29:
	case 30: .@addpart = 4730;break;
	case 31:
	case 32:
	case 33: .@addpart = 4740;break;
	case 34:
	case 35:
	case 36: .@addpart = 4750;break;
	default:
		specialeffect(EF_PHARMACY_FAIL, AREA, playerattached());
		mes .@header$;
		mes "Well that's too bad.";
		mes "The requested equipment has failed to enchant.";
		close;
	}
    mes .@header$;
	mes "Ha! There you go, your brand new enchanted equipment!";
    if ( .@slot_num == 1 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@addpart, .@cardid[2], .@cardid[3];
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@addpart, .@cardid[2], .@cardid[3];
	}
    else if ( .@slot_num == 2 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@addpart, .@cardid[3];
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@cardid[1], .@addpart, .@cardid[3];
	}
	else if ( .@slot_num == 3 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@addpart;
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@addpart;
	}
  	close;
}

 
Last edited by a moderator:
@Rebel

Code:
prontera,146,185,6	script	Costume Enchanter	4_M_SCIENCE,{
	disable_items;
	.@header$ = "[^0000FF Costume Enchanter ^000000]";
	mes .@header$;
	if (Zeny < 500000) {
		mes "I am in charge of Enchanting Costume Headgears. Simply put, I've been studying ways to power-up headgears.";
		next;
		mes .@header$;
		mes "If by any chance, you would want to enchant your headgears, bring me 500,000 zeny and the armor you want to enchant and you are all set to go.";
		close;
	}
	mes "I'm an engineer that specializes in Enchanting Armors.";
    next;
    mes .@header$;
    mes "Enchanting may seem simple, but it's far more complicated than it looks.\n";
    mes "If you're interested in my service, let me know.";
	next;
	switch( select( "~ ^0000FFEnchant Headgear ^000000", "~ Information", "~ Maybe next time." ) ) {
	case 1:
		break;
	case 2:
		mes .@header$;
		mes "To be update";
		close;
	case 3:
  		mes .@header$;
  		mes "Please come back when you have any interest in enchanting your headgear.";
  		close;
	}
	setarray .@items[0],19504,19505,19506;
//		Red_Tailed_Ribbon;
	.@failrate = 1; // 1% fail rate (for testing)
	.@menu$ = "";
	.@size = getarraysize(.@items);
	for ( .@i = 0; .@i < .@size; ++.@i )
		.@menu$ += getitemname(.@items[.@i]) +":";
	.@itemid = .@items[select(.@menu$)-1];
	if (getequipid(EQI_COSTUME_HEAD_TOP) == .@itemid)
		.@part = EQI_COSTUME_HEAD_TOP;
	else if (getequipid(EQI_COSTUME_HEAD_MID) == .@itemid)
		.@part = EQI_COSTUME_HEAD_MID;
	else if (getequipid(EQI_COSTUME_HEAD_LOW) == .@itemid)
		.@part = EQI_COSTUME_HEAD_LOW;

//	else if (getequipid(EQI_HEAD_TOP) == .@itemid)
//		.@part = EQI_HEAD_TOP;

	mes .@header$;
	if ( !getequipisequiped(.@part) ) {
		mes "Hmm? There's nothing to be enchanted!";
		mes "Make sure you are wearing the headgear you want be enchant.";
		close;
	}
	if ( getequipcardid(.@part,1) && getequipcardid(.@part,2) && getequipcardid(.@part,3) ) {
		mes "There's nothing more I can do with this headgear.";
		close;
    }
	.@refine = getequiprefinerycnt(.@part);
	for ( .@i = 3; .@i >= 1; --.@i )
		if ( !getequipcardid( .@part, .@i ) )
			.@slot_num = .@i;
	for ( .@i = 0; .@i < 4; ++.@i )
		.@cardid[.@i] = getequipcardid( .@part,.@i );
    mes "Socket enchant will cost you 500,000z. And there will be a random option enchanted.";
    mes "Of course, there is a chance of breaking your armor.";
    next;
	mes .@header$;
	mes "Do you still want to try an Enchant?";
	next;
	if ( select( "~ Hmm... Let me think it over.", "~ Go ahead.") == 1 ) {
		mes .@header$;
		mes "Well, I can't blame you. Safety first, eh?";
		mes "Now you have a nice day.";
		close;
	}
	mes .@header$;
	if (Zeny < 500000) {
		mes .@header$;
		mes "Sorry, but you don't have enough zeny.";
		close;
	}
	mes "Quite of an adventurer huh? Well, shall we?";
	Zeny -= 500000;
	delitem2 .@itemid, 1,1, .@refine,0, .@cardid[0],.@cardid[1],.@cardid[2],.@cardid[3];
	close2;
	specialeffect EF_MAPPILLAR, AREA, playerattached();
	progressbar "ffff00",1; // is this really needed ? what happen if the player logout/disconnect during this short period ? The item is gone forever !!
	switch (rand(1,.@failrate)) { // yeah you said its testing, maybe its 1,36 ... or maybe something higher
	case 1: .@addpart = 4702;break;
	case 2: .@addpart = 4712;break;
	case 3: .@addpart = 4722;break;
	case 4: .@addpart = 4732;break;
	case 5: .@addpart = 4742;break;
	case 6: .@addpart = 4752;break;
	case 7:
	case 8: .@addpart = 4701;break;
	case 9:
	case 10: .@addpart = 4711;break;
	case 11:
	case 12: .@addpart = 4721;break;
	case 13:
	case 14: .@addpart = 4731;break;
	case 15:
	case 16: .@addpart = 4741;break;
	case 17:
	case 18: .@addpart = 4751;break;
	case 19:
	case 20:
	case 21: .@addpart = 4700;break;
	case 22:
	case 23:
	case 24: .@addpart = 4710;break;
	case 25:
	case 26:
	case 27: .@addpart = 4720;break;
	case 28:
	case 29:
	case 30: .@addpart = 4730;break;
	case 31:
	case 32:
	case 33: .@addpart = 4740;break;
	case 34:
	case 35:
	case 36: .@addpart = 4750;break;
	default:
		specialeffect(EF_PHARMACY_FAIL, AREA, playerattached());
		mes .@header$;
		mes "Well that's too bad.";
		mes "The requested equipment has failed to enchant.";
		close;
	}
    mes .@header$;
	mes "Ha! There you go, your brand new enchanted equipment!";
    if ( .@slot_num == 1 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@addpart, .@cardid[2], .@cardid[3];
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@addpart, .@cardid[2], .@cardid[3];
	}
    else if ( .@slot_num == 2 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@addpart, .@cardid[3];
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@cardid[1], .@addpart, .@cardid[3];
	}
	else if ( .@slot_num == 3 ) {
		getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@addpart;
		equip2 .@itemid, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@addpart;
	}
  	close;
}
not work 
But the original script works well
Either this does not work why?
And also why it only charms str3

 
Back
Top