function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x ~= CONTAINER_POSITION) then
doSendMagicEffect(fromPosition, CONST_ME_CRAPS)
end
local value = math.random(5792, 5797)
doTransformItem(item.uid, value)
doCreatureSay(cid, getCreatureName(cid) .. ' rolled a ' .. value - 5791 .. '.', TALKTYPE_ORANGE_1)
return true
end
math.random(5792, 5797)
' .. value - 5791 .. '
math.random(1, 6)
' .. value .. '
You have to edit the transformitem code too, otherwise the dice look wouldn't change.i loled and wondered at the same time, why it is
andCode:math.random(5792, 5797)
hahaCode:' .. value - 5791 .. '
why not
andCode:math.random(1, 6)
Code:' .. value .. '
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
local dice = Item(item.uid)
local dicePosition = dice:getPosition()
local value = math.random(1, 6)
local isInGhostMode = player:isInGhostMode()
dicePosition:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player)
local spectators = Game.getSpectators(dicePosition, false, true, 3, 3)
for _, pid in ipairs(spectators) do
player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, pid, dicePosition)
end
dice:transform(5791 + value)
return true
end
ok, now i got itYou have to edit the transformitem code too, otherwise the dice look wouldn't change.
And this is how it is coded in TFS 1.0
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) local dice = Item(item.uid) local dicePosition = dice:getPosition() local value = math.random(1, 6) local isInGhostMode = player:isInGhostMode() dicePosition:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player) local spectators = Game.getSpectators(dicePosition, false, true, 3, 3) for _, pid in ipairs(spectators) do player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, pid, dicePosition) end dice:transform(5791 + value) return true end