I'm trying to make like rl tibia, so you can use crystal sword on chest to get goolem wrench.
as it working now, It removes the chest on fail/succeed.
I want the chest to stay. so only the crystal sword (7449) only get removed
@Sarah Wesker You are like number 1 in this, You got a clue?
as it working now, It removes the chest on fail/succeed.
I want the chest to stay. so only the crystal sword (7449) only get removed
Lua:
------------
-- Alternative to no-magic style.
-- Description here
----
---- string of mending id "7449"-----
local ITEMS = {
[21385] = {
{"golem wrench", 10.10} -----
}
}
local stringOfMending = Action()
---- onUse [opt]
-- @param cid Player ID
-- @param item Item ID
-- @param fromPosition Current Position
-- @param[opt] itemEx Item change
-- @param[opt] toPosition Nem position
function stringOfMending.onUse(cid, item, fromPosition, itemEx, toPosition)
local cadena = ITEMS[itemEx.itemid]
if cadena == nil then
return false
end
local iEx = Item(itemEx.uid)
local random, chance = math.random() * 100, 0
for i = 1, #cadena do
chance = chance + cadena[i][2]
if random <= chance then
iEx:transform(cadena[i][1])
iEx:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
Item(item.uid):remove(1)
return true
end
end
iEx:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
Item(item.uid):remove(1)
iEx:remove()
doCreatureSay(cid, "10% chance, the item was broken.", TALKTYPE_ORANGE_1)
return true
end
stringOfMending:id(7449)
stringOfMending:register()
Post automatically merged:
@Sarah Wesker You are like number 1 in this, You got a clue?
Last edited: