Cornwallis
Member
- Joined
- Jan 3, 2010
- Messages
- 480
- Reaction score
- 16
I'm trying to create a talkaction to teleport my summon to me but it seems I can't get the position of it.
And here is the error in console
Please point me in the right direction.
HTML:
function onSay(player, words, param)
local summons = #player:getSummons()
local oldPosition = creature:getPosition()
local newPosition = creature:getClosestFreePosition(player:getPosition(), false)
if summons == 1 then
if newPosition.x == 0 or summons == 0 then
player:sendCancelMessage("You can not teleport your summoned monster.")
return false
elseif creature:teleportTo(newPosition) then
oldPosition:sendMagicEffect(CONST_ME_POFF)
newPosition:sendMagicEffect(CONST_ME_TELEPORT)
end
end
return false
end
HTML:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/teleport_summon.lua:onSay
data/talkactions/scripts/teleport_summon.lua:3: attempt to call method 'getPosition' (a nil value)
stack traceback:
[C]: in function 'getPosition'
data/talkactions/scripts/teleport_summon.lua:3: in function <data/talkactions/scripts/teleport_summon.lua:1>