andu
Sold 649 scripts, 25 maps and 9 events!
summonpos have nil value but when you try to say summonpos.x it says 0
i added comments inside the script what are explaining the issue
i added comments inside the script what are explaining the issue
Lua:
local summons = getCreatureSummons(cid) -- script spamms errors only when you have a summon
for i = 1, #summons do
local sid = numberToVariant(summons[i]) -- w/o this spams 'attempt to index a number value'
local summonPos = sid:getPosition() -- summons[i]:getPosition() spams 'attempt to index a number value'
-- and this part i made to check wtf is going on:
cid:say("summon pos: "..summonPos.x..", "..summonPos.y..", "..summonPos.z,1)
-- it keeps saying 0,0,0 but why? player pos is correct, but why not summon?
if getDistanceBetween(pos, summonPos) > config.tilesLimitToTeleport or pos.z ~= summonPos.z then
sid:teleportTo(pos) -- spamming attempt to call method 'teleportTo' (a nil value) how to fix this?
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
doSendMagicEffect(summonPos, CONST_ME_MAGIC_RED)
end
end