• 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!

[LUA and OTHERS] - Functions and attributes

breispodeu

Mapper/Scripter/C++ Programmer
Joined
Jul 25, 2009
Messages
80
Reaction score
5
GitHub
lucasoares
Hi.. First sorry for my fuc#%@$ bad english xD

I have some questions, guys. Let's start with items:

Have some simple way to make items normally not-stackable to be stackable?
And usable? Not like foods, but like one rope for example. Well, you will understand..

Now with .lua functions:

Is there one function to copy all item attributes (name, attack, defense, armor, description, etc), making a copy and giving then to one player? I did that with functions like createItemEx, get's and set's of name, atk, etc.. And finally PlayerAddItemEx.. Have one more easy mode?

Very, very thanks.
Good night.
 
I don't really think that you want to stack items like that even if its posible (i'm not saying that it is im not sure).

About the copying item, ive been inactive so i dont know in this version but this function used to work in 1.0 you can try:

Code:
function doCopyItem(item, attributes)
    local attributes = attributes or false

    local ret = doCreateItemEx(item.itemid, item.type)
    if(attributes) then
        if(item.actionid > 0) then
            doSetItemActionId(ret, item.actionid)
        end
    end

    if(isContainer(item.uid) == TRUE) then
        for i = (getContainerSize(item.uid) - 1), 0, -1 do
            local tmp = getContainerItem(item.uid, i)
            if(tmp.itemid > 0) then
                doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)
            end
        end
    end

    return getThing(ret)
end
 
About the items you need to edit the OTB file on the sever and the DAT for the client.

Don't have any function to make possible to I use one ground in one item for example??? And I need to stack items to make my script easy =//
Change OTB make various consequences


I don't really think that you want to stack items like that even if its posible (i'm not saying that it is im not sure).

About the copying item, ive been inactive so i dont know in this version but this function used to work in 1.0 you can try:

Code:
function doCopyItem(item, attributes)
    local attributes = attributes or false

    local ret = doCreateItemEx(item.itemid, item.type)
    if(attributes) then
        if(item.actionid > 0) then
            doSetItemActionId(ret, item.actionid)
        end
    end

    if(isContainer(item.uid) == TRUE) then
        for i = (getContainerSize(item.uid) - 1), 0, -1 do
            local tmp = getContainerItem(item.uid, i)
            if(tmp.itemid > 0) then
                doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)
            end
        end
    end

    return getThing(ret)
end

Thanks to you both..
 
Last edited:
Back
Top