MadMOOK
Hoo
- Joined
- Apr 20, 2011
- Messages
- 802
- Reaction score
- 44
I need something like this...
Heres what I got but it says thing not found.. and the msg dont pop up on body xD lol
Heres what I got but it says thing not found.. and the msg dont pop up on body xD lol
Code:
local t = {
["energy guardian"] = {
rockPos = {x = 2039, y = 2044, z = 14, stackpos=1},
msg = "Noooo.." -- the message the monster says upon death
}
}
local function remove(position)
local k = getTileItemById(position, 1304).uid
return k > 0 and doRemoveItem(k), doSendMagicEffect(position, CONST_ME_POFF)
end
local function doSendAnimatedText(pos, text, color, cid)
if tonumber(text) then
text = tonumber(text)
if cid and isPlayer(cid) then
doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
else
local t = getSpectators(pos, 7, 5, false)
if t then
for _, cid in ipairs(t) do
if isPlayer(cid) then
doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, "", text, color, pos)
end
end
end
end
else
if cid and isCreature(cid) then
doCreatureSay(cid, text, TALKTYPE_MONSTER)
else
local t = getSpectators(pos, 7, 5, false)
if t then
for _, cid in ipairs(t) do
if isPlayer(cid) then
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, cid, pos)
end
end
end
end
end
end
function onKill(cid, target, damage, flags)
local v = t[string.lower(getCreatureName(target))]
if(v and (damage == true or bit.band(flags, 1) == 1) and isMonster(target)) then
doRemoveItem(getThingfromPos(rockpos).uid,1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The rock has been removed.")
addEvent(onTimer,1*60*1000)
end
return true
end
function onTimer()
doCreateItem(1304,1,{x = 2039, y = 2044, z = 14})
end