• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Summon teleport on TFS 1.0

nawyrus

Member
Joined
Jan 16, 2014
Messages
37
Reaction score
10
Code:
function onThink(interval, lastExecution, thinkInterval)
local tabla = {}
local maxDistance = 10
for _, pid in ipairs(getPlayersOnline()) do
local summons = getCreatureSummons(pid)
if #summons > 0 then
table.insert(tabla, pid)
end
end
for _, t in ipairs(tabla) do
local summ = getCreatureSummons(t)
if getThingPos(t).z ~= getThingPos(summ[1]).z or getDistanceBetween(getThingPos(t), getThingPos(summ[1])) > maxDistance then
doTeleportThing(summ[1], getThingPos(t))
doSendMagicEffect(getThingPos(t), 12)
end
end
return true
end
http://otland.net/threads/pokemon-summon-teleport.113146/

Can someone adapt this code to TFS 1.0? Thanks.
 
Found another script and adapted it myself, replaced getThingPos with GetCreaturePosition and it worked. http://otland.net/threads/summon-teleport-script.200354/

Code:
function onThink(interval, lastExecution, thinkInterval)
  local maxDistance = 10
  for _, cid in ipairs(getOnlinePlayers()) do
      local sums = getCreatureSummons(cid)
      if #sums > 0 then
        for i = 1, #sums do
            if getCreaturePosition(cid).z ~= getCreaturePosition(sums[i]).z or
                  getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(sums[i])) > maxDistance then
              doTeleportThing(sums[i], getCreaturePosition(cid))
            end
        end
      end
  end
  return true
end

globalevents.xml:
Code:
<globalevent name="teleport" interval="1" script="teleport.lua"/>
 
Last edited:
Back
Top