SixNine
Active Member
- Joined
- Dec 12, 2018
- Messages
- 484
- Reaction score
- 46
Hi,
so installed this ani script which works sorta it ask for players it detects if someone is below x level and etc the only think that do not work is that it doesn't teleport which makes no sense when pos x,y,z is correct, so basically you press on lever and nothing happens it do not teleport you, then if you press it again it says that someone is in the quest
so installed this ani script which works sorta it ask for players it detects if someone is below x level and etc the only think that do not work is that it doesn't teleport which makes no sense when pos x,y,z is correct, so basically you press on lever and nothing happens it do not teleport you, then if you press it again it says that someone is in the quest
LUA:
local positions = {
{fromPosition = Position(543, 716, 7), toPosition = Position(539, 762, 8)},
{fromPosition = Position(539, 717, 7), toPosition = Position(554, 762, 8)},
{fromPosition = Position(547, 717, 7), toPosition = Position(569, 762, 8)},
{fromPosition = Position(543, 721, 7), toPosition = Position(585, 762, 8)}
}
local demons = {
[1] = Position(1101, 1405, 11),
[2] = Position(1103, 1405, 11),
[3] = Position(1102, 1409, 11),
[4] = Position(1104, 1409, 11),
[5] = Position(1105, 1407, 11),
[6] = Position(1106, 1407, 11)
}
local pull_pos = Position(543, 722, 7)
local duration = 30 -- in minutes
local function resetAnnihilator(uid)
local item = Item(uid)
if item.itemid == 1946 then
item:transform(1945)
end
for i = 1, #demons do
local creatures = Tile(demons[i]):getCreatures()
for key, creature in pairs(creatures) do
if creature:getName() == "Demon" then
creature:remove()
end
end
end
for key, value in pairs(positions) do
local creatures = Tile(value.toPosition):getCreatures()
for k, creature in pairs(creatures) do
if creature:getName() == "Demon" then
creature:remove()
end
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local players = {}
for i = 1, #positions do
if positions[i].fromPosition == pull_pos and player:getPosition() ~= pull_pos then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You are in the wrong position.')
return false
end
local creature = Tile(positions[i].fromPosition):getBottomCreature()
if creature then
local temp_player = creature:getPlayer()
if not temp_player then
player:sendTextMessage(MESSAGE_INFO_DESCR, creature:getName()..' is not a valid participant.')
return false
end
if temp_player:getLevel() < 200 then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'Some players are under the required level 200.')
return false
end
players[#players + 1] = temp_player
end
end
if #players ~= 4 then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You do not have the required amount of players.')
return false
end
for i = 1, #players do
local temp_player = players[i]
if creature then
players[i]:teleportTo(positions[i].toPosition)
positions[i].toPosition:sendMagicEffect(CONST_ME_TELEPORT)
end
end
for i = 1, #demons do
doSummonCreature('Demon', demons[i], false, true)
end
item:transform(1946)
addEvent(resetAnnihilator, duration*60*1000, item.uid)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'Someone has recently started this quest, the cooldown is '..duration..' minutes.')
return false
end
return true
end