Master Filip
New Member
- Joined
- May 15, 2009
- Messages
- 27
- Reaction score
- 0
Hiho. I want to do script, where player must mine item 8635. If he do it excellent he will mine red crystal (9369), elseif he do it wrong - crystal break to 8639. After some time, this crushed crystal may change back to 8635. I want to do it in second function (addEvent), but script can't find itemEx(8639).
This is script:
That is script of normal pick and my addons.
This is script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(itemEx.itemid == 7200) then
doTransformItem(itemEx.uid, 7236)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
return true
end
lose = "You totally break the crystal."
win = "You succesfully mined a red crystal. Hurry up and go to Myuki."
if (itemEx.itemid == 8635) and getPlayerStorageValue(cid, 19101) >= 0 then
if math.random(1, 20) > 19 then
doPlayerAddItem(cid, 9369, 1)
setPlayerStorageValue(cid, 19102,1)
doCreatureSay(cid, win, MESSAGE_EVENT_ORANGE,{x = 1899, y = 2028, z = 8}) -- that position don't matter
elseif math.random(1, 20) < 19 then
doCreatureSay(cid, lose, MESSAGE_EVENT_ORANGE,{x = 1899, y = 2028, z = 8}) -- that position don't matter
doTransformItem(itemEx.uid, 8639)
addEvent(back, 500)
end
end
return false
end
function back(itemEx, item)
if getThingPos(itemid.itemEx) then
doTransformItem(itemEx.uid, 8635)
end
return true
end