Jump to content
  • 0

Change Rent Item


Kawacito

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

What I am looking for is to create an NPC that changes a profitable item for one of the same id but that is not profitable, that is, an npc that if it detects that I have 10 profitable items of the same identity, it will turn them into 1 permanent item. In a few words, I exchanged 10 profitable items of the same ID for 1 Permanent item of the same ID, I don't know how to detect if it is a profitable item or not if someone can help me with this grateful npc

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

Just now, JHONDOMINIC said:

Do you meaning exchange 10 rental items to 1 permanent item?

 

Yes, I have some boxes that give profitable random items, what I want to achieve is that if I get 10 profitable items with the same id, through an NPC I transform those 10 equal profitable items with the same id into 1 only that is permanent (not profitable ) the issue is that I don't know how to build it

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

Just now, JHONDOMINIC said:
payon,156,223,4	script	Permanent Exchange	941,{
	for (.@i = 0; .@i < getarraysize(.Profit_Id); ++.@i) {
		.@menu$ = .@menu$ + "- "+getitemname(.Profit_Id[.@i])+":";
	}
	.@itemid = .Profit_Id[select(.@menu$)-1];
	if (rentalcountitem(.@itemid) < 10) {
		mes "Not enough "+getitemname(.@itemid)+".";
		close;
	}
	getinventorylist();
	for (.@i = 0; .@i < @inventorylist_count; ++.@i) {
		if ((@inventorylist_expire[.@i] > 0) && (@inventorylist_id[.@i] == .@itemid)) {
			if (.@count < 10) {
				delitemidx @inventorylist_idx[.@i];
				++.@count;
			}
			else {
				break;
			}
		}
	}
	if (.@count == 10) {
		getitem .@itemid, 1;
	}
	end;
	
		
OnInit:
	setarray .Profit_Id, 5022, 5023, 5024;
	end;
}

Try above. I hope you will love it ?

 

Line 14 tells me that it is wrong and I did not find a solution before consulting

 

delitemidx @inventorylist_idx[.@i];

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

Just now, Kawacito said:

 

Line 14 tells me that it is wrong and I did not find a solution before consulting

 

delitemidx @inventorylist_idx[.@i];

 

 

I corrected it but this npc contains a list of items, what I need is for the NPC to detect if I have 10 equal profitable items in my inventory and exchange them for 1 Permanent without the need to add a list of items to the npc since there are thousands of items... in short, I don't want the npc to have a list, but to detect them from my inventory if I have profitable items in a quantity greater than or equal to 10 and return an item name and the option to transform into 1 permanent

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

4 hours ago, Kawacito said:

 

Line 14 tells me that it is wrong and I did not find a solution before consulting

 

delitemidx @inventorylist_idx[.@i];

 

I managed to do the following:

 

payon,156,223,4    script    Stimy    941,{
 


    for (.@i = 0; .@i < getarraysize(.Profit_Id); ++.@i) 

    
    getinventorylist();
    for (.@i = 0; .@i < @inventorylist_count; ++.@i) {
        if ((@inventorylist_expire[.@i] != 0) && (@inventorylist_id[.@i] == .Profit_Id)) {
            
                delitem @inventorylist_id[.@i],10;
                getitem 671,1;
                close;
            
            }
        }
    
    
        
OnInit:
    setarray .Profit_Id, 5022, 5023, 5024;
    end;

}




The issue is that it uses the items that are not profitable, what I need is that I only use the profitable items

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

Just now, JHONDOMINIC said:

Mi script anterior probado por mí y funciona.

Copie todo mi script y edite aquí

Ingrese su item_id rentable.

If all that works well, it happens that it takes items that are not profitable and I only want it to take the items that are profitable. For example, if I have 10 common items and 10 profitable items, all with the same id, the npc takes 10 regardless of whether they are profitable or not and the idea is that you only take those who are profitable

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

 

I feel something is missing at the moment of delitem

delitem @inventorylist_id[.@i],10;

something that determines that you only deliver profitable items.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   2
  • Joined:  04/16/21
  • Last Seen:  

Just now, JHONDOMINIC said:

No sé qué es un artículo rentable en tu sentido. Explique por favor.

Rentitem.

I only want the npc to take 10 items (rentitem) of the same id and give me 1 item (permanent) of the same id, but for the NPC to only consume items (rentitem) for me.

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