Jump to content
  • 0

Identify NPC/Magnifier script with Random Option?


Question

Posted (edited)

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(.@i = 0; .@i < @inventorylist_count; .@i++) {
	
	for (.@r = 1; .@r <= 5; .@r++) {
		.@random_bonus_id_array[.@r] = getd("inventorylist_option_id"+.@r+"["+.@i+"]");
		.@random_bonus_value_array[.@r] = getd("inventorylist_option_value"+.@r+"["+.@i+"]");
		.@random_bonus_param_array[.@r] = getd("inventorylist_option_parameter"+.@r+"["+.@i+"]");
	}
	
	if (!@inventorylist_identify[.@i]) {
		delitem3 @inventorylist_id[.@i], 1, 0, @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], .@random_bonus_id_array, .@random_bonus_value_array, .@random_bonus_param_array;
		getitem3 @inventorylist_id[.@i], 1, 1, @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], .@random_bonus_id_array, .@random_bonus_value_array, .@random_bonus_param_array;
		.@count++;
	}
}
if (.@count)
	dispbottom .@count +" items identified.";

 

Edited by johnelle9

3 answers to this question

Recommended Posts

  • 0
Posted

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(.@i = 0; .@i < @inventorylist_count; .@i++) { 
	if (!@inventorylist_identify[.@i]) {
		if (getiteminfo(@inventorylist_id[.@i],5) == 16){ 	//Unidentified Armor
			set .@opt,F_rand(3,4,5,6,7,8,9,1,2,11,12); 		//1st enchant ID
			
			if(.@opt == 1 || .@opt == 2) set .@val,rand(3,7);//~1st enchant VALUES
			else if(.@opt == 11) set .@val,rand(1,40);		//~
			else if(.@opt == 12) set .@val,rand(1,20);	//~
			else set .@val,rand(1,4); 				//~
			
			set .@indx,1;	//param
		}
		delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0;
		getitem3 @inventorylist_id[.@i],1,1,0,0,0,0,0,0,.@opt,.@val,.@indx;
	}
}
end;
  • 0
Posted

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

 

  • 0
Posted

try

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

 

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