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

Lua buy items with added aid

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi, i need to know how to add action id (aid 1443) and charges to an item exchanged or bought to NPC. Example, adding action id to:
Lua:
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
                selfSay(done, cid)
doPlayerAddItem(cid,2376) ----- add action id 1443 and 100 to item charges here ----
end

or something like

Lua:
        <parameter key="shop_buyable" value="
            training sword,2376,1000;    --- add action id 1443 and 100 charges for the item ---

i'm using tfs 0.4
thanks in advance!!
regards
 
I made it work using this
Lua:
if getPlayerItemCount(cid,5879) >= 10 then
            if doPlayerRemoveItem(cid,5879, 10) == TRUE then
                            selfSay(done, cid)
            doItemSetAttribute(doPlayerAddItem(cid, 2376, 1, 200), "aid", 1443)
            end

but i still dont know how to add item charges, it gives the sword but has 1 charge (also edited 100 charges at item.xml), how it can be done?
 
You need to add charges to the item in otbeditor so it can stack. However this will make all items with the id 2376 stack, even without the action id.
Dont know how well this works with action id attached to a stackable item, or you can try using aid 1443-1543 and decrease the aid for every use, and attach an on look function to display charges or something.

Or simply use a stackable item to begin with
 
Last edited:
Last edited:
Back
Top