Jump to content
  • 0

Random Option Remover NPC


mawjustin

Question


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

Hi guys, may I ask for a script that removes all Random Option of an item in exchange for a certain item? Thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

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

try this.

prontera,155,181,5	script	Sample	4_F_KAFRA1,{
	
	for (.@eqi = EQI_SHOES; .@eqi < EQI_HAND_R; .@eqi++) {
		.@equip_id = getequipid(.@eqi);
		if (.@equip_id > 0) 
			.@menu$ = .@menu$ + getitemname(.@equip_id) + " ["+getitemslots(.@equip_id)+"]";
		.@menu$ = .@menu$ + ":";
	}
	mes "Select an equipment.";
	.@eqi = select(.@menu$) - 1 + EQI_SHOES;
	mes "Equip: "+getitemname(getequipid(.@eqi));
	if (.itemid_size) {
		mes "Required Items:";
		for (.@i = 0; .@i < .itemid_size; .@i++) {
			mes " -> "+F_InsertComma(.amount[.@i])+"x "+getitemname(.itemid[.@i]);
			if (countitem(.itemid[.@i]) < .amount[.@i])
				.@fail++;
		}
	}
	if (!.@fail) {
		if (select("Reset Enchantment", "Cancel") == 1) {
			for (.@i = 0; .@i < .itemid_size; .@i++)
				delitem .itemid[.@i], .amount[.@i];
			.@equip_id = getequipid(.@eqi);
			.@refine = getequiprefinerycnt(.@eqi);
			for (.@i = 0; .@i < 4; .@i++)
				.@card[.@i] = getequipcardid(.@eqi, .@i);
			delequip .@eqi;
			getitem2 .@equip_id, 1, 1,.@refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			mes "Done reset enchant.";
		}
	}
	close;
	
	OnInit:
		setarray .itemid, 501, 502;
		setarray .amount, 1, 2;
		.itemid_size = getarraysize(.itemid);
		end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

On 4/12/2020 at 6:21 AM, Emistry said:

try this.


prontera,155,181,5	script	Sample	4_F_KAFRA1,{
	
	for (.@eqi = EQI_SHOES; .@eqi < EQI_HAND_R; .@eqi++) {
		.@equip_id = getequipid(.@eqi);
		if (.@equip_id > 0) 
			.@menu$ = .@menu$ + getitemname(.@equip_id) + " ["+getitemslots(.@equip_id)+"]";
		.@menu$ = .@menu$ + ":";
	}
	mes "Select an equipment.";
	.@eqi = select(.@menu$) - 1 + EQI_SHOES;
	mes "Equip: "+getitemname(getequipid(.@eqi));
	if (.itemid_size) {
		mes "Required Items:";
		for (.@i = 0; .@i < .itemid_size; .@i++) {
			mes " -> "+F_InsertComma(.amount[.@i])+"x "+getitemname(.itemid[.@i]);
			if (countitem(.itemid[.@i]) < .amount[.@i])
				.@fail++;
		}
	}
	if (!.@fail) {
		if (select("Reset Enchantment", "Cancel") == 1) {
			for (.@i = 0; .@i < .itemid_size; .@i++)
				delitem .itemid[.@i], .amount[.@i];
			.@equip_id = getequipid(.@eqi);
			.@refine = getequiprefinerycnt(.@eqi);
			for (.@i = 0; .@i < 4; .@i++)
				.@card[.@i] = getequipcardid(.@eqi, .@i);
			delequip .@eqi;
			getitem2 .@equip_id, 1, 1,.@refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			mes "Done reset enchant.";
		}
	}
	close;
	
	OnInit:
		setarray .itemid, 501, 502;
		setarray .amount, 1, 2;
		.itemid_size = getarraysize(.itemid);
		end;
}

 

Thank you! it works! I just did a bit of modification to align with my server.

@Emistry sir, I did some changes in your file, how do we implement this?
 

jupe_ele,38,50,5	script	Tollere#1	4_F_KAFRA1,{ // 

// THIS WILL READ ALL THE ITEMS AVAILABLE, INCLUDING SHADOW EQUIPMENT
	for (.@eqi = EQI_SHOES; .@eqi <= EQI_SHADOW_ACC_L; .@eqi++) {
		.@equip_id = getequipid(.@eqi);
		if (.@equip_id > 0) 
			.@menu$ = .@menu$ + getitemname(.@equip_id) + " ["+getitemslots(.@equip_id)+"]";
		.@menu$ = .@menu$ + ":";
	}

mes .npc_n$;
mes "Hello Adventurer!";
mes "my name is Tollere ";
mes "I specialize in removing ^006600Enchantment^000000 and ^006600Random Option^000000";
mes "using ^FF0000"+getitemname(.itemid)+"^000000.";
mes "which process do you need?";

// RESET ENCHANTMENT = REMOVE STONE/ORBS ON CARD SLOT, BUT RETAIN RANDOM OPTION
// RANDOM OPTION REMOVAL = REMOVE RANDOM OPTION, BUT RETAIN THE ORBS/STONE ON CARD SLOT
if (select("Reset Enchantment","Random Option Removal") == 1) {
	next;
	mes "Select an equipment for";
	mes "^006600Enchant Removal^000000";
	.@eqi = select(.@menu$) - 1 + EQI_SHOES;
	mes "Equip: "+getitemname(getequipid(.@eqi));
	if (.itemid_size) {
		mes "Required Items:";
		for (.@i = 0; .@i < .itemid_size; .@i++) {
			mes " -> "+F_InsertComma(.amount[.@i])+"x "+getitemname(.itemid[.@i]);
			if (countitem(.itemid[.@i]) < .amount[.@i])
				.@fail++;
		}
	}
	if (!.@fail) {
		if (select("Reset Enchantment", "Cancel") == 1) {
			for(.@ii=0;.@ii<(MAX_ITEM_RDM_OPT-0);.@ii++){
				.@r_id[.@ii] = getequiprandomoption(.s_all_loc[.@eqi],.@i,ROA_ID);
				.@r_v[.@ii] = getequiprandomoption(.s_all_loc[.@eqi],.@i,ROA_VALUE);
				.@r_p[.@ii] = getequiprandomoption(.s_all_loc[.@eqi],.@i,ROA_PARAM);
   	 			}
			for (.@i = 0; .@i < .itemid_size; .@i++)
				delitem .itemid[.@i], .amount[.@i];
			.@equip_id = getequipid(.@eqi);
			.@refine = getequiprefinerycnt(.@eqi);
			for (.@i = 0; .@i < 4; .@i++)
				.@card[.@i] = getequipcardid(.@eqi, .@i);
			delequip .@eqi;
			//getitem2 .@equip_id, 1, 1,.@refine,0,0,0,0,0;
			getitem3 .@equip_id, 1, 1, .@refine, 0, 0, 0, 0, 0,.@r_id,.@r_v,.@r_p;
			getitem .@card[0],1;
			getitem .@card[1],1;
			getitem .@card[2],1;
			getitem .@card[3],1;
			mes "Done Reset Enchantment.";
		}
	}
	close;
	} else {
	next;
	mes "Select an equipment for";
	mes "^006600Random Option Removal^000000";
	.@eqi = select(.@menu$) - 1 + EQI_SHOES;
	mes "Equip: "+getitemname(getequipid(.@eqi));
	if (.itemid_size) {
		mes "Required Items:";
		for (.@i = 0; .@i < .itemid_size; .@i++) {
			mes " -> "+F_InsertComma(.amount[.@i])+"x "+getitemname(.itemid[.@i]);
			if (countitem(.itemid[.@i]) < .amount[.@i])
				.@fail++;
		}
	}
	if (!.@fail) {
		if (select("Random Option Removal", "Cancel") == 1) {
			for (.@i = 0; .@i < .itemid_size; .@i++)
				delitem .itemid[.@i], .amount[.@i];
			.@equip_id = getequipid(.@eqi);
			.@refine = getequiprefinerycnt(.@eqi);
			for (.@i = 0; .@i < 4; .@i++)
				.@card[.@i] = getequipcardid(.@eqi, .@i);
			delequip .@eqi;
			getitem2 .@equip_id, 1, 1,.@refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			mes "Done Random Option Removal.";
		}
	}
	close;
	} 
close;
	
	OnInit:
		.npc_n$ = "[^4B0082 Tollere ^000000]"; // NPC Name.
		setarray .itemid, 60002;
		setarray .amount, 1;
		.itemid_size = getarraysize(.itemid);
		end;
}

My goal for this is 

1. Reset Enchantment = will remove and put the orbs/stones into the inventory in all card slot of the item, but will retain the Random Option

2. Random Option Removal = will remove the random option, but will retain the orb/stone in card slot.

 

Is there a way to do it like my goal??

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.01
  • Content Count:  44
  • Reputation:   1
  • Joined:  04/15/20
  • Last Seen:  

On 4/12/2020 at 6:21 AM, Emistry said:

try this.

prontera,155,181,5	script	Sample	4_F_KAFRA1,{
	
	for (.@eqi = EQI_SHOES; .@eqi < EQI_HAND_R; .@eqi++) {
		.@equip_id = getequipid(.@eqi);
		if (.@equip_id > 0) 
			.@menu$ = .@menu$ + getitemname(.@equip_id) + " ["+getitemslots(.@equip_id)+"]";
		.@menu$ = .@menu$ + ":";
	}
	mes "Select an equipment.";
	.@eqi = select(.@menu$) - 1 + EQI_SHOES;
	mes "Equip: "+getitemname(getequipid(.@eqi));
	if (.itemid_size) {
		mes "Required Items:";
		for (.@i = 0; .@i < .itemid_size; .@i++) {
			mes " -> "+F_InsertComma(.amount[.@i])+"x "+getitemname(.itemid[.@i]);
			if (countitem(.itemid[.@i]) < .amount[.@i])
				.@fail++;
		}
	}
	if (!.@fail) {
		if (select("Reset Enchantment", "Cancel") == 1) {
			for (.@i = 0; .@i < .itemid_size; .@i++)
				delitem .itemid[.@i], .amount[.@i];
			.@equip_id = getequipid(.@eqi);
			.@refine = getequiprefinerycnt(.@eqi);
			for (.@i = 0; .@i < 4; .@i++)
				.@card[.@i] = getequipcardid(.@eqi, .@i);
			delequip .@eqi;
			getitem2 .@equip_id, 1, 1,.@refine,0,.@card[0],.@card[1],.@card[2],.@card[3];
			mes "Done reset enchant.";
		}
	}
	close;
	
	OnInit:
		setarray .itemid, 501, 502;
		setarray .amount, 1, 2;
		.itemid_size = getarraysize(.itemid);
		end;
}

 

@Emistry how to add check on this to make it not process disenchantment when the item is not enchanted ?

also sorry for bringing up old topics

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

×
×
  • Create New...