Postado Setembro 14, 2024 Set 14 Olá, preciso de um script que funcione, ou seja, temos 2 cidades e um destino, ou seja Lar Página inicial1 TC Se entrarmos no teletransporte em Home e formos para TC, voltamos para Home, não para Home1, e o mesmo com home2, se entrarmos em Home2 no teletransporte e formos para TC, voltamos para Home2 TFS 1.2 Editado Setembro 14, 2024 Set 14 por Black Frost21 (veja o histórico de edições)
Postado Setembro 15, 2024 Set 15 <!-- StepIn for multiple action IDs leading to the PVP arena --> <movevent event="StepIn" actionid="7400" script="arenaPVP.lua" /> <movevent event="StepIn" actionid="7401" script="arenaPVP.lua" /> <!-- StepIn for returning to the saved position --> <movevent event="StepIn" actionid="7402" script="backsavedposition.lua" /> arenaPVP.lua function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return true end -- Save the player's current position to storage local playerPosition = player:getPosition() -- Save the exact X, Y, Z coordinates in player's storage player:setStorageValue(50001, playerPosition.x) -- Save X position player:setStorageValue(50002, playerPosition.y) -- Save Y position player:setStorageValue(50003, playerPosition.z) -- Save Z position -- Teleport the player to the PVP area local pvpPosition = Position(158, 122, 7) -- Coordinates of the PVP area player:teleportTo(pvpPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) -- Send a welcome message player:sendTextMessage(MESSAGE_INFO_DESCR, "Welcome to the PVP area. Fight with honor!") return true end backsavedposition.lua function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return true end -- Retrieve the player's original position from storage local x = player:getStorageValue(50001) local y = player:getStorageValue(50002) local z = player:getStorageValue(50003) -- Check if the position is valid (storage returns -1 if nothing was saved) if x == -1 or y == -1 or z == -1 then player:sendTextMessage(MESSAGE_STATUS_WARNING, "Error: No original position found.") return true end -- Increment Y by 1 to move the player down one tile y = y + 1 -- Create the corrected original position object using the stored values local originalPosition = Position(x, y, z) -- Teleport the player back to their adjusted original position player:teleportTo(originalPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end
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.