Jump to content
Sign in to follow this  
Keuvyn T.

Create a Chest Lv 1-4 Gems

Recommended Posts

Hello Pkodev!

 

I've been researching but I could not find something that could give me this I want, could any one help me? How can I make a chest give Gems Lv1-4 as the following example:

 

Chest of Soul Package: Give Lv1, Lv2, Lv3 and Lv4 Gem of Soul and Lv1, Lv2, Lv3 and Lv4 Refining Gem. :scratch_one-s_head:

Share this post


Link to post
Share on other sites
-- [[
-- @function GiveGemSet
-- @param cha - target
-- @param gemid - the specified gem
-- @param gemlv - the level of the gem. (e.g: 4 would grant lv1-4 gems)
-- @param addref - flag to give refining gems. (true = give. false = dont give)
-- ]]
function GiveGemSet(cha, gemid, gemlv, addref)
    local checkgrid = GetChaFreeBagGridNum(cha)
    local needgrid = gemlv*2
    if checkgrid <= needgrid then
        SystemNotice(cha, 'Requires '..needgrid..' inventory slot. Failed to open Chest.')
        UseItemFailed(cha)
        return
    end

    for i = 1, gemlv do
        local lv = 100 + i
        GiveItem(cha, 0, gemid, 1, lv)
        if addref then
            GiveItem(cha, 0, 00885, 1, lv)
        end
    end
end

I did not test... so please test thoroughly =)

Usage:

function ItemUse_*(role, Item) GiveGemSet(role, 863, 4, true) end
  • Like 1

kong.png

a2.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...