froy
Active Member
- Joined
- Sep 30, 2009
- Messages
- 151
- Solutions
- 3
- Reaction score
- 36
Using this code:
I do not get any error when running the exe but I assume
is the reason why I'm getting this error when killing the monster in the script.
Any hints?
Code:
local teleportToPosition = Position(32001, 32625, 7)
local function removeTeleport(position)
local teleportItem = Tile(position):getItemById(1949)
if teleportItem then
teleportItem:remove()
position:sendMagicEffect(CONST_ME_POFF)
end
end
function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster or targetMonster:getName():lower() ~= 'orshabaal' then
return true
end
local position = targetMonster:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(1949, 1, position)
doItemSetAttribute(create,"uid",1004)
if item:isTeleport() then
item:setDestination(teleportToPosition)
end
targetMonster:say('test has been defeated, claim your rewards, mortals! It will disappear in 2 minutes.', TALKTYPE_MONSTER_SAY, 0, 0, position)
--remove portal after 1 min
addEvent(removeTeleport, 2 * 30 * 1000, position)
return true
end
Code:
doItemSetAttribute(create,"uid",1004)
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/teleportkill.lua:onKill
data/creaturescripts/scripts/teleportkill.lua:20: attempt to call global 'doItemSetAttribute' (a nil value)
stack traceback:
[C]: in function 'doItemSetAttribute'
data/creaturescripts/scripts/teleportkill.lua:20: in function <data/creaturescripts/scripts/teleportkill.lua:11>
Any hints?