Robson Dias
Member
This script allow you to grow flower pots like real tibia. I'm not the best LUA programmer but for me it works.
Flower Pot (https://tibia.fandom.com/wiki/Flower_Pot)
watering_can.lua
items.xml
------------ EDIT ----------------------
Each plant works this way:
You will get 7665 (flower pot) from rosemarie.
Each state/plant have 12% chance to upgrade to next state.
When you got plant 7670 and will be upgrading, it will transform into a random plant (first stage)
If not upgrade, will be transformed in "watered state", and you will need to wait 20 hours again to water it.
If you not water you plant in 5 days (last stage) or 20 hours (mid-stages), it will be transformed in "withered" state.
If your withered state plant not have been watered in 2 days, it will be transformed in 7655 (empty flower pot)
Thanks
Flower Pot (https://tibia.fandom.com/wiki/Flower_Pot)
watering_can.lua
Lua:
local Flowers = {
Withered = {
[7674] = 7681,
[7675] = 7683,
[7676] = 7685,
[7677] = 7687,
[9984] = 9989,
[9985] = 9991
},
Watered = {
7681, 7683, 7685, 7687,
7689, 7691, 7693, 7695,
9983, 9987, 9989, 9991,
7678
},
Watering = {
[7680] = 7681,
[7682] = 7683,
[7684] = 7685,
[7686] = 7687,
[7688] = 7689,
[7690] = 7691,
[7692] = 7693,
[7694] = 7695,
[9982] = 9983,
[9986] = 9987,
[9988] = 9989,
[9990] = 9991,
[7670] = 7678,
[7655] = 7678
},
Upgrading = {
[7670] = {
7681, 7683, 7685, 7687,
9983, 9987
},
[7680] = 7688,
[7682] = 7691,
[7684] = 7693,
[7686] = 7695,
[9982] = 9991,
[9986] = 9989
}
}
function onUse( player, item, fromPosition, target, toPosition, isHotkey )
if isInArray( Flowers.Watered, target:getId() ) then
player:say( "Your plant doesn't need water.", TALKTYPE_MONSTER_SAY )
return true
end
local withered = Flowers.Withered[ target:getId() ]
if withered then
player:say( "You finally remembered to water your plant and it recovered.", TALKTYPE_MONSTER_SAY )
target:transform( withered )
target:decay()
return true
end
local upgrading = Flowers.Upgrading[ target:getId() ]
if upgrading and math.random( 100 ) < 12 then
if target:getId() ~= 7670 then
player:updateAchievemement( 61 ) -- Green Thumb
end
player:say( "Your plant has grown to the next stage!", TALKTYPE_MONSTER_SAY )
target:transform( ( type( upgrading ) ~= nil and type( upgrading ) == "table" ) and upgrading[ math.random( #upgrading ) ] or upgrading )
target:decay()
return true
end
local watering = Flowers.Watering[ target:getId() ]
if watering then
player:say( "You watered your plant.", TALKTYPE_MONSTER_SAY )
target:transform( watering )
target:decay()
return true
end
return true
end
items.xml
XML:
<item id="7655" article="a" name="empty flower pot">
<attribute key="description" value="Nothing is planted in there." />
<attribute key="weight" value="150" />
</item>
<item id="7665" article="a" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7655" />
<attribute key="duration" value="172800" />
</item>
<item id="7670" article="a" name="flower pot">
<attribute key="description" value="The plant in there sprouted, but only gardeners might recognise what it will develop into." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7655" />
<attribute key="duration" value="72000" />
</item>
<item id="7673" article="a" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet." />
<attribute key="weight" value="150" />
</item>
<item fromid="7674" toid="7677" article="a" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7655" />
<attribute key="duration" value="172800" />
</item>
<item id="7678" article="a" name="flower pot">
<attribute key="description" value="The plant in there sprouted, but only gardeners might recognise what it will develop into." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7670" />
<attribute key="duration" value="72000" />
</item>
<item id="7679" article="a" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7665" />
<attribute key="duration" value="72000" />
</item>
<item id="7680" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a lizard tongue fern." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7674" />
<attribute key="duration" value="72000" />
</item>
<item id="7681" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a lizard tongue fern." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7680" />
<attribute key="duration" value="72000" />
</item>
<item id="7682" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a dryad's heart flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7675" />
<attribute key="duration" value="72000" />
</item>
<item id="7683" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a dryad's heart flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7682" />
<attribute key="duration" value="72000" />
</item>
<item id="7684" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a midnight bloom flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7676" />
<attribute key="duration" value="72000" />
</item>
<item id="7685" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a midnight bloom flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7684" />
<attribute key="duration" value="72000" />
</item>
<item id="7686" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be an ember queen flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7677" />
<attribute key="duration" value="72000" />
</item>
<item id="7687" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be an ember queen flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7686" />
<attribute key="duration" value="72000" />
</item>
<item id="7688" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown lizard tongue plant in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7674" />
<attribute key="duration" value="432000" />
</item>
<item id="7689" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown lizard tongue plant in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7688" />
<attribute key="duration" value="72000" />
</item>
<item id="7690" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown dryad's heart flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7675" />
<attribute key="duration" value="432000" />
</item>
<item id="7691" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown dryad's heart flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7690" />
<attribute key="duration" value="72000" />
</item>
<item id="7692" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown midnight bloom flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7676" />
<attribute key="duration" value="432000" />
</item>
<item id="7693" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown midnight bloom flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7692" />
<attribute key="duration" value="72000" />
</item>
<item id="7694" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown ember queen flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7677" />
<attribute key="duration" value="432000" />
</item>
<item id="7695" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown ember queen flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7694" />
<attribute key="duration" value="72000" />
</item>
<item id="9982" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a finger snapper plant." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9984" />
<attribute key="duration" value="432000" />
</item>
<item id="9983" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a finger snapper plant." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9982" />
<attribute key="duration" value="72000" />
</item>
<item fromid="9984" toid="9985" article="a" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="7655" />
<attribute key="duration" value="172800" />
</item>
<item id="9986" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a fairy dancer flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9985" />
<attribute key="duration" value="432000" />
</item>
<item id="9987" article="a" name="flower pot">
<attribute key="description" value="The plant in it seems to be a fairy dancer flower." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9986" />
<attribute key="duration" value="72000" />
</item>
<item id="9988" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown fairy dancer flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9985" />
<attribute key="duration" value="432000" />
</item>
<item id="9989" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown fairy dancer flower in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9988" />
<attribute key="duration" value="72000" />
</item>
<item id="9990" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown finger snapper plant in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9984" />
<attribute key="duration" value="432000" />
</item>
<item id="9991" article="a" name="flower pot">
<attribute key="description" value="There is a fully grown finger snapper plant in it." />
<attribute key="weight" value="150" />
<attribute key="decayTo" value="9990" />
<attribute key="duration" value="72000" />
</item>
------------ EDIT ----------------------
Each plant works this way:
You will get 7665 (flower pot) from rosemarie.
Each state/plant have 12% chance to upgrade to next state.
When you got plant 7670 and will be upgrading, it will transform into a random plant (first stage)
If not upgrade, will be transformed in "watered state", and you will need to wait 20 hours again to water it.
If you not water you plant in 5 days (last stage) or 20 hours (mid-stages), it will be transformed in "withered" state.
If your withered state plant not have been watered in 2 days, it will be transformed in 7655 (empty flower pot)
Thanks
Last edited: