Postado Novembro 9, 2017 7 anos Oi pessoas, eu gostaria de uma wand (ou pode ser um item mesmo), que eu clicar no chão usando o item, ele cria um portal e leva para algum lugar aleatorio (configuravel). é tipo assim: Citar local config = { id portal = {3940}, destino = { {x = 2160, y = 7, z = 1000, chance = 50}, {x = 2161, y = 7, z = 1001, chance = 50}, {x = 2162, y = 7, z = 1002, chance = 50}, {x = 2163, y = 7, z = 1003, chance = 50}, {x = 2164, y = 7, z = 1004, chance = 50}, }, eff = 2, --Efeito que sairá quando o player usar o item cooldown = 60, -- em segundos } Mais sendo exato também é assim: (caso criar do 0) Ao usar o item, eu poderei selecionar onde eu quiser Aparecerá o portal no chão e aparecerá um efeito em cima O portal pode teleportar onde está na parte de destino no "rascunho" acima. após 60 segundos o portal sumirá e adicionará 120 segundos de cooldown. @Dwarfer
Postado Novembro 10, 2017 7 anos Em actions/scripts crie um arquivo.lua: Spoiler local t = { tp_id = 1387, effect = 1, timetoremove = {60, "sec"}, exausthed = {2, "min"}, destinations = { [1] = {x = 1, y = 1, z = 1}, [2] = {x = 1, y = 1, z = 1}, [3] = {x = 1, y = 1, z = 1} }} function onUse(cid, item, fromPosition, itemEx, toPosition) local p, exaust = getPlayerPosition(cid), getPlayerStorageValue(cid, 56990) if not isWalk(cid, toPosition) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) doSendMagicEffect(toPosition, CONST_ME_POFF) return true end if exaust > os.time() then doPlayerSendCancel(cid, "You need to wait until "..os.date("%d %B %Y %X", exaust).." to create another teleport.") doSendMagicEffect(p, CONST_ME_POFF) return true end local r, created_pos = math.random(1, #t.destinations), toPosition setPlayerStorageValue(cid, 56990, mathtime(t.exausthed) + os.time()) doCreatureSay(cid, "You created a portal to move you faster!", TALKTYPE_ORANGE_1, false, cid, created_pos) local tp = doCreateTeleport(t.tp_id, t.destinations[r], created_pos) doSendMagicEffect(created_pos, t.effect) addEvent(function() local teleport = getTileItemById(created_pos, t.tp_id).uid if teleport > 0 then doSendMagicEffect(created_pos, CONST_ME_POFF) doRemoveItem(teleport) end end, mathtime(t.timetoremove) * 1000) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function isWalk(cid, pos) pos.stackpos = 0 if getTileThingByPos(pos).uid ~= 0 then local n = getTileInfo(pos) if n.protection == false and n.house == false and getTopCreature(pos).uid == 0 and doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then return true end end end No actions.xml, adicione a tag: <action itemid="ID_DO_ITEM" script="NOMEDOARQUIVO.lua" /> Não tive como testar. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Novembro 12, 2017 7 anos local Configs = { Teleport_ID = 1387, Effect = 10, Time_To_Remove = 60, Exhaust_Use = 120, Destinations = { {x = 85, y = 121, z = 6}, {x = 85, y = 122, z = 6}, {x = 85, y = 123, z = 6}, {x = 86, y = 121, z = 6}, {x = 86, y = 122, z = 6} } } local function isWalk(cid, Position) Position.stackpos = 0 if getTileThingByPos(Position).uid ~= 0 then local TileInfo = getTileInfo(Position) if getTopCreature(Position).uid == 0 and doTileQueryAdd(cid, Position) == RETURNVALUE_NOERROR then return true end end end local function removeTeleport(Position) local Teleport = getTileItemById(Position, Configs.Teleport_ID).uid if Teleport > 0 then doSendMagicEffect(Position, CONST_ME_POFF) doRemoveItem(Teleport) end return true end local function checkPosition(Position) for i = 1, #Configs.Destinations do if Position.x == Configs.Destinations[i].x and Position.y == Configs.Destinations[i].y and Position.z == Configs.Destinations[i].z then return false end end return true end function onUse(cid, item, fromPosition, itemEx, toPosition) local Exhausted = getPlayerStorageValue(cid, 55335) if os.time() < Exhausted then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait ".. Exhausted - os.time() .." seconds to create another teleport.") return true end if isWalk(cid, toPosition) and checkPosition(toPosition) then setPlayerStorageValue(cid, 55335, os.time() + Configs.Exhaust_Use) doCreateTeleport(Configs.Teleport_ID, Configs.Destinations[math.random(1, #Configs.Destinations)], toPosition) doSendMagicEffect(toPosition, Configs.Effect) addEvent(removeTeleport, Configs.Time_To_Remove * 1000, toPosition) else doPlayerSendCancel(cid, "Sorry, not possible.") doSendMagicEffect(toPosition, CONST_ME_POFF) end return true end Editado Novembro 12, 2017 7 anos por Danyel Varejao (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.