Ratser
Retired // Making time for yoloswagmod
- Joined
- Feb 11, 2009
- Messages
- 482
- Reaction score
- 36
Ok, so...I was trying to create a script for The Shield Nevermourn according to its current action in Global but I've been having some errors in console:
[Explanation]
Since itemid="10318" and itemid="10364" are both the same item I'm trying to transform 10318 to 10364 AFTER 2 seconds (I'm using 2 seconds only to test) [addEvent(onTime, 2000, a)], inmediately after it transforms it has to say a random sound from 'local SOUNDS' (it has to work ONLY if the itemid is 10364). Finally, it inmediately decays back to 10318.
Code:
[16/07/2010 11:17:09] [Error - Action Interface]
[16/07/2010 11:17:09] In a timer event called from:
[16/07/2010 11:17:09] data/actions/scripts/other/theshieldnevermourn.lua:onUse
[16/07/2010 11:17:09] Description:
[16/07/2010 11:17:09] data/actions/scripts/other/theshieldnevermourn.lua:11: attempt to index global 'item' (a nil value)
[16/07/2010 11:17:09] stack traceback:
[16/07/2010 11:17:09] data/actions/scripts/other/theshieldnevermourn.lua:11: in function <data/actions/scripts/other/theshieldnevermourn.lua:10>
Since itemid="10318" and itemid="10364" are both the same item I'm trying to transform 10318 to 10364 AFTER 2 seconds (I'm using 2 seconds only to test) [addEvent(onTime, 2000, a)], inmediately after it transforms it has to say a random sound from 'local SOUNDS' (it has to work ONLY if the itemid is 10364). Finally, it inmediately decays back to 10318.
Code:
local SOUNDS = {"Servant! Please call me a coach. - Yes, sir. You are a coach!", "Did your father help you do your homework? No, he did it all by himself.", "If big elephants have big trunks, do small elephants have suitcases?", "Do you want to hear a dirty joke ? A white horse fell in the mud.", "What do you call a deer with no eyes ? - I have no I-Deer!", "My friend said he knew a man with a wooden leg called Sam. So I asked him 'What was the name of his other leg?'", "Did you hear about the Lich who walked into frodo's bar? He ordered a cup of beer and a mup.", "If whistles are made of tin, what are fog horns made of?"}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 10318 then
addEvent(onTime, 2000, a)
end
return true
end
function onTime(a)
doTransformItem(item.uid, 10364)
doDecayItem(item.uid)
if(doTransformItem(item.uid, 10364)) then
local random = math.random(1, table.maxn(SOUNDS))
if(fromPosition.x ~= CONTAINER_POSITION) then
doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER, false, 0,
fromPosition)
else
doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER)
end
end
return true
end
Last edited: