OTcreator
Well-Known Member
- Joined
- Feb 14, 2022
- Messages
- 480
- Solutions
- 1
- Reaction score
- 50
Hello!
I need this script for TFS 1.4.2. [MOVEMENTS]
I need this script for TFS 1.4.2. [MOVEMENTS]
LUA:
local teleports = {
[1054] = {boss = "Necropharus", task = "Necromancers", telePos = {x = 270, y = 374, z = 11}, spawnPos = {x = 270, y = 371, z = 11}, from = {x = 267, y = 367, z = 11}, to = {x = 272, y = 374, z = 11}},
[1009] = {boss = "The Horned Fox", task = "Minotaurs", telePos = {x = 1880, y = 1266, z = 9}, spawnPos = {x = 1884, y = 1265, z = 9}, from = {x = 1882, y = 1261, z = 9}, to = {x = 1886, y = 1266, z = 9}},
[1053] = {boss = "Ron The Ripper", task = "Pirates", telePos = {x = 343, y = 864, z = 6}, spawnPos = {x = 344, y = 858, z = 6}, from = {x = 341, y = 860, z = 6}, to = {x = 347, y = 864, z = 6}},
[1022] = {boss = "Demodras", task = "Dragon Lords", telePos = {x = 1876, y = 1271, z = 8}, spawnPos = {x = 1878, y = 1267, z = 8}, from = {x = 1878, y = 1265, z = 8}, to = {x = 1881, y = 1269, z = 8}},
[1029] = {boss = "Tiquandas Revenge", task = "Carniphila", telePos = {x = 1417, y = 814, z = 7}, spawnPos = {x = 1415, y = 807, z = 7}, from = {x = 1412, y = 805, z = 7}, to = {x = 1420, y = 811, z = 7}},
}
local function getCreaturesInArena(fromPos, toPos, getMonsters)
local creaturesInArena = {}
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
for z = fromPos.z, toPos.z do
local creature = getTopCreature({x = x, y = y, z = z}).uid
if creature and (getMonsters and isMonster(creature) or not getMonsters and isPlayer(creature)) then
table.insert(creaturesInArena, creature)
end
end
end
end
return creaturesInArena
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local arena = teleports[item.uid]
local boss = arena.boss
local task = arena.task
if not isPlayer(cid) then
return true
end
if (#getCreaturesInArena(arena.from, arena.to, false) > 0) then
doTeleportThing(cid, fromPosition, true)
doPlayerSendCancel(cid, "Wait. Someone else is in the room.")
return true
end
if not (getPlayerStorageValue(cid, (item.uid)) == 1) then
doCreatureSay(cid, "You already killed ".. boss .." or you do not have a completed ".. task .." task.", TALKTYPE_ORANGE_1)
doTeleportThing(cid, fromPosition, false)
return true
end
if (#getCreaturesInArena(arena.from, arena.to, true) > 0) then
for _, anyMonsterOnArena in ipairs(getCreaturesInArena(arena.from, arena.to, true)) do
doRemoveCreature(anyMonsterOnArena)
end
end
doTeleportThing(cid, arena.telePos)
doSendMagicEffect(arena.telePos, CONST_ME_TELEPORT)
doSummonCreature(boss, arena.spawnPos)
doSendMagicEffect(arena.spawnPos, CONST_ME_TELEPORT)
return true
end