Jump to content
  • 0
Zirius

Refined weapon/equip as quest item using getinventory list then delete after

Question

As it turns out, hercules has now "getinventorylist" command, but I am not pretty sure on how to run loop on its array.

Suppose, let's say, we want +10 Muffler and +10 Manteau as quest requirement, how do you successfully check for it and delete it? ???

Any example?

 

Thanks!

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Are you sure you need it using getinventorylist? You can use countitem2 to quickly make the check:

 

	// Checking just the case of no cards compounded	// countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)	// delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};	if ( countitem2(Muffler_,1,10,0,0,0,0,0) && countitem2(Manteau_,1,10,0,0,0,0,0) ) {		delitem2(Muffler_,1,1,10,0,0,0,0,0);		delitem2(Manteau_,1,1,10,0,0,0,0,0);		getitem Apple,1;	}	else {		dispbottom "NOPE!";	}

 

 

In case it's strictly necessary to use getinventorylist, then it's a bit less simple:

	/*	getinventorylist returns:		@inventorylist_id[] - array of item ids.		@inventorylist_amount[] - their corresponding item amounts.		@inventorylist_equip[] - will return the slot the item is equipped on, if at all.		@inventorylist_refine[] - for how much it is refined.		@inventorylist_identify[] - whether it is identified.		@inventorylist_attribute[] - whether it is broken.		@inventorylist_card1[] - These four arrays contain card data for the 		@inventorylist_card2[] items. These data slots are also used to store		@inventorylist_card3[] names inscribed on the items, so you can		@inventorylist_card4[] explicitly check if the character owns an item made by a specific craftsman.		@inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.		@inventorylist_bound - whether it is an account bounded item or not.		@inventorylist_count - the number of items in these lists		delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};		*/		setarray .@requitems[1], Muffler_, Manteau_; //Muffler_ and Manteau_ (both slotted)	getinventorylist;		// Looping for each item	for ( .@cur_item = 1; .@cur_item <= getarraysize(.@requitems); .@cur_item++ ) {		// Looping the whole inventory till we find the required item		for ( .@j = 0; .@j < @inventorylist_count; .@j++) {			// Is this OUR desired item?			if (@inventorylist_id[.@j] == .@requitems[cur_item] && @inventorylist_refine == 10) {				// Fill up some arrays with all the info to use with delitem in case we have all required items				.@item_identify[.@cur_item] = @inventorylist_identify[.@cur_item];				.@item_refine[.@cur_item] = @inventorylist_refine[.@cur_item]; // Could be directly 10, but making a general case				.@item_attribute[.@cur_item] = @inventorylist_attribute[.@cur_item];				.@item_card1[.@cur_item] = @inventorylist_card1[.@cur_item];				.@item_card2[.@cur_item] = @inventorylist_card2[.@cur_item];				.@item_card3[.@cur_item] = @inventorylist_card3[.@cur_item];				.@item_card4[.@cur_item] = @inventorylist_card4[.@cur_item];								// And no need to continue doing this loop				break;			}						// Can we confirm it is impossible to have this current items?			if (.@j == @inventorylist_count -1) {				.@deny = 1;				dispbottom "You're missing at least a ^0000FF" + getitemname(.@requitems[cur_item]) + "^000000.";				end; // No need to run the script anymore			}		}				sleep 1; // The processor could be needed for something more important than this	}		// OK, we should have the items ready at this point, so loop to remove them	for ( .@cur_item = 1; .@cur_item <= getarraysize(.@requitems); .@cur_item++ ) {		delitem2 .@requitems[.@cur_item],1,.@item_identify[.@cur_item],.@item_refine[.@cur_item],.@item_attribute[.@cur_item],.@item_card1[.@cur_item],.@item_card2[.@cur_item],.@item_card3[.@cur_item],.@item_card4[.@cur_item];	}		// And you've got your gift now!	getitem Apple, 1;	end;

 

NOTE: Untested but checked. Should work unless I typo'd somewhere, in that case please tell me.

 

P.S.: Yep, I usually copy over the documentation so no need to change tabs or windows while programming :P

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, AnimeRO said:

can you give script for refine quest materials ? please? 

 

Why revive a post from 2014? also please be clear.

also there's countitem2() command to check refine/cards of items.

Share this post


Link to post
Share on other sites
  • 0
On 8/19/2017 at 6:56 AM, Dastgir said:

Why revive a post from 2014? also please be clear.

also there's countitem2() command to check refine/cards of items.

sorry i am new i am trying to make a refine material as quest item but i dont know how to do that.,

heres my experimental but i got error on switch case

can you help me how to make a refine materials as quest material

 

example the npc menu would be, main gauche, gakkung,

then the quest material for main gauch is +10 Knife and 100 apples

and the requirements for Gakkung is +10 Bow and 5 Ygg

heres my experimental script but it gives me error please help im new at switch script

 

turbo_room,63,98,4    script    test    4_M_BIBI,{

switch(select("Case 0","Case 1")) {

Case 0:
    
        if(countitem2(25226,1,8,0,0,0,0,0) < 1){ 
mes " Sorry, but you haven't brought the requirements"; 
close;
}

        mes "Bwahahahah";
        mes "Thank you for your help!!";
        //getitem getarg(0), 1;
        delitem2 25226,1,1,8,0,0,0,0,0;
        getitem 30205,1;            

        close;
        break;
        
Case 1:
    
        if(countitem2(25226,1,8,0,0,0,0,0) < 1){ 
mes " Sorry, but you haven't brought the requirements"; 
close;
}

        mes "Bwahahahah";
        mes "Thank you for your help!!";
        //getitem getarg(0), 1;
        delitem2 25225,1,1,8,0,0,0,0,0;
        getitem 30208,1;            

        close;
        break;
        
}
    }

    
    
    sorry i am new i am just trying to learn

Edited by AnimeRO
editing more lines

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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