• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua attempt to call global 'doCreateTeleport' (a nil value)

Awesomedudei

Revolutionot.com
Joined
Jan 20, 2010
Messages
444
Solutions
1
Reaction score
202
Location
Sweden
Hello, i've got this problem with a raid script not working properly.
It was working before moving to ubuntu but now it just wont.

Lua:
Oct 04 15:21:20 vps-******** tfs[64252]: > Broadcasted message: "Innocence has returned to his dungeon.".
Oct 04 15:21:22 vps-******** tfs[64252]: Lua Script Error: [Raid Interface]
Oct 04 15:21:22 vps-******** tfs[64252]: data/raids/scripts/innocence.lua:onRaid
Oct 04 15:21:22 vps-******** tfs[64252]: data/raids/scripts/innocence.lua:11: attempt to call global 'doCreateTeleport' (a nil value)
Oct 04 15:21:22 vps-******** tfs[64252]: stack traceback:
Oct 04 15:21:22 vps-******** tfs[64252]:         [C]: in function 'doCreateTeleport'
Oct 04 15:21:22 vps-******** tfs[64252]:         data/raids/scripts/innocence.lua:11: in function <data/raids/scripts/innocence.lua:10>


innocence.lua from data/raids/scripts/
Lua:
local function deleteTeleport(tp)
  local teleport = getTileItemById(tp, 11796).uid
  if(teleport > 0) then
  doRemoveItem(teleport)
  doSendMagicEffect(tp, CONST_ME_POFF)
  end
  return true
end

function onRaid()
    doCreateTeleport(11796, Position(1747, 3231, 7), Position(1119, 1676, 7))
    addEvent(function()
        deleteTeleport(Position(1119, 1676, 7))
    end, 6 * 60 * 60 * 1000)
end

Scripts that spawns a Teleport from like an Event or a creaturescript works 100% of the time.
But when it is from raid/scripts, it just doesn't?


And yes i do have the function doCreateTeleport in compat.

Any help is very appreciated!
 
Last edited:
try this one
I tried adjusting the code yesterday to this.

Lua:
local teleportToPosition = Position(1747, 3231, 7)
local teleportCreatePosition = Position(1119, 1676, 7)

local function deleteTeleport(tp)
  local teleport = getTileItemById(tp, 11796).uid
  if(teleport > 0) then
  doRemoveItem(teleport)
  doSendMagicEffect(tp, CONST_ME_POFF)
  end
  return true
end

function onRaid()
 local item = Game.createItem(11796, 1, teleportCreatePosition)
    if item:isTeleport() then
        item:setDestination(teleportToPosition)
    end
    addEvent(function()
        deleteTeleport(Position(1119, 1676, 7))
    end, 60 * 60 * 1000)
end

But as i am writing this and testing it now works?????
yesterday it only worked the first time.
Now it works. What the ffffffff 😂
 
Bah i was actually wrong.. This raid script works when executed manually, but not from the raid interval 🤔

So for example using /raid Raidname,
Will spawn the raid moster & the teleport which takes you to the spot.

If it launches from the interval ive setup in raids.xml,it will spawn the monster but the console will still return that error for the teleport 🤔🤔

I am very confused how this is even a thing.
 
Same error or different one? 😯

EDIT:
By the way, addEvent is wrong, should be something like:
Lua:
addEvent(deleteTeleport, 60 * 60 * 1000, teleportCreatePosition)
 
Back
Top