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

MoveEvent [TFS 1.1] Teleporter spot(configurable price and storage)

Issue with pad randomly stopping to work is when you reload actions. You must reload movements to get it working again.
try moving this from movement to global.lua
Code:
tp_pads = {
   [8301] = {price = 300, name = "Spot 1", storage = 99586},
   [8302] = {price = 300, name = "Spot 2", storage = 99587},
   [8303] = {price = 0, name = "Spot 3", storage = 99588},
   [8304] = {price = 300, name = "Spot 4", storage = 99589},
   [8305] = {price = 300, name = "Spot 5", storage = 99590}
}
 
try moving this from movement to global.lua
Code:
tp_pads = {
   [8301] = {price = 300, name = "Spot 1", storage = 99586},
   [8302] = {price = 300, name = "Spot 2", storage = 99587},
   [8303] = {price = 0, name = "Spot 3", storage = 99588},
   [8304] = {price = 300, name = "Spot 4", storage = 99589},
   [8305] = {price = 300, name = "Spot 5", storage = 99590}
}
Does not fix issue.

Resolved.
 
Does not fix issue.

Resolved.
so when you reload actions this stops working until you reload movements? i think thats an issue you should try to ask about on the github, they might be able to figure out why :p
 
so when you reload actions this stops working until you reload movements? i think thats an issue you should try to ask about on the github, they might be able to figure out why :p
Yeah no. lol
issue was was using same UID in actions.xml
 
how can i setup this to use 5 different teleporters? i mean, different movements... each teleport will reach you different places..

sorry for my bad english

this is what i have till this moment, 3 differents movements scripts:

Code:
tp_pads = {
   [8332] = {price = 0, name = "Temple"},
   [8333] = {price = 0, name = "Depot"},
   [8334] = {price = 0, name = "Magic Shop"},
   [8335] = {price = 0, name = "Distance Shop"},
   [8336] = {price = 0, name = "Rashid"},
   [8337] = {price = 0, name = "Rotworms"},
   [8338] = {price = 0, name = "Medusa Tower"},
   [8339] = {price = 0, name = "Serpent Spawn"},
   [8340] = {price = 0, name = "Asura Palace"},
   [8341] = {price = 0, name = "Oramond"},
   [8342] = {price = 0, name = "Roshamuul"},
   [8343] = {price = 0, name = "Mistrock"},
   [8344] = {price = 0, name = "Earth Elementals"},
   [8345] = {price = 0, name = "Glooth Bandits"},
   [8346] = {price = 0, name = "Neutral Nation"},
   [8347] = {price = 0, name = "Hero Fortress"}
}
function onStepIn(player, item, position, fromPosition)
   if not tp_pads[item.uid] then return true end
   if not isInRange(position, {x = fromPosition.x - 1, y = fromPosition.y - 1, z = fromPosition.z}, {x = fromPosition.x + 1, y = fromPosition.y + 1, z = fromPosition.z}) then
     -- player got there from another pad
     return true
   end
   if not player:isPlayer() then
     return true
   end
  
   if tp_pads[item.uid].storage then
     if player:getStorageValue(tp_pads[item.uid].storage) < 1 then
       player:setStorageValue(tp_pads[item.uid].storage, 1)
       player:say("You have unlocked the fire nation spots.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
     end
   end
  
   if player:isPzLocked() then
     player:teleportTo(fromPosition)
     player:say("The pad is not responding.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
   else
     local padWindow = ModalWindow(1860, "Earth Nation Spots", "Select destination:")
     for i = 8332, 8347 do
       if i ~= item.uid then
         if tp_pads[i].price then
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
           end
         else
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name)
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name)
           end
         end
       end
     end
     padWindow:addButton(1, "Select")
     padWindow:addButton(2, "Cancel")
     padWindow:setDefaultEnterButton(1)
     padWindow:setDefaultEscapeButton(2)
     padWindow:sendToPlayer(player)
   end
   return true
end

Code:
tp_pads = {
   [8301] = {price = 0, name = "Temple"},
   [8302] = {price = 0, name = "Depot"},
   [8303] = {price = 0, name = "Magic Shop"},
   [8304] = {price = 0, name = "Distance Shop"},
   [8305] = {price = 0, name = "Rashid"},
   [8306] = {price = 0, name = "Rotworms"},
   [8307] = {price = 0, name = "Asura Palace"},
   [8308] = {price = 0, name = "Oramond"},
   [8309] = {price = 0, name = "Roshamuul"},
   [8310] = {price = 0, name = "Mistrock"},
   [8311] = {price = 0, name = "Dragons"},
   [8312] = {price = 0, name = "Neutral Nation"},
   [8313] = {price = 0, name = "Hero Fortress"},
   [8314] = {price = 0, name = "Glooth Bandit"}
}
function onStepIn(player, item, position, fromPosition)
   if not tp_pads[item.uid] then return true end
   if not isInRange(position, {x = fromPosition.x - 1, y = fromPosition.y - 1, z = fromPosition.z}, {x = fromPosition.x + 1, y = fromPosition.y + 1, z = fromPosition.z}) then
     -- player got there from another pad
     return true
   end
   if not player:isPlayer() then
     return true
   end
  
   if tp_pads[item.uid].storage then
     if player:getStorageValue(tp_pads[item.uid].storage) < 1 then
       player:setStorageValue(tp_pads[item.uid].storage, 1)
       player:say("You have unlocked the fire nation spots.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
     end
   end
  
   if player:isPzLocked() then
     player:teleportTo(fromPosition)
     player:say("The pad is not responding.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
   else
     local padWindow = ModalWindow(1860, "Fire Nation Spots", "Select destination:")
     for i = 8301, 8314 do
       if i ~= item.uid then
         if tp_pads[i].price then
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
           end
         else
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name)
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name)
           end
         end
       end
     end
     padWindow:addButton(1, "Select")
     padWindow:addButton(2, "Cancel")
     padWindow:setDefaultEnterButton(1)
     padWindow:setDefaultEscapeButton(2)
     padWindow:sendToPlayer(player)
   end
   return true
end

Code:
tp_pads = {
   [8315] = {price = 0, name = "Temple"},
   [8316] = {price = 0, name = "Depot"},
   [8317] = {price = 0, name = "Magic Shop"},
   [8318] = {price = 0, name = "Distance Shop"},
   [8319] = {price = 0, name = "Rashid"},
   [8320] = {price = 0, name = "Rotworms"},
   [8321] = {price = 0, name = "Yielothax"},
   [8322] = {price = 0, name = "Wyrm"},
   [8323] = {price = 0, name = "Asura Palace"},
   [8324] = {price = 0, name = "Oramond"},
   [8325] = {price = 0, name = "Roshamuul"},
   [8326] = {price = 0, name = "Mistrock"},
   [8327] = {price = 0, name = "Behemoths"},
   [8328] = {price = 0, name = "Glooth Bandits"},
   [8329] = {price = 0, name = "Warlocks"},
   [8330] = {price = 0, name = "Neutral Nation"},
   [8331] = {price = 0, name = "Hero Fortress"}
}
function onStepIn(player, item, position, fromPosition)
   if not tp_pads[item.uid] then return true end
   if not isInRange(position, {x = fromPosition.x - 1, y = fromPosition.y - 1, z = fromPosition.z}, {x = fromPosition.x + 1, y = fromPosition.y + 1, z = fromPosition.z}) then
     -- player got there from another pad
     return true
   end
   if not player:isPlayer() then
     return true
   end
  
   if tp_pads[item.uid].storage then
     if player:getStorageValue(tp_pads[item.uid].storage) < 1 then
       player:setStorageValue(tp_pads[item.uid].storage, 1)
       player:say("You have unlocked the fire nation spots.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
     end
   end
  
   if player:isPzLocked() then
     player:teleportTo(fromPosition)
     player:say("The pad is not responding.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
   else
     local padWindow = ModalWindow(1860, "Wind Nation Spots", "Select destination:")
     for i = 8315, 8331 do
       if i ~= item.uid then
         if tp_pads[i].price then
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
           end
         else
           if tp_pads[i].storage then
             if player:getStorageValue(tp_pads[i].storage) > 0 then
               padWindow:addChoice(i - 8300, tp_pads[i].name)
             end
           else
             padWindow:addChoice(i - 8300, tp_pads[i].name)
           end
         end
       end
     end
     padWindow:addButton(1, "Select")
     padWindow:addButton(2, "Cancel")
     padWindow:setDefaultEnterButton(1)
     padWindow:setDefaultEscapeButton(2)
     padWindow:sendToPlayer(player)
   end
   return true
end

and on movements.xml

Code:
    <movevent event="StepIn" itemid="5064" script="tp_padfire.lua"/>
    <movevent event="StepIn" itemid="5068" script="tp_padwind.lua"/>
    <movevent event="StepIn" itemid="25256" script="tp_padearth.lua"/>
 
Last edited by a moderator:
Hi, I know I am refreshing an old post but I am trying to use this on my server.

The modal window doesn't show choices.

Is there anyone who can help?

I am using TFS 1.5 - 8.00 - mehahotclient



Fasttravel list.png
 
Hi, I know I am refreshing an old post but I am trying to use this on my server.

The modal window doesn't show choices.

Is there anyone who can help?

I am using TFS 1.5 - 8.00 - mehahotclient



View attachment 64739
Tibia version 9.7 or later can use modal windows.
 
Back
Top