Hello someone can explain me how to block 354, 355 id grounds ? If i set action id: 100 on RME then pick shut work, not every hole... And second problem is in code in chance to give money, small diamonds - its possible to delete everything ?
Thank you for any help.
Gyazo Screen Video
gyazo.com
Lua:
local groundIds = {354, 355}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target.itemid == 11227 then -- shiny stone refining
local chance = math.random(1, 100)
if chance == 1 then
player:addItem(ITEM_CRYSTAL_COIN) -- 1% chance of getting crystal coin
elseif chance <= 6 then
player:addItem(ITEM_GOLD_COIN) -- 5% chance of getting gold coin
elseif chance <= 51 then
player:addItem(ITEM_PLATINUM_COIN) -- 45% chance of getting platinum coin
else
player:addItem(2145) -- 49% chance of getting small diamond
end
target:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
target:remove(1)
return true
end
local tile = Tile(toPosition)
if not tile then
return false
end
local ground = tile:getGround()
if not ground then
return false
end
if (ground.uid > 65535 or ground.actionid == 0) and not table.contains(groundIds, ground.itemid) then
return false
end
ground:transform(392)
ground:decay()
toPosition.z = toPosition.z + 1
tile:relocateTo(toPosition)
return true
end
Thank you for any help.