• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Use bucket in water elemental and get water

Misterion

New Member
Joined
Jan 24, 2014
Messages
52
Reaction score
4
So, I wish to make a system where I use an item on a creature and I get this item full of water, like a bucket in a water elemental, for example, or a bucket in a wolf where I get his milk.

But all I can do is use item on non creature objects. How am I supposed to use an item on a creature? And which function would be to change the empty bucket to a full of water bucket?

THE FORGOTTEN SERVER 8.6 0.3.6
 
Solution
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    local source = {
        ["water elemental"] = {value = 1},
        ["vampire"] = {value = 2},
    }
   
    local v = source[getCreatureName(itemEx.uid):lower()]

    if itemEx.uid == getCreatureByName(v) and isMonster(itemEx.uid) and item.type < 1 then
        doChangeTypeItem(item.uid, v.value)
    end
   
    return true
end
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    local source = {
        ["water elemental"] = {value = 1},
        ["vampire"] = {value = 2},
    }
   
    local v = source[getCreatureName(itemEx.uid):lower()]

    if itemEx.uid == getCreatureByName(v) and isMonster(itemEx.uid) and item.type < 1 then
        doChangeTypeItem(item.uid, v.value)
    end
   
    return true
end
 
Solution
Back
Top