Jump to content
  • 0
johnelle9

Identify NPC/Magnifier script with Random Option?

Question

Is it possible to enchant a Random Option to an item after its identified by an NPC or using a magnifier?

for ex. a Poring drop an unidentified "knife" and I'll use a magnifier recognizing it as a "physical weapon category".. once it's identified it now has a 1-2 random option based on that category?

this was posted by Emistry to keep a random option once identified.. I would like some help with producing a random option once identified.. Any help will be very much appreciated..

getinventorylist;
for([email protected] = 0; [email protected] < @inventorylist_count; [email protected]++) {
	
	for ([email protected] = 1; [email protected] <= 5; [email protected]++) {
		[email protected]_bonus_id_array[[email protected]] = getd("inventorylist_option_id"[email protected]+"["[email protected]+"]");
		[email protected]_bonus_value_array[[email protected]] = getd("inventorylist_option_value"[email protected]+"["[email protected]+"]");
		[email protected]_bonus_param_array[[email protected]] = getd("inventorylist_option_parameter"[email protected]+"["[email protected]+"]");
	}
	
	if ([email protected]_identify[[email protected]]) {
		delitem3 @inventorylist_id[[email protected]], 1, 0, @inventorylist_refine[[email protected]], @inventorylist_attribute[[email protected]], @inventorylist_card1[[email protected]], @inventorylist_card2[[email protected]], @inventorylist_card3[[email protected]], @inventorylist_card4[[email protected]], [email protected]_bonus_id_array, [email protected]_bonus_value_array, [email protected]_bonus_param_array;
		getitem3 @inventorylist_id[[email protected]], 1, 1, @inventorylist_refine[[email protected]], @inventorylist_attribute[[email protected]], @inventorylist_card1[[email protected]], @inventorylist_card2[[email protected]], @inventorylist_card3[[email protected]], @inventorylist_card4[[email protected]], [email protected]_bonus_id_array, [email protected]_bonus_value_array, [email protected]_bonus_param_array;
		[email protected]++;
	}
}
if ([email protected])
	dispbottom [email protected] +" items identified.";

 

Edited by johnelle9
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

So I made it to work!! But only for the Armor type atm.
Can someone help me Optimize it more and help me how to add a 2nd enchant??

getinventorylist;
for([email protected] = 0; [email protected] < @inventorylist_count; [email protected]++) { 
	if ([email protected]_identify[[email protected]]) {
		if (getiteminfo(@inventorylist_id[[email protected]],5) == 16){ 	//Unidentified Armor
			set [email protected],F_rand(3,4,5,6,7,8,9,1,2,11,12); 		//1st enchant ID
			
			if([email protected] == 1 || [email protected] == 2) set [email protected],rand(3,7);//~1st enchant VALUES
			else if([email protected] == 11) set [email protected],rand(1,40);		//~
			else if([email protected] == 12) set [email protected],rand(1,20);	//~
			else set [email protected],rand(1,4); 				//~
			
			set [email protected],1;	//param
		}
		delitem2 @inventorylist_id[[email protected]],1,0,0,0,0,0,0,0;
		getitem3 @inventorylist_id[[email protected]],1,1,0,0,0,0,0,0,[email protected],[email protected],[email protected];
	}
}
end;
Link to comment
Share on other sites

  • 0

I got the Identifier NPC to apply a 1st RandOpt once the item is identified..
now im stuck how to enchant a 2nd RandOpt with 30% chance. Any Help will be appreciated...

getinventorylist;
	for([email protected] = 0; [email protected] < @inventorylist_count; [email protected]++) { 
		if ([email protected]_identify[[email protected]]) {
			if (getiteminfo(@inventorylist_id[[email protected]],5) == 16){	//Unidentified Armor
				set [email protected],F_rand(3,4,5,6,7,8,9,10,11,12);	 	//1st ROA
				if([email protected] == 9 || [email protected] == 10) set [email protected],rand(3,7);	//Values
				else if([email protected] == 11 || [email protected] == 12) set [email protected],rand(1,20);
				else set [email protected],rand(1,4);
				set [email protected],0;  		//IT WORKS UP UNTIL HERE... 
				
				//HOW TO APPLY THIS ONE THOUGH?
                    if(rand(100)<=30){ // 30% chance to apply 2nd Enchant
					set [email protected],F_rand(1,2,17,19,20,21,26,27,28,29,30,31,32,33,34);
					if([email protected] == 1) set [email protected],rand(1,500);
					if([email protected] == 2) set [email protected],rand(1,100);
					if([email protected] == 17 || [email protected] == 19) set [email protected],rand(1,20);
					if([email protected] == 20 || [email protected] == 21) set [email protected],rand(1,10);
					else set [email protected],rand(1,20);
					set [email protected],1;
				}
				
			}
			delitem2 @inventorylist_id[[email protected]],1,0,0,0,0,0,0,0;
			getitem3 @inventorylist_id[[email protected]],1,1,0,0,0,0,0,0,[email protected],[email protected],[email protected];

 

Link to comment
Share on other sites

  • 0

try

getinventorylist;
for([email protected] = @inventorylist_count - 1; [email protected] >= 0; [email protected]) {
	if (@inventorylist_identify[[email protected]])
		continue;
	
	if (getiteminfo(@inventorylist_id[[email protected]], ITEMINFO_LOCATIONS) != EQP_ARMOR)
		continue;
	
	deletearray [email protected];
	deletearray [email protected];
	deletearray [email protected];
	
	// first enchant
	if (rand(100) < 30) {
		[email protected][0] = 0;
		[email protected][0], F_rand(3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
		if ([email protected][0] == 9 || [email protected][0] == 10)
			[email protected][0] = rand(3, 7);
		else if([email protected][0] == 11 || [email protected][0] == 12)
			[email protected][0] = rand(1, 20);
		else 
			[email protected][0] = rand(1, 4);
	}
	
	// second enchant
	if (rand(100) < 30) {
		[email protected][1] = 1;
		[email protected][1], F_rand(3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
		if ([email protected][1] == 9 || [email protected][1] == 10)
			[email protected][1] = rand(3, 7);
		else if([email protected][1] == 11 || [email protected][1] == 12)
			[email protected][1] = rand(1, 20);
		else 
			[email protected][1] = rand(1, 4);
	}
	
	delitemidx @inventorylist_idx[[email protected]];
	getitem3 @inventorylist_id[[email protected]], 1, 1, 0, 0, 0, 0, 0, 0, [email protected], [email protected], [email protected];
}

 

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.