Bienvenido a Open Games Community

Únete ahora para acceder a todas nuestras funciones. Una vez que te registres e inicies sesión, podrás crear temas, responder a hilos existentes, valorar la reputación de otros miembros y muchísimo más. Además, es rápido y totalmente gratuito; ¿a qué esperas?

Solicitud The supreme cube (teleport to dp)

M

maricopex

Invitado
Buen dia , ando en busca de ayuda para poder crear el supreme cube que sea un teleport al templo cuando se pierde el battle
encontre en el foro algunos temas de la misma pero no me funcionaron estoy utilizando el ot: canary 3.1.2

eso fue lo que encontre , copie un archivo lua cualquiera le puse de nombre supreme_cube.lua le pegue ese codigo y hace lo de la foto pero cuando le das a aceptar no te teletransporta

el lua esta ubicado : \data-otservbr-global\scripts\actions


local destinations = {
[1] = {name = "Thais", ID = 8},
}

local supreme_Cube = Action()

function supreme_Cube.onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:registerEvent("modalCube")

local title = "Supreme Cube is being used"
local message = "Select your destination:"

local window = ModalWindow(1001, title, message)
if player:getItemCount(31633) >= 1 then
window:addButton(100, "GO!")
window:setDefaultEnterButton(100)
else
window:setDefaultEnterButton(101)
end
window:addButton(101, "Cancel")
window:setDefaultEscapeButton(101)

for i = 1, #destinations do
local o = destinations.name
local town = Town(destinations.ID):getTemplePosition()
window:addChoice(i, o)
end

if destinations.id == 1 then
player:getPosition():sendMagicEffect(201)
elseif destinations.id == 2 then
player:getPosition():sendMagicEffect(201)
return false
end


--player:teleportTo(town)

window:sendToPlayer(player)
return true
end

supreme_Cube:id(31633)
supreme_Cube:register()
local creaturescript = CreatureEvent("modalCube")
function creaturescript.onModalWindow(player, modalWindowId, buttonId, choiceId)

if modalWindowId ~= 1001 then --- we dont wanna doubled modal windows, so there is check if its equal for cube
return false
end

player:unregisterEvent("modalCube")

if buttonId == 101 then --- 101 in this case its a cancel button, so we return
return false
end

local townTable = destinations[choiceId]
if not townTable then
print("[Cube Teleporter] - Something is wrong.") --- probably will never happen, but who knows
return false
end

local name = townTable.name
local id = townTable.id

local town = Town(id)
if not town then
print("[Cube Teleporter] - Town with this ID doesnt exsists.") -- just a check for correct town id
return false
end

local pos = town:getTemplePosition()

player:sendTextMessage(MESSAGE_INFO_DESCR, "You have been teleported to " .. name .. ".")
player:teleportTo(pos)
player:sendMagicEffect(CONST_ME_TELEPORT)
return true
end
 

Adjuntos

  • cube.png
    cube.png
    129,2 KB · Visitas: 6

Alex

Administrador
Dev
Registrado
1 Sep 2021
Mensajes
2.363
Puntuación de reacción
28.401
Puntos
707
Buen dia , ando en busca de ayuda para poder crear el supreme cube que sea un teleport al templo cuando se pierde el battle
encontre en el foro algunos temas de la misma pero no me funcionaron estoy utilizando el ot: canary 3.1.2

eso fue lo que encontre , copie un archivo lua cualquiera le puse de nombre supreme_cube.lua le pegue ese codigo y hace lo de la foto pero cuando le das a aceptar no te teletransporta

el lua esta ubicado : \data-otservbr-global\scripts\actions
Hola,

Aqui hay uno, si no quieres utilziar el sistema vip, remueve donde veas player:isVip()

 
shape1
shape2
shape3
shape4
shape5
shape6
Arriba