• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Machete + Heavy Machete won't cut through Jungle Grass

auda

Advanced OT User
Joined
Jun 29, 2014
Messages
273
Reaction score
233
Location
Sweden
It keeps saying "You can not use this object."

Scripts:
Code:
function onUse(cid, item, frompos, item2, topos)
    if (isInArray(JUNGLE_GRASS_REMOVE, item2.itemid) == TRUE) then
        doRemoveItem(item2.uid)
        return TRUE
       
    elseif (isInArray(JUNGLE_GRASS_TRANSFORM, item2.itemid) == TRUE) then
        doTransformItem(item2.uid, item2.itemid - 1)
        doDecayItem(item2.uid)
        return TRUE
       
    elseif (isInArray(SPIDER_WEB, item2.itemid) == TRUE) then
        doTransformItem(item2.uid, item2.itemid + 6)
        doDecayItem(item2.uid)
        return TRUE
    end
   
    return FALSE
end

Code:
    <action itemid="2420" script="machete.lua"/>
    <action itemid="2442" script="machete.lua"/>

In the lib/actions.lua:
Code:
JUNGLE_GRASS = 2782

I can't seem to find an error. I thought that if I remove the "_REMOVE" right after JUNGLE_GRASS in the script it might have worked but I have no idea!
 
Are the jungle grass ids added to those tables?

Oh, do you mean in the regular actions.lua? I didn't know that I had to have the jungle grass in there. For example: "<action itemid="2782" script="machete.lua"/> ???

Those two lines are not included in the lib/actions. Should they be added with the same item id as JUNGE_GRASS = 2782 ?
 
Look for the tables JUNGLE_GRASS_REMOVE and JUNGLE_GRASS_TRANSFORM.
Then add the jungle grass ids there. In JUNGLE_GRASS_REMOVE the ones that should be removed, in JUNGLE_GRASS_TRANSFORM the ones that should be transformed.

If you don't have the tables (that will give an error in your console), add them.
 
I added those lines in the lib/actions like this:
Code:
JUNGLE_GRASS = 2782
JUNGLE_GRASS_REMOVE = 2782
JUNGLE_GRASS_TRANSFORM = 2781
(2781 is the already cutted down junbgle grass, don't know if that's correct though)

Nothing happens except it keeps saying "You can not use this object".

They have been added without success, didn't even get error in the console without those tabels...
 
Last edited by a moderator:
Add it inside a table.
Code:
JUNGLE_GRASS_TRANSFORM = {2782}

If you get errors, post them.

It works! No errors.
I added both REMOVE and TRANSFORM like this:

Code:
JUNGLE_GRASS_REMOVE = {
    2782
}

JUNGLE_GRASS_TRANSFORM = {
    2782
}

But as soon as I cut it down it removes completely, when it is supposed to become jungle grass id 2781 which is cutted down. Thanks for the help by the way!

I removed the "REMOVE" line and it now works - just as you said. Does the script include that it will decay back to the tall grass within x seconds? :)
 
Don't add it to the JUNGLE_GRASS_REMOVE table, only JUNGLE_GRASS_TRANSFORM.
Items that are added to the JUNGLE_GRASS_REMOVE table will be removed when you use machete on them, items in the JUNGLE_GRASS_TRANSFORM table will be transformed to itemid - 1.

The transform back is added in items.xml.
 
Don't add it to the JUNGLE_GRASS_REMOVE table, only JUNGLE_GRASS_TRANSFORM.
Items that are added to the JUNGLE_GRASS_REMOVE table will be removed when you use machete on them, items in the JUNGLE_GRASS_TRANSFORM table will be transformed to itemid - 1.

The transform back is added in items.xml.

Looked it up and found it. Also witnessed it ingame! Thank you so much Limos. Always helping!
 
Back
Top