Soporte Ayuda!, Convertir Script: de actionid a itemid (revscript)

3zequi3l

Hellgrave Premium
Miembro
LV
13
 
Awards
12
Buenas Alex, Saludos, Necesito Una Ayuda, Necesito Que Este Script En Vez De Que Funcione Al Pisar Un SQM, Sea Al Darle Click a Un Item!!!!
de Antemano Muchas Gracias !!!!!
asi con modal window <3





Código Lua:
-- Config
local tplist = {


 [40897] = {name = "HARDER MANSIONS", positions = {
    {x = 25767, y = 5430, z = 14}, ---name= I {x = 14079, y = 11239, z = 11}
    {x = 25767, y = 5477, z = 14}, ---name= II {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5517, z = 14}, ---name= III {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5560, z = 14}, ---name= IV {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5600, z = 14}, ---name= V {x = 4363, y = 7231, z = 7}
    
    
    
    
    },
    subareas = {'I', 'II', 'III', 'IV', 'V',}},
--------------------------------------------------------------------------------------

    [40898] = {name = "BOSSES", positions = {
    {x = 33746, y = 32191, z = 14}, ---name= WARZONES
    {x = 33621, y = 31430, z = 10}, ---name= SOUL WAR
    {x = 32379, y = 31916, z = 8}, ---name= BOSSES GRAY ISLAND
    {x = 32209, y = 32073, z = 13}, ---name= FEYRIST BOSSES
    {x = 32447, y = 32493, z = 7}, ---name= LION BOSS
    {x = 33394, y = 32680, z = 6}, ---name= SCARLET BOSS
    {x = 33384, y = 31283, z = 6}, ---name= Grand Canon Dominus
    {x = 33377, y = 31347, z = 5}, ---name= Grand Chaplain Gaunder
    {x = 33375, y = 31338, z = 3}, ---name= Preceptor Lazare
    {x = 32900, y = 31625, z = 14}, ---name= Lady Tenebris
    {x = 32767, y = 32122, z = 14}, ---name= Mounted Thorn Knight
    {x = 32762, y = 32870, z = 14}, ---name= Lloyd
    {x = 32207, y = 32026, z = 13}, ---name= VARIOS BOSSES
    {x = 33640, y = 32565, z = 13}, ---name= Faceless Bane
    {x = 33322, y = 32110, z = 15}, ---name= The Count Of The Core
    {x = 33771, y = 31507, z = 14}, ---name= The Pale Worm
    {x = 33736, y = 31469, z = 14}, ---name= The Fear Feaster
    {x = 33738, y = 31535, z = 14}, ---name= The Unwelcome
    {x = 31974, y = 32327, z = 10}, ---name= Brain Head
    {x = 32354, y = 31026, z = 15}, ---name= Eradicator
    {x = 32520, y = 31046, z = 15}, ---name= Anomaly
    {x = 33677, y = 31632, z = 14}, ---name= Goshnars Megalomania
    {x = 33777, y = 31663, z = 14}, ---name= Goshnars Greed
    {x = 33855, y = 31851, z = 6}, ---name= Goshnars Cruelty
    {x = 33776, y = 31632, z = 14}, ---name= Goshnars Spite
    {x = 33775, y = 31599, z = 14}, ---name= Goshnars Hatred
    {x = 33681, y = 31597, z = 14}, ---name= Goshnars Malice
    {x = 32212, y = 32073, z = 15}, ---name= The Nightmare Beast
    {x = 32431, y = 31064, z = 15}, ---name= Tanjis
    {x = 32416, y = 31064, z = 15}, ---name= Obujos
    {x = 32401, y = 31064, z = 15}, ---name= Jaul
    {x = 33488, y = 31546, z = 13}, ---name= King Zelos
    {x = 33462, y = 32266, z = 15}, ---name= The Baron From Below
    {x = 32300, y = 31090, z = 14}, ---name= Melting Frozen Horror
    {x = 33008, y = 31661, z = 14}, ---name= The Time Guardian
    
    },
    subareas = {'WARZONES', 'SOUL WAR','BOSSES GRAY ISLAND','FEYRIST BOSSES', 'LION BOSS', 'SCARLET BOSS', 'Grand Canon Dominus', 'Grand Chaplain Gaunder', 'Preceptor Lazare', 'Lady Tenebris', 'Mounted Thorn Knight', 'Lloyd', 'VARIOS BOSSES', 'Faceless Bane', 'The Count Of The Core', 'The Pale Worm', 'The Fear Feaster', 'The Unwelcome', 'Brain Head', 'Eradicator', 'Anomaly', 'Goshnars Megalomania', 'Goshnars Greed', 'Goshnars Cruelty', 'Goshnars Spite', 'Goshnars Hatred', 'Goshnars Malice', 'The Nightmare Beast', 'Tanjis', 'Obujos', 'Jaul', 'King Zelos', 'The Baron From Below', 'Melting Frozen Horror', 'The Time Guardian',}},

-----------------------------------------------------------------------------------


    [40899] = {name = "TEMPLOS", positions = {
    {x = 32787, y = 31277, z = 7}, ---name= YALAHAR
    {x = 32957, y = 32076, z = 7}, ---name= VENORE
    {x = 32360, y = 31782, z = 7}, ---name= CARLIN
    {x = 33217, y = 31814, z = 8}, ---name= EDRON
    {x = 33447, y = 31320, z = 9}, ---name= GRAY ISLAND
    {x = 33023, y = 31523, z = 11}, ---name= FARMINE
    {x = 32317, y = 32825, z = 7}, ---name= LIBERTY BAY
    {x = 33213, y = 32454, z = 1}, ---name= DARASHIA
    {x = 32649, y = 31925, z = 11}, ---name= KAZORDOON
    {x = 33195, y = 32853, z = 8}, ---name= ANKRAHMUN
    {x = 32213, y = 31133, z = 7}, ---name= SVARGROND
    {x = 32595, y = 32745, z = 7}, ---name= PORT HOPE
    {x = 33513, y = 32363, z = 6}, ---name= ROSHAMUUL
    {x = 33921, y = 31477, z = 5}, ---name= ISSAVI
    {x = 32732, y = 31634, z = 7},---NAME= AB'DENDRIEL
    {x = 32369, y = 32241, z = 7},    --- THAIS
    
    
    
    },
    subareas = {'YALAHAR', 'VENORE','CARLIN','EDRON ', 'GRAY ISLAND', 'FARMINE', 'LIBERTY BAY', 'DARASHIA', 'KAZORDOON', 'ANKRAHMUN', 'SVARGROND', 'PORT HOPE', 'ROSHAMUUL','ISSAVI','AB DENDRIEL','THAIS',}},
    
    
    --------------------------------------------------------------------------------
    
    
    [40900] = {name = "ACESSO RAPIDO HUNTS", positions = {
    {x = 32403, y = 32398, z = 7},--NAME= CYCLOPS THAIS
    {x = 33264, y = 32277, z = 7},--NAME= DRAGONS DARASHIA
    {x = 32815, y = 32345, z = 11},--NAME= DRAGONS POI
    {x = 33324, y = 32320, z = 12},--NAME= FERUMBRAS HUNT
    {x = 33535, y = 32026, z = 10},--NAME= DEMONS ORAMOND
    {x = 32787, y = 31093, z = 6},--NAME= GRIM REAPER YALAHAR
    {x = 32881, y = 31051, z = 6},--NAME= HELLSPAWN YALAHR
    {x = 32892, y = 32633, z = 11},--NAME= BANUTA
    {x = 32674, y = 32650, z = 7},--NAME= GAZES PORT HOPE
    {x = 33674, y = 32471, z = 6},--NAME=  ROSHAMUUL
    {x = 33663, y = 31885, z = 5},--NAME= CATACOMBS ORAMOND
    {x = 33385, y = 32627, z = 7},--NAME= COBRAS
    {x = 32424, y = 32446, z = 7},--NAME= LIONS
    {x = 33358, y = 31309, z = 4}, --NAME= FALCONS
    {x = 33138, y = 32354, z = 5}, --NAME= LIONS DARASHIA
    {x = 33075, y = 31118, z = 7}, --NAME= DRAKENS FAMINE
    {x = 32761, y = 32627, z = 7},    --NAME= CARNIVOROS
    
    
    
    
    
    
    }, subareas = {'CYCLOPS THAIS', 'DRAGONS DARASHIA', 'DRAGONS POI', 'FERUMBRAS HUNT', 'DEMONS ORAMOND', 'GRIM REAPER YALAHAR', 'HELLSPAWN YALAHR', 'BANUTA', 'GAZES PORT HOPE', 'ROSHAMUUL', 'CATACOMBS ORAMOND', 'COBRAS', 'LIONS','FALCONS','LIONS DARASHIA','DRAKENS FAMINE','CARNIVOROS'}}
}
local firstid = 40897 -- Put your first action id used here
local lastid = 40900 -- Put your last action id used here

-- Config End
local teleports = MoveEvent()
function teleports.onStepIn(player, item, position, fromPosition)
    if not player:isPlayer() then
        return false
    end
 
 
 
    local tp = tplist[item.actionid]
    local quantity = table.getn(tp.positions)
 
    player:registerEvent("Teleport_Modal_Window")
 
    local title = "Teleport"
    local message = "List of ".. tp.name .." Spawns"
      
    local window = ModalWindow(item.actionid, title, message)
    window:addButton(100, "Go")
    window:addButton(101, "Cancel")
      
    for i = 1, quantity do
        if tp.subareas[i] == nil then
            window:addChoice(i,"".. tp.name .." ".. i .."")
        else
            window:addChoice(i,"".. tp.subareas[i] .."")
        end
    end
 
    window:setDefaultEnterButton(100)
    window:setDefaultEscapeButton(101)
 
    if tp and quantity < 2 then
        player:unregisterEvent("Teleport_Modal_Window")
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tp.name ..'.')
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(tp.positions[1])
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    else
        window:sendToPlayer(player)
    end
    return true
end

for j = firstid, lastid do
    teleports:aid(j)
end

teleports:type("stepin")
teleports:register()

local modalTp = CreatureEvent("Teleport_Modal_Window")
modalTp:type("modalwindow")

function modalTp.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("Teleport_Modal_Window")
    if modalWindowId >= firstid and modalWindowId <= lastid then
        if buttonId == 100 then
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:teleportTo(tplist[modalWindowId].positions[choiceId])
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            if tplist[modalWindowId].subareas[choiceId] == nil then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].name ..' '.. choiceId ..'.')
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].subareas[choiceId] ..'.')
            end
        end
    end
    return true
end

modalTp:register()
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Buenas Alex, Saludos, Necesito Una Ayuda, Necesito Que Este Script En Vez De Que Funcione Al Pisar Un SQM, Sea Al Darle Click a Un Item!!!!
de Antemano Muchas Gracias !!!!!
asi con modal window <3





Código Lua:
-- Config
local tplist = {


 [40897] = {name = "HARDER MANSIONS", positions = {
    {x = 25767, y = 5430, z = 14}, ---name= I {x = 14079, y = 11239, z = 11}
    {x = 25767, y = 5477, z = 14}, ---name= II {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5517, z = 14}, ---name= III {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5560, z = 14}, ---name= IV {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5600, z = 14}, ---name= V {x = 4363, y = 7231, z = 7}
   
   
   
   
    },
    subareas = {'I', 'II', 'III', 'IV', 'V',}},
--------------------------------------------------------------------------------------

    [40898] = {name = "BOSSES", positions = {
    {x = 33746, y = 32191, z = 14}, ---name= WARZONES
    {x = 33621, y = 31430, z = 10}, ---name= SOUL WAR
    {x = 32379, y = 31916, z = 8}, ---name= BOSSES GRAY ISLAND
    {x = 32209, y = 32073, z = 13}, ---name= FEYRIST BOSSES
    {x = 32447, y = 32493, z = 7}, ---name= LION BOSS
    {x = 33394, y = 32680, z = 6}, ---name= SCARLET BOSS
    {x = 33384, y = 31283, z = 6}, ---name= Grand Canon Dominus
    {x = 33377, y = 31347, z = 5}, ---name= Grand Chaplain Gaunder
    {x = 33375, y = 31338, z = 3}, ---name= Preceptor Lazare
    {x = 32900, y = 31625, z = 14}, ---name= Lady Tenebris
    {x = 32767, y = 32122, z = 14}, ---name= Mounted Thorn Knight
    {x = 32762, y = 32870, z = 14}, ---name= Lloyd
    {x = 32207, y = 32026, z = 13}, ---name= VARIOS BOSSES
    {x = 33640, y = 32565, z = 13}, ---name= Faceless Bane
    {x = 33322, y = 32110, z = 15}, ---name= The Count Of The Core
    {x = 33771, y = 31507, z = 14}, ---name= The Pale Worm
    {x = 33736, y = 31469, z = 14}, ---name= The Fear Feaster
    {x = 33738, y = 31535, z = 14}, ---name= The Unwelcome
    {x = 31974, y = 32327, z = 10}, ---name= Brain Head
    {x = 32354, y = 31026, z = 15}, ---name= Eradicator
    {x = 32520, y = 31046, z = 15}, ---name= Anomaly
    {x = 33677, y = 31632, z = 14}, ---name= Goshnars Megalomania
    {x = 33777, y = 31663, z = 14}, ---name= Goshnars Greed
    {x = 33855, y = 31851, z = 6}, ---name= Goshnars Cruelty
    {x = 33776, y = 31632, z = 14}, ---name= Goshnars Spite
    {x = 33775, y = 31599, z = 14}, ---name= Goshnars Hatred
    {x = 33681, y = 31597, z = 14}, ---name= Goshnars Malice
    {x = 32212, y = 32073, z = 15}, ---name= The Nightmare Beast
    {x = 32431, y = 31064, z = 15}, ---name= Tanjis
    {x = 32416, y = 31064, z = 15}, ---name= Obujos
    {x = 32401, y = 31064, z = 15}, ---name= Jaul
    {x = 33488, y = 31546, z = 13}, ---name= King Zelos
    {x = 33462, y = 32266, z = 15}, ---name= The Baron From Below
    {x = 32300, y = 31090, z = 14}, ---name= Melting Frozen Horror
    {x = 33008, y = 31661, z = 14}, ---name= The Time Guardian
   
    },
    subareas = {'WARZONES', 'SOUL WAR','BOSSES GRAY ISLAND','FEYRIST BOSSES', 'LION BOSS', 'SCARLET BOSS', 'Grand Canon Dominus', 'Grand Chaplain Gaunder', 'Preceptor Lazare', 'Lady Tenebris', 'Mounted Thorn Knight', 'Lloyd', 'VARIOS BOSSES', 'Faceless Bane', 'The Count Of The Core', 'The Pale Worm', 'The Fear Feaster', 'The Unwelcome', 'Brain Head', 'Eradicator', 'Anomaly', 'Goshnars Megalomania', 'Goshnars Greed', 'Goshnars Cruelty', 'Goshnars Spite', 'Goshnars Hatred', 'Goshnars Malice', 'The Nightmare Beast', 'Tanjis', 'Obujos', 'Jaul', 'King Zelos', 'The Baron From Below', 'Melting Frozen Horror', 'The Time Guardian',}},

-----------------------------------------------------------------------------------


    [40899] = {name = "TEMPLOS", positions = {
    {x = 32787, y = 31277, z = 7}, ---name= YALAHAR
    {x = 32957, y = 32076, z = 7}, ---name= VENORE
    {x = 32360, y = 31782, z = 7}, ---name= CARLIN
    {x = 33217, y = 31814, z = 8}, ---name= EDRON
    {x = 33447, y = 31320, z = 9}, ---name= GRAY ISLAND
    {x = 33023, y = 31523, z = 11}, ---name= FARMINE
    {x = 32317, y = 32825, z = 7}, ---name= LIBERTY BAY
    {x = 33213, y = 32454, z = 1}, ---name= DARASHIA
    {x = 32649, y = 31925, z = 11}, ---name= KAZORDOON
    {x = 33195, y = 32853, z = 8}, ---name= ANKRAHMUN
    {x = 32213, y = 31133, z = 7}, ---name= SVARGROND
    {x = 32595, y = 32745, z = 7}, ---name= PORT HOPE
    {x = 33513, y = 32363, z = 6}, ---name= ROSHAMUUL
    {x = 33921, y = 31477, z = 5}, ---name= ISSAVI
    {x = 32732, y = 31634, z = 7},---NAME= AB'DENDRIEL
    {x = 32369, y = 32241, z = 7},    --- THAIS
   
   
   
    },
    subareas = {'YALAHAR', 'VENORE','CARLIN','EDRON ', 'GRAY ISLAND', 'FARMINE', 'LIBERTY BAY', 'DARASHIA', 'KAZORDOON', 'ANKRAHMUN', 'SVARGROND', 'PORT HOPE', 'ROSHAMUUL','ISSAVI','AB DENDRIEL','THAIS',}},
   
   
    --------------------------------------------------------------------------------
   
   
    [40900] = {name = "ACESSO RAPIDO HUNTS", positions = {
    {x = 32403, y = 32398, z = 7},--NAME= CYCLOPS THAIS
    {x = 33264, y = 32277, z = 7},--NAME= DRAGONS DARASHIA
    {x = 32815, y = 32345, z = 11},--NAME= DRAGONS POI
    {x = 33324, y = 32320, z = 12},--NAME= FERUMBRAS HUNT
    {x = 33535, y = 32026, z = 10},--NAME= DEMONS ORAMOND
    {x = 32787, y = 31093, z = 6},--NAME= GRIM REAPER YALAHAR
    {x = 32881, y = 31051, z = 6},--NAME= HELLSPAWN YALAHR
    {x = 32892, y = 32633, z = 11},--NAME= BANUTA
    {x = 32674, y = 32650, z = 7},--NAME= GAZES PORT HOPE
    {x = 33674, y = 32471, z = 6},--NAME=  ROSHAMUUL
    {x = 33663, y = 31885, z = 5},--NAME= CATACOMBS ORAMOND
    {x = 33385, y = 32627, z = 7},--NAME= COBRAS
    {x = 32424, y = 32446, z = 7},--NAME= LIONS
    {x = 33358, y = 31309, z = 4}, --NAME= FALCONS
    {x = 33138, y = 32354, z = 5}, --NAME= LIONS DARASHIA
    {x = 33075, y = 31118, z = 7}, --NAME= DRAKENS FAMINE
    {x = 32761, y = 32627, z = 7},    --NAME= CARNIVOROS
   
   
   
   
   
   
    }, subareas = {'CYCLOPS THAIS', 'DRAGONS DARASHIA', 'DRAGONS POI', 'FERUMBRAS HUNT', 'DEMONS ORAMOND', 'GRIM REAPER YALAHAR', 'HELLSPAWN YALAHR', 'BANUTA', 'GAZES PORT HOPE', 'ROSHAMUUL', 'CATACOMBS ORAMOND', 'COBRAS', 'LIONS','FALCONS','LIONS DARASHIA','DRAKENS FAMINE','CARNIVOROS'}}
}
local firstid = 40897 -- Put your first action id used here
local lastid = 40900 -- Put your last action id used here

-- Config End
local teleports = MoveEvent()
function teleports.onStepIn(player, item, position, fromPosition)
    if not player:isPlayer() then
        return false
    end
 
 
 
    local tp = tplist[item.actionid]
    local quantity = table.getn(tp.positions)
 
    player:registerEvent("Teleport_Modal_Window")
 
    local title = "Teleport"
    local message = "List of ".. tp.name .." Spawns"
     
    local window = ModalWindow(item.actionid, title, message)
    window:addButton(100, "Go")
    window:addButton(101, "Cancel")
     
    for i = 1, quantity do
        if tp.subareas[i] == nil then
            window:addChoice(i,"".. tp.name .." ".. i .."")
        else
            window:addChoice(i,"".. tp.subareas[i] .."")
        end
    end
 
    window:setDefaultEnterButton(100)
    window:setDefaultEscapeButton(101)
 
    if tp and quantity < 2 then
        player:unregisterEvent("Teleport_Modal_Window")
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tp.name ..'.')
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(tp.positions[1])
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    else
        window:sendToPlayer(player)
    end
    return true
end

for j = firstid, lastid do
    teleports:aid(j)
end

teleports:type("stepin")
teleports:register()

local modalTp = CreatureEvent("Teleport_Modal_Window")
modalTp:type("modalwindow")

function modalTp.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("Teleport_Modal_Window")
    if modalWindowId >= firstid and modalWindowId <= lastid then
        if buttonId == 100 then
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:teleportTo(tplist[modalWindowId].positions[choiceId])
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            if tplist[modalWindowId].subareas[choiceId] == nil then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].name ..' '.. choiceId ..'.')
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].subareas[choiceId] ..'.')
            end
        end
    end
    return true
end

modalTp:register()

Hola,
Donde el 1111, seria el ItemID, prueba de esta forma:


Código Lua:
-- Config
local tplist = {


 [40897] = {name = "HARDER MANSIONS", positions = {
    {x = 25767, y = 5430, z = 14}, ---name= I {x = 14079, y = 11239, z = 11}
    {x = 25767, y = 5477, z = 14}, ---name= II {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5517, z = 14}, ---name= III {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5560, z = 14}, ---name= IV {x = 4363, y = 7231, z = 7}
    {x = 25767, y = 5600, z = 14}, ---name= V {x = 4363, y = 7231, z = 7}
    
    
    
    
    },
    subareas = {'I', 'II', 'III', 'IV', 'V',}},
--------------------------------------------------------------------------------------

    [40898] = {name = "BOSSES", positions = {
    {x = 33746, y = 32191, z = 14}, ---name= WARZONES
    {x = 33621, y = 31430, z = 10}, ---name= SOUL WAR
    {x = 32379, y = 31916, z = 8}, ---name= BOSSES GRAY ISLAND
    {x = 32209, y = 32073, z = 13}, ---name= FEYRIST BOSSES
    {x = 32447, y = 32493, z = 7}, ---name= LION BOSS
    {x = 33394, y = 32680, z = 6}, ---name= SCARLET BOSS
    {x = 33384, y = 31283, z = 6}, ---name= Grand Canon Dominus
    {x = 33377, y = 31347, z = 5}, ---name= Grand Chaplain Gaunder
    {x = 33375, y = 31338, z = 3}, ---name= Preceptor Lazare
    {x = 32900, y = 31625, z = 14}, ---name= Lady Tenebris
    {x = 32767, y = 32122, z = 14}, ---name= Mounted Thorn Knight
    {x = 32762, y = 32870, z = 14}, ---name= Lloyd
    {x = 32207, y = 32026, z = 13}, ---name= VARIOS BOSSES
    {x = 33640, y = 32565, z = 13}, ---name= Faceless Bane
    {x = 33322, y = 32110, z = 15}, ---name= The Count Of The Core
    {x = 33771, y = 31507, z = 14}, ---name= The Pale Worm
    {x = 33736, y = 31469, z = 14}, ---name= The Fear Feaster
    {x = 33738, y = 31535, z = 14}, ---name= The Unwelcome
    {x = 31974, y = 32327, z = 10}, ---name= Brain Head
    {x = 32354, y = 31026, z = 15}, ---name= Eradicator
    {x = 32520, y = 31046, z = 15}, ---name= Anomaly
    {x = 33677, y = 31632, z = 14}, ---name= Goshnars Megalomania
    {x = 33777, y = 31663, z = 14}, ---name= Goshnars Greed
    {x = 33855, y = 31851, z = 6}, ---name= Goshnars Cruelty
    {x = 33776, y = 31632, z = 14}, ---name= Goshnars Spite
    {x = 33775, y = 31599, z = 14}, ---name= Goshnars Hatred
    {x = 33681, y = 31597, z = 14}, ---name= Goshnars Malice
    {x = 32212, y = 32073, z = 15}, ---name= The Nightmare Beast
    {x = 32431, y = 31064, z = 15}, ---name= Tanjis
    {x = 32416, y = 31064, z = 15}, ---name= Obujos
    {x = 32401, y = 31064, z = 15}, ---name= Jaul
    {x = 33488, y = 31546, z = 13}, ---name= King Zelos
    {x = 33462, y = 32266, z = 15}, ---name= The Baron From Below
    {x = 32300, y = 31090, z = 14}, ---name= Melting Frozen Horror
    {x = 33008, y = 31661, z = 14}, ---name= The Time Guardian
    
    },
    subareas = {'WARZONES', 'SOUL WAR','BOSSES GRAY ISLAND','FEYRIST BOSSES', 'LION BOSS', 'SCARLET BOSS', 'Grand Canon Dominus', 'Grand Chaplain Gaunder', 'Preceptor Lazare', 'Lady Tenebris', 'Mounted Thorn Knight', 'Lloyd', 'VARIOS BOSSES', 'Faceless Bane', 'The Count Of The Core', 'The Pale Worm', 'The Fear Feaster', 'The Unwelcome', 'Brain Head', 'Eradicator', 'Anomaly', 'Goshnars Megalomania', 'Goshnars Greed', 'Goshnars Cruelty', 'Goshnars Spite', 'Goshnars Hatred', 'Goshnars Malice', 'The Nightmare Beast', 'Tanjis', 'Obujos', 'Jaul', 'King Zelos', 'The Baron From Below', 'Melting Frozen Horror', 'The Time Guardian',}},

-----------------------------------------------------------------------------------


    [40899] = {name = "TEMPLOS", positions = {
    {x = 32787, y = 31277, z = 7}, ---name= YALAHAR
    {x = 32957, y = 32076, z = 7}, ---name= VENORE
    {x = 32360, y = 31782, z = 7}, ---name= CARLIN
    {x = 33217, y = 31814, z = 8}, ---name= EDRON
    {x = 33447, y = 31320, z = 9}, ---name= GRAY ISLAND
    {x = 33023, y = 31523, z = 11}, ---name= FARMINE
    {x = 32317, y = 32825, z = 7}, ---name= LIBERTY BAY
    {x = 33213, y = 32454, z = 1}, ---name= DARASHIA
    {x = 32649, y = 31925, z = 11}, ---name= KAZORDOON
    {x = 33195, y = 32853, z = 8}, ---name= ANKRAHMUN
    {x = 32213, y = 31133, z = 7}, ---name= SVARGROND
    {x = 32595, y = 32745, z = 7}, ---name= PORT HOPE
    {x = 33513, y = 32363, z = 6}, ---name= ROSHAMUUL
    {x = 33921, y = 31477, z = 5}, ---name= ISSAVI
    {x = 32732, y = 31634, z = 7},---NAME= AB'DENDRIEL
    {x = 32369, y = 32241, z = 7},    --- THAIS
    
    
    
    },
    subareas = {'YALAHAR', 'VENORE','CARLIN','EDRON ', 'GRAY ISLAND', 'FARMINE', 'LIBERTY BAY', 'DARASHIA', 'KAZORDOON', 'ANKRAHMUN', 'SVARGROND', 'PORT HOPE', 'ROSHAMUUL','ISSAVI','AB DENDRIEL','THAIS',}},
    
    
    --------------------------------------------------------------------------------
    
    
    [40900] = {name = "ACESSO RAPIDO HUNTS", positions = {
    {x = 32403, y = 32398, z = 7},--NAME= CYCLOPS THAIS
    {x = 33264, y = 32277, z = 7},--NAME= DRAGONS DARASHIA
    {x = 32815, y = 32345, z = 11},--NAME= DRAGONS POI
    {x = 33324, y = 32320, z = 12},--NAME= FERUMBRAS HUNT
    {x = 33535, y = 32026, z = 10},--NAME= DEMONS ORAMOND
    {x = 32787, y = 31093, z = 6},--NAME= GRIM REAPER YALAHAR
    {x = 32881, y = 31051, z = 6},--NAME= HELLSPAWN YALAHR
    {x = 32892, y = 32633, z = 11},--NAME= BANUTA
    {x = 32674, y = 32650, z = 7},--NAME= GAZES PORT HOPE
    {x = 33674, y = 32471, z = 6},--NAME=  ROSHAMUUL
    {x = 33663, y = 31885, z = 5},--NAME= CATACOMBS ORAMOND
    {x = 33385, y = 32627, z = 7},--NAME= COBRAS
    {x = 32424, y = 32446, z = 7},--NAME= LIONS
    {x = 33358, y = 31309, z = 4}, --NAME= FALCONS
    {x = 33138, y = 32354, z = 5}, --NAME= LIONS DARASHIA
    {x = 33075, y = 31118, z = 7}, --NAME= DRAKENS FAMINE
    {x = 32761, y = 32627, z = 7},    --NAME= CARNIVOROS
    
    
    
    
    
    
    }, subareas = {'CYCLOPS THAIS', 'DRAGONS DARASHIA', 'DRAGONS POI', 'FERUMBRAS HUNT', 'DEMONS ORAMOND', 'GRIM REAPER YALAHAR', 'HELLSPAWN YALAHR', 'BANUTA', 'GAZES PORT HOPE', 'ROSHAMUUL', 'CATACOMBS ORAMOND', 'COBRAS', 'LIONS','FALCONS','LIONS DARASHIA','DRAKENS FAMINE','CARNIVOROS'}}
}
local firstid = 40897 -- Put your first action id used here
local lastid = 40900 -- Put your last action id used here

-- Config End
local teleports = Action()
function teleports.onUse(player, item, position, fromPosition)
    if not player:isPlayer() then
        return false
    end
 
 
 
    local tp = tplist[item.actionid]
    local quantity = table.getn(tp.positions)
 
    player:registerEvent("Teleport_Modal_Window")
 
    local title = "Teleport"
    local message = "List of ".. tp.name .." Spawns"
      
    local window = ModalWindow(item.actionid, title, message)
    window:addButton(100, "Go")
    window:addButton(101, "Cancel")
      
    for i = 1, quantity do
        if tp.subareas[i] == nil then
            window:addChoice(i,"".. tp.name .." ".. i .."")
        else
            window:addChoice(i,"".. tp.subareas[i] .."")
        end
    end
 
    window:setDefaultEnterButton(100)
    window:setDefaultEscapeButton(101)
 
    if tp and quantity < 2 then
        player:unregisterEvent("Teleport_Modal_Window")
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tp.name ..'.')
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(tp.positions[1])
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    else
        window:sendToPlayer(player)
    end
    return true
end

for j = firstid, lastid do
    teleports:aid(j)
end

teleports:id(1111)
teleports:register()

local modalTp = CreatureEvent("Teleport_Modal_Window")
modalTp:type("modalwindow")

function modalTp.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("Teleport_Modal_Window")
    if modalWindowId >= firstid and modalWindowId <= lastid then
        if buttonId == 100 then
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:teleportTo(tplist[modalWindowId].positions[choiceId])
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            if tplist[modalWindowId].subareas[choiceId] == nil then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].name ..' '.. choiceId ..'.')
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Teleported to '.. tplist[modalWindowId].subareas[choiceId] ..'.')
            end
        end
    end
    return true
end

modalTp:register()
 
Arriba