Since I couldn't find a watering can that works like Tibia I thought I would try and make a script for it.But I've run into a problem. When it gets to my third dotransformitem line it just goes back to the second one so it ends up just making pot id 7670 and 7678 over and over again. There are no errors in console. I'm using mystic spirit v0.2.14.
This is hopefully how it's suppose to look.
Here's the spot where just repeats itself. Makes 7678 then instead of getting an ID from firstBloom it just makes 7670 again.
I'm pretty sure it's this line
I'm not sure i have my brackets and things in the right spots. I can't script to save my life it seems.
And it needs to pick one of the id's from firstBloom randomly since those are the beginning bloom of a flower (i.e. Dryad's Heart, Ember Queen, etc.)
The rest I'm still working out. pretty sure the isinarray things aren't gonna work either. But I tested the script with those lines removed and all but the firstBloom and it was the same thing so they are not my problem right now.
Any tips or advice would be great thanks.
This is hopefully how it's suppose to look.
Code:
local firstBloom = {
[1] = {7680},
[2] = {7682},
[3] = {7684},
[4] = {7686}
}
local dryadBloom = {
[1] = {7683},
[2] = {7690},
[3] = {7691},
[4] = {15446}
}
local lizardBloom = {
[1] = {7681},
[2] = {7688},
[3] = {7689},
[4] = {15445}
}
local midnightBloom = {
[1] = {7685},
[2] = {7692},
[3] = {7693},
[4] = {15448}
}
local emberBloom = {
[1] = {7687},
[2] = {7694},
[3] = {7695},
[4] = {15447}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 7655 or 7665 or 7673 then
doTransformItem(getThingfromPos(toPosition).uid, 7670)
end
if itemEx.itemid == 7670 then
doTransformItem(getThingfromPos(toPosition).uid, 7678)
end
if item.itemid == 7678 then
doTransformItem(getThingfromPos(toPosition).uid, firstBloom[math.random(4)])
end
if isInArray(firstBloom, 1) then
doTransformItem(uid, dryadBloom[1])
end
if isInArray(firstBloom, 2) then
doTransformItem(uid, lizardBloom[1])
end
if isInArray(firstBloom, 3) then
doTransformItem(uid, midnightBloom[1])
end
if isInArray(firstBloom, 4) then
doTransformItem(uid, emberBloom[1])
end
return TRUE
end
Here's the spot where just repeats itself. Makes 7678 then instead of getting an ID from firstBloom it just makes 7670 again.
Code:
if itemEx.itemid == 7670 then
doTransformItem(getThingfromPos(toPosition).uid, 7678)
end
if item.itemid == 7678 then
doTransformItem(getThingfromPos(toPosition).uid, firstBloom[math.random(4)])
I'm pretty sure it's this line
Code:
doTransformItem(getThingfromPos(toPosition).uid, firstBloom[math.random(4)])
I'm not sure i have my brackets and things in the right spots. I can't script to save my life it seems.
And it needs to pick one of the id's from firstBloom randomly since those are the beginning bloom of a flower (i.e. Dryad's Heart, Ember Queen, etc.)
The rest I'm still working out. pretty sure the isinarray things aren't gonna work either. But I tested the script with those lines removed and all but the firstBloom and it was the same thing so they are not my problem right now.
Any tips or advice would be great thanks.
Last edited by a moderator: