Skip to content

Item Functions

GET_ITEM(type, index)

Computes the global item ID from its category type and sub-index.

local bladeId = GET_ITEM(0, 18) -- Blade item

CGItemDropRecv(lpObj, slot, x, y, mode)

Simulates a player dropping an item from inventory to the ground.

  • Returns: boolean
CGItemDropRecv(player, 12, player.X, player.Y, false)

ItemGive(aIndex, specialValue)

Gives an item to the player using the ItemBag (DropTable) system.

  • Returns: boolean
ItemGive(aIndex, 100) -- Give item from ItemBag with special value 100

ItemGiveEx(aIndex, itemIndex, level, durability, opt1, opt2, opt3, newOpt, [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus], [duration], [harmonyExCount], [harmExOp1], [harmExVal1], [harmExOp2], [harmExVal2], [harmExOp3], [harmExVal3], [harmBonusOp], [harmBonusLvl])

Creates and gives a fully customized item to the player's inventory.

  • Returns: boolean

Harmony Ex Parameters (optional, available from version S21.1-2): - harmonyExCount (integer): Number of Harmony Ex options (0-3). Default: 0. - harmExOp1, harmExVal1 (integer): Harmony Ex option 1 type and value. - harmExOp2, harmExVal2 (integer): Harmony Ex option 2 type and value. - harmExOp3, harmExVal3 (integer): Harmony Ex option 3 type and value. - harmBonusOp, harmBonusLvl (integer): Harmony Bonus option and level.

-- Give a +9 Excellent Blade with Luck
ItemGiveEx(aIndex, GET_ITEM(0, 18), 9, 255, 0, 1, 7, 0x1C)

-- Give a timed item (1 hour = 3600 seconds)
ItemGiveEx(aIndex, GET_ITEM(13, 30), 0, 255, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 3600)

-- Give item with Harmony Ex options (3 options + bonus)
ItemGiveEx(aIndex, GET_ITEM(7, 413), 15, 0, 0, 1, 4, 63, 2, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 3, 9, 50, 11, 5, 12, 120, 3, 1000)

ItemDrop(aIndex, mapNumber, x, y, specialValue)

Drops an item on the ground using the ItemBag system.

  • Returns: boolean
ItemDrop(aIndex, player.Map, player.X, player.Y, 100)

ItemDropEx(aIndex, mapNumber, x, y, itemIndex, level, durability, opt1, opt2, opt3, newOpt, [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus], [duration], [ownerIndex])

Drops a fully customized item on the ground.

  • Returns: boolean
ItemDropEx(aIndex, player.Map, player.X, player.Y, GET_ITEM(0, 18), 9, 255, 0, 1, 7, 0x1C)

MoneyDrop(aIndex, mapNumber, x, y, amount)

Drops Zen on the ground.

  • Returns: boolean
MoneyDrop(aIndex, player.Map, player.X, player.Y, 50000)

GremoryGive(aIndex, itemIndex, level, dur, opt1, opt2, opt3, newOpt, storageType, rewardSource, daysToExpire, [duration], [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus])

Sends an item to the player's Gremory Case. Available from version S9 onwards.

WARNING: Do NOT call from OnCharacterEntry — Gremory data is not loaded yet. Use OnGremoryCaseReady instead.

  • Returns: boolean
-- Permanent item to character storage, 7-day expiry
GremoryGive(aIndex, GET_ITEM(14, 13), 0, 0, 0, 0, 0, 0,
    GREMORY_CASE_CHARACTER, GREMORY_REWARD_EVENT, GREMORY_EXPIRE_7_DAYS)

-- Timed item (24h) to account storage
GremoryGive(aIndex, GET_ITEM(14, 13), 0, 0, 0, 0, 0, 0,
    GREMORY_CASE_SERVER, GREMORY_REWARD_GM_REWARD, GREMORY_EXPIRE_30_DAYS, 86400)

CheckItemFromSpecialValue(specialValue)

Checks if an item exists in the ItemBag for the given special value (without giving it).

  • Returns: boolean
if CheckItemFromSpecialValue(100) then
    LogAdd(LOG_GREEN, "ItemBag 100 has a valid item.")
end

GetItemFromItemBag(aIndex, specialValue)

Gets an item from the ItemBag and sends it to the player's inventory.

  • Returns: boolean
if GetItemFromItemBag(aIndex, 100) then
    GCNoticeSend(aIndex, 1, "You received a reward!")
end

CharacterSkinSend(aIndex, monsterID)

Changes the player's visual appearance to a monster model. Use -1 to revert.

  • Returns: boolean
CharacterSkinSend(aIndex, 275) -- Transform into monster 275
CharacterSkinSend(aIndex, -1)  -- Revert to normal