I was bored so I decided to do an actionscript for the flower pots, so first, the scripts, then the explaining part.
Add this in items.xml:
Now, add this to movements.xml
And create a file in movements/scripts called seeds.lua with this:
Now, add this to actions.xml
And finally, create a file in actions/scripts called flowerpot.lua with this:
So this is how it works:
1.- You get a flower pot, from an npc or however you want.
2.- You get seeds, some monsters drop it.
3.- You put the flower pot on the ground
4.- You throw the seeds on the flower pot.
5.- Now water the flower pot.
6.- You have to wait 24h till you can water it again
7.- Now, when you water again, you have a CHANCE% of the pot advancing to the next stadium(you can edit CHANCE in flowerpot.lua).
Wheter it advances or not, you cannot water again in 24h.
8.- When it reaches the final stadium, you don't need to water it daily, however, if you don't water it in 3 days it will turn into a whitered plant.
If you water it, the 3 days counter will reset.
9.- If it turns into a whitered day, you have 1 day to water it so it recovers, or it will dissapear completly.
And that's it!
Hope you like it.
I didn't test the decays, but I tested the actions
I know it can be made shorter, but belive me, the first "draft" was waaaay longer.
(Rep if you like it)
Add this in items.xml:
Code:
<item id="7655" name="flower pot">
<attribute key="description" value="You should try planting some seeds."/>
<attribute key="weight" value="150"/>
</item>
<item id="7665" 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 id="7670" 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="7678"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7673" 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="7679"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7674" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7675" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7676" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7677" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7678" 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"/>
</item>
<item id="7679" 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 id="7680" 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="7681"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7681" name="flower pot">
<attribute key="description" value="The plant in it seems to be a lizard tongue fern."/>
<attribute key="weight" value="150"/>
</item>
<item id="7682" 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="7683"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7683" name="flower pot">
<attribute key="description" value="The plant in it seems to be a dryad's heart flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7684" 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="7685"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7685" name="flower pot">
<attribute key="description" value="The plant in it seems to be a midnight bloom flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7686" 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="7687"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7687" name="flower pot">
<attribute key="description" value="The plant in it seems to be an ember queen flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7688" 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="7689"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7689" 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="259200"/>
</item>
<item id="7690" 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="7691"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7691" 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="259200"/>
</item>
<item id="7692" 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="7693"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7693" 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="259200"/>
</item>
<item id="7694" 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="7695"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7695" 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="259200"/>
</item>
<item id="9982" 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="9983"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9983" name="flower pot">
<attribute key="description" value="The plant in it seems to be an finger snapper plant."/>
<attribute key="weight" value="150"/>
</item>
<item id="9984" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9985" 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="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9986" name="flower pot">
<attribute key="description" value="The plant in it seems to be a fairy dance flower."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="9987"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9987" name="flower pot">
<attribute key="description" value="The plant in it seems to be an fairy dance flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="9988" name="flower pot">
<attribute key="description" value="There is a fully grown fairy dance flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="9989"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9989" name="flower pot">
<attribute key="description" value="There is a fully grown fairy dance flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="9985"/>
<attribute key="duration" value="259200"/>
</item>
<item id="9990" 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="9991"/>
<attribute key="duration" value="86400"/>
</item>
<item id="9991" 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="259200"/>
</item>
Now, add this to movements.xml
Code:
<movevent event="AddItem" tileitem="1" itemid="7655" event="script" value="seeds.lua" />
And create a file in movements/scripts called seeds.lua with this:
Code:
function onAddItem(moveitem, tileitem, position)
if tileitem.itemid == 7655 then
doRemoveItem(moveitem.uid,1)
doTransformItem(tileitem.uid,tileitem.itemid+10)
doSendMagicEffect(position,CONST_ME_MAGIC_BLUE)
end
return 1
end
Now, add this to actions.xml
Code:
<action itemid="7734" event="script" value="flowerpot.lua" />
And finally, create a file in actions/scripts called flowerpot.lua with this:
Code:
local CHANCES = 50 --Chances of advancing to the next stadium
local WATERINGCAN_ID = 7734
local WATERED = {7673, 7670, 7680, 7682, 7684, 7686, 7688, 7690, 7992, 7994, 9982, 9990, 9986, 9988} --Plants that don't need water...for the moment
local PLANTSPECIES = {7680, 7682, 7684, 7686, 9982, 9986} --The first time the plant type will be recognizable
local PLANTADVANCES = {[7679] = {7670, 7673}, [7681] = {7688, 7680}, [7683] = {7690, 7682}, [7685] = {7692, 7684}, [7687] = {7694, 7686}, [9983] = {9990, 9982}, [9987] = {9988, 9986}} --In what will it transforms to if it advances or not
local LASTSTADIUM = {7689, 7691, 7693, 7695, 9991, 9989} --When you water this plant's, they don't change, but the time remaining for them to dry resets
local WHITEREDPLANTS = {[7674] = 7688, [7675] = 7690, [7676] = 7692, [7677] = 7694, [9984] = 9990, [9985] = 9988} --Whitered plants Id's and the plant's they will become when recovered
function onUse(cid, item, fromPosition, itemEx, toPosition)
local RANDOM = math.random(100)
if WHITEREDPLANTS[itemEx.itemid] ~= nil then
doCreatureSay(cid,"You finally remembered to water your plant and it recovered.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,WHITEREDPLANTS[itemEx.itemid])
elseif itemEx.itemid == 7655 then
doCreatureSay(cid,"You should plant some seeds first.",TALKTYPE_ORANGE_1)
elseif itemEx.itemid == 7665 then
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid+8)
elseif isInArray(WATERED,itemEx.itemid) == TRUE then
doCreatureSay(cid,"Your plant doesn't need water.",TALKTYPE_ORANGE_1)
elseif PLANTADVANCES[itemEx.itemid] ~= nil then
if RANDOM <= CHANCES then
doTransformItem(itemEx.uid,PLANTADVANCES[itemEx.itemid][1])
doCreatureSay(cid,"Your plant has grown to the next stage!",TALKTYPE_ORANGE_1)
else
doTransformItem(itemEx.uid,PLANTADVANCES[itemEx.itemid][2])
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
end
elseif itemEx.itemid == 7678 then
if RANDOM <= CHANCES then
doCreatureSay(cid,"Your plant has grown to the next stage!",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,PLANTSPECIES[math.random(4)])
else
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid-8)
end
elseif isInArray(LASTSTADIUM, itemEx.itemid) == TRUE then
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid-1)
end
doDecayItem(itemEx.uid)
return TRUE
end
So this is how it works:
1.- You get a flower pot, from an npc or however you want.
2.- You get seeds, some monsters drop it.
3.- You put the flower pot on the ground
4.- You throw the seeds on the flower pot.
5.- Now water the flower pot.
6.- You have to wait 24h till you can water it again
7.- Now, when you water again, you have a CHANCE% of the pot advancing to the next stadium(you can edit CHANCE in flowerpot.lua).
Wheter it advances or not, you cannot water again in 24h.
8.- When it reaches the final stadium, you don't need to water it daily, however, if you don't water it in 3 days it will turn into a whitered plant.
If you water it, the 3 days counter will reset.
9.- If it turns into a whitered day, you have 1 day to water it so it recovers, or it will dissapear completly.
And that's it!
Hope you like it.
I didn't test the decays, but I tested the actions
I know it can be made shorter, but belive me, the first "draft" was waaaay longer.
(Rep if you like it)
Last edited: