PDA

View Full Version : Rust remover



royston
06-16-2016, 11:43 AM
Hello,

Since Vampire brides loot Rusty armors. Is it possible to take rustremovers in my backpack and use them on it while looted?

It has to pickup items that are worth something if it turns f.e. in a knight armor. And drop if its a chain armor or what ever.

Trykon
06-16-2016, 11:45 AM
This is rather hard... would ve better to pick up rusty items and drop them if those are shit ;) if you would like that kind of function I can write it for you

royston
06-16-2016, 11:54 AM
Well it is fine if it picks up the rusty armor and after that it uses the rust remover. so it goes like this


Pick up rust remover > ITEM valueable yes > keep item // item valueable no > drop item

is this possible?

Trykon
06-16-2016, 09:47 PM
Well it is fine if it picks up the rusty armor and after that it uses the rust remover. so it goes like this


Pick up rust remover > ITEM valueable yes > keep item // item valueable no > drop item

is this possible?

yup... I will write it tomorrow :) and post it here, or write to you in pm

Trykon
06-17-2016, 11:00 AM
Withdraw rusty removers to mainBP and loot rusted items to mainBP. Also add keepItemList to looter because otherwise built in xenobot depositer won't deposit those items to dp.

local indexOfMainBackpack = 0 -- Name, index or id of container
local indexOfLootBackpack = 1 -- Name, index or id of container
local rustRemover = "flask of rust remover"
local rustyItemList = {8894, 8895, 8896, 8897, 8898, 8899}
local keepItemList = {"knight armor", "crown armor", "golden armor", "paladin armor", "knight legs", "crown legs", "golden legs"}
local trashItemList = {"chain armor", "scale armor", "brass armor", "plate armor", "studded legs", "chain legs", "brass legs", "plate legs"}


--[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]]--

function isMonsterBody(name)
local monsterBodyNames = {"The", "Demonic", "Dead", "Slain", "Dissolved", "Remains", "Elemental", "Split"}
for _, element in ipairs(monsterBodyNames) do
if name:find(element) then
return true
end
end
return false
end

Module.New("unrusters", function()
local _rustRemoverSlot = nil
local _rustyItemListlot = nil

local mainBP = Container.New(indexOfMainBackpack)
local loopBP = Container.New(indexOfLootBackpack)

if (mainBP:Index() == loopBP:Index() and mainBP:Index() > 0 and loopBP:Index() > 0) then
print("MAIN AND LOOT BP MUST BE OTHER CONTAINERS")
return
end

if (not isMonsterBody(mainBP:Name())) then
for slot, item in mainBP:iItems() do
if (item.id == Item.GetItemIDFromDualInput(rustRemover) and _rustRemoverSlot == nil) then
_rustRemoverSlot = slot
end

if (table.contains(rustyItemList, item.id) and _rustyItemListlot == nil) then
_rustyItemListlot = slot
end

if (_rustRemoverSlot and _rustyItemListlot) then
mainBP:UseItemWithContainerItem(_rustRemoverSlot, mainBP, _rustyItemListlot)
break
end
end
end

for slot, item in mainBP:iItems() do
if (table.find(keepItemList, Item.GetItemNameFromDualInput(item.id))) then
mainBP:MoveItemToContainer(slot, loopBP:Index(), loopBP:ItemCapacity()-1)
break
end

if (table.find(trashItemList, Item.GetItemNameFromDualInput(item.id))) then
mainBP:MoveItemToGround(slot, Self.Position().x, Self.Position().y, Self.Position().z)
break
end
end
end)

enjoy

betoxz
06-17-2016, 05:02 PM
OMG! THANKS MAN

spider706
04-27-2017, 03:25 AM
help me with this script i can't get it to work please