Lua Blueberry bush system remake problem

AdiMit

c(;
Joined
May 2, 2016
Messages
70
Best answers
2
Reaction score
3
Hello dear OtLanders, ;)

I'm currently using the [8.60] The Forgotten Server 0.3.6 (Crying Damson) V8 by Printer, from the thread: [8.60] The Forgotten Server 0.3.6 (Crying Damson) V8;

I've been recently wanting to remake various fruit bushes/trees so that they would work the same way blueberry bushes do...
The only problem is that they do not decay back to the unharvested form (e.g. 5156->5157); however, it is not the case for the blueberry bushes, which work alright.
I've remade quite a few ones (banana, plum, mango trees, etc.), but I'll just post the mango example, because the only difference in the scripts is the respective ID.

0) ...\data\actions\scripts\other\blueberrybush.lua: <-- the one I have based the rest of the scripts on.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doCreateItem(2677, 3, fromPosition)
    doTransformItem(item.uid, 2786)

    doDecayItem(item.uid)
    return true
end

1) ...\data\actions\scripts\other\mangotree.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doCreateItem(5097, 3, fromPosition)
    doTransformItem(item.uid, 5156)

    doDecayItem(item.uid)
    return true
end

2) ...\data\actions\actions.xml:
Lua:
...
<action itemid="2785" event="script" value="other/blueberrybush.lua"/>
<action itemid="5157" event="script" value="other/mangotree.lua"/>
...

Once again, everything except the plant decaying back to the original ID works just right.
If you have any ideas how to fix this little issue, I'd be more than happy to try them out!
Thank you in advance!

Best regards,
 

Fermantor

Member
Joined
Dec 16, 2009
Messages
186
Best answers
2
Reaction score
23
Location
Germany
The itemid a item decays back to is set in the items.xml
If your item don't have the attribute there, it won't decay to the unharvested form ever
It looks something like this
XML:
<item id="xxxx" name="blabla bush">
     <attribute decayTo="xxxx"/>
     <attribute duration="60"/> <!-- 1 Minute Delay -->
</item>
But be carefull with changing it in the global items.xml as every item placed on the map will decay to the unharvested itemid then.
 
OP
AdiMit

AdiMit

c(;
Joined
May 2, 2016
Messages
70
Best answers
2
Reaction score
3
The itemid a item decays back to is set in the items.xml
If your item don't have the attribute there, it won't decay to the unharvested form ever
It looks something like this
XML:
<item id="xxxx" name="blabla bush">
     <attribute decayTo="xxxx"/>
     <attribute duration="60"/> <!-- 1 Minute Delay -->
</item>
But be carefull with changing it in the global items.xml as every item placed on the map will decay to the unharvested itemid then.
Thank you kindly!
I wonder how could I have missed that (checking items.xml) ...well, it seems that the most obvious things are the easiest ones to overlook :p
 
Top