Page 1 of 1

Selling high level items after class swap

Posted: Tue Oct 25, 2011 11:18 pm
by imaginethat
Hi
I am looking for some help streamlining a solution for an issues I am having.

How to sell items in my inventory including and most importantly the arrows in my ammo slots that become two high level after swapping class.
Example: I am a Rogue41\Scout39, have quivers in bag, and arrows in ammo slot, also have potions for my level. I want to swap to the Scout being Primary class, but doing this will make all my ammo in hand and quivers in bag, and potions in bag all too high a level to use.

I can send the character to the Merchant and Weapon vendor, and the Store.lua script will purchase more of everything at the appropriate level, but how do I get rid of all the too high level items?
The most important thing though, is getting rid of the too high level arrows in my ammo slot, as I cannot use them, and wont reload until they are gone, so catch 22.

Re: Selling high level items after class swap

Posted: Tue Oct 25, 2011 11:39 pm
by rock5
You can use EquipItem. All you have to do is equip an empty slot.

Code: Select all

local empty = inventory:findItem(0,"bags")
RoMScript("EquipItem(10,"..empty.BagId..")")
As for selling, do you know the names of the items you want to sell or do you want to just sell all pots and ammo with too high a level?

Re: Selling high level items after class swap

Posted: Wed Oct 26, 2011 4:23 pm
by imaginethat
Hi rock5
you make things so simple, thanks.
yes I want to sell pots and ammo that I was using, but now cant use due to just changing to the lower level class. character does not drop pots/ammo, and does not sell pots/ammo, and do not want to carry it around until the character levels a couple of levels. (bag space is precious)
So the thing I want to sell will be in covered in the "consumables.xml" file
Thanks

Re: Selling high level items after class swap

Posted: Wed Oct 26, 2011 7:38 pm
by rock5
You didn't really answer my question. Oh well. I'll just assume you want the harder solution of a general code that will sell any items above your level as apposed to a set list of items.

The only way I can see to sell them is to go through the steps of manually selling them. I can't see how we could get 'player:merchant' to do it. Of course you could also toss them.

Code: Select all

if player:openStore("npcname") then 
	yrest(500)

	for i = 61,120 do -- first 2 bags
		local item = inventory.BagSlot[i]
		if (item:isType("Potions") or item:isType("Arrows")) and
		   item.RequiredLvl > player.Level and item.Worth >= 1 then -- some items can't be sold
			item:use()
		end
	end
end
This is untested so test it with caution.

Re: Selling high level items after class swap

Posted: Thu Oct 27, 2011 6:58 pm
by imaginethat
Hi
I want to sell all pots/ammo that is too high a level to use.
The script you provided works perfectly, but I have added a bit to it to pick up Quivers, as they seem to have a Type of "Other"

I added this into the or part of the If statement

Code: Select all

(string.find(string.lower(item.Name),string.lower("Quiver")))
And works great
Thanks so much for your help