Mera Mero
Guess Who?
- Joined
- Dec 27, 2014
- Messages
- 417
- Reaction score
- 86
Hi otlanders i've got problem with script that remove wall by killing monsters and this wall will appear after x time and i have this working good with one wall only and now i tried to edit to to remove 2 walls but got some errors
death.lua
and this is error got it when monster died and i couldn't find his corpse
TFS 0.3.6
death.lua
Code:
function onDeath(cid, corpse, killer)
local M ={
["Serpent Spawn"] = {Pos = {x=983,y=994,z=7},id= 1060 ,Pos2 = {x=990,y=992,z=7},id2= 5009 ,time = 30},
}
local x = M[getCreatureName(cid)]
function criar()
local parede = getTileItemById(x.Pos, x.id, x.Pos2, x.id2)
doCreateItem(x.id, 1, x.Pos)
doCreateItem(x.id2, 1, x.Pos2)
end
if x then
local parede = getTileItemById(x.Pos, x.id, x.Pos2, x.id2)
if parede then
doRemoveItem(parede.uid, 1)
doRemoveItem(parede.uid, 1)
doCreatureSay(cid, "The wall will appears in "..x.time.." seconds.", TALKTYPE_ORANGE_1)
addEvent(criar, x.time*1000)
end
end
return TRUE
end
Code:
[03/03/2015 01:51:48] [Error - CreatureScript Interface]
[03/03/2015 01:51:48] data/creaturescripts/scripts/death.lua:onDeath
[03/03/2015 01:51:48] Description:
[03/03/2015 01:51:48] attempt to index a number value
[03/03/2015 01:51:48] stack traceback:
[03/03/2015 01:51:48] [C]: in function 'getTileItemById'
[03/03/2015 01:51:48] data/creaturescripts/scripts/death.lua:14: in function <data/creaturescripts/scripts/death.lua:1>