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

CreatureEvent [TFS 1.1] Fast Travel To Unlocked Locations, modalwindow

Code:
if item.actionid > 37100 and item.actionid < 38000 or item.actionid > 5000 and item.actionid < 5005 then
player:sendLocationWindow()
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot fast travel while in combat.")
end
Might want to remove the else statement entirely, as there is not actually a check for battle in this case.
 
I don't know why it's not working, it shows locations but when I choose one modalwindow doesn't show sublocations and just closes. I have scripts exactly like your post.
 
Is it possible to use this script without discover?
one of two ways
1. in your talkaction you could add the following code to ensure the player has access to all
Code:
for i = 1, #tlocations do
    if not player:getStorage(tlocations[i].storage) == 1 then
        player:setStorageValue(tlocations[i].storage, 1)
    end
    for j = 1, #tlocations[i].sublocations do
        if not player:getStorageValue(tlocations[i].sublocations[j].storage) == 1 then
            player:setStorageValue(tlocations[i].sublocations[j].storage, 1)
        end
    end
end

2. change the sendLocationWindow and sendTravelWindow functions to these:
Code:
function Player:sendLocationWindow()
    local window = ModalWindow(modalId, "Fast Travel", "You can fast travel to any of the below locations.")
    local choices = 0
   
    for i = 1, #tlocations do
        window:addChoice(i, tlocations[i]["name"])
        choices = choices + 1
    end
    if choices > 0 then
        window:addButton(1, "Expand")
        window:setDefaultEnterButton(1)
    end
    window:addButton(2, "Exit")
    window:setDefaultEscapeButton(2)
    window:sendToPlayer(self)
    return true
end

function Player:sendTravelWindow(location)
    local window = ModalWindow(modalId + 1, location["name"], "You can fast travel to any of the below locations.")
    local choices = 0
    for i = 1, #location["sublocations"] do
        window:addChoice(i, location["sublocations"][i]["name"])
        choices = choices + 1
    end
    if choices > 0 then
        window:addButton(1, "Travel")
        window:setDefaultEnterButton(1)
    end
    window:addButton(2, "Back")
    window:setDefaultEscapeButton(2)
    window:sendToPlayer(self)
    return true
end

option 2 is the cleaner and faster way of doing it.
 
Is there a way to do that if you are not in the city range you can not travel? coords x y ???
 
Back
Top