• 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!

Summon teleport

nawyrus

Member
Joined
Jan 16, 2014
Messages
37
Reaction score
10
Is there a chance this could work in TFS 1.0?


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/

Another thing, regarding monster walking over fields, is there a way to set which field the creature will walk around or will not pass unless attacked, like real Tibia? I know that setting canpushitems to 0 in the monster xml file will make it never trespass any field the creature is not immune, even if you attack it.
 
Last edited by a moderator:
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:

Similar threads

Back
Top