local config = {
cooldown = 30, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown)
cooldown_storage = 808855,
duration = 1, -- time till reset, in minutes (lever cooldown)
level_req = 8, -- minimum level to do quest
min_players = 1, -- minimum players to join quest
lever_id = 9825, -- id of lever before pulled
pulled_id = 9826, -- id of lever after pulled
}
local player_positions = {
[1] = {fromPos = Position(33918, 31626, 8), toPos = Position(33918, 31639, 8)},
[2] = {fromPos = Position(33919, 31626, 8), toPos = Position(33918, 31639, 8)},
[3] = {fromPos = Position(33920, 31626, 8), toPos = Position(33918, 31639, 8)}...
I tested all two, and to no avail. I'm desperate for one that worksTry these ones
Lua - bug boss lever
Can anyone tell me where is wrong in this script? Only one person who pulled the lever is left with storage and how else can he pull again, or the correct one is all the main ones for the boss who can no longer go, that is, wait or return again. otg 1.3, version 12.40 local config = {...otland.netLua - How do i add exausted to a boss lever?
I want the player to only be able to pull the lever every 20h, can anyone teach me? local config = { duration = 10, -- time till reset, in minutes level_req = 150, -- minimum level to do quest min_players = 1, -- minimum players to join quest lever_id = 9825, -- id of lever...otland.net
I tested all two, and to no avail. I'm desperate for one that works
TFS 1.3 - 12.xbut which server do you use and what version? Here it worked perfectly even the players use it.
Do you not have any base scripts, which you are currently trying, with their respective "error"?TFS 1.3 - 12.x
local config = {
cooldown = 30, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown)
cooldown_storage = 808855,
duration = 1, -- time till reset, in minutes (lever cooldown)
level_req = 8, -- minimum level to do quest
min_players = 1, -- minimum players to join quest
lever_id = 9825, -- id of lever before pulled
pulled_id = 9826, -- id of lever after pulled
}
local player_positions = {
[1] = {fromPos = Position(33918, 31626, 8), toPos = Position(33918, 31639, 8)},
[2] = {fromPos = Position(33919, 31626, 8), toPos = Position(33918, 31639, 8)},
[3] = {fromPos = Position(33920, 31626, 8), toPos = Position(33918, 31639, 8)},
[4] = {fromPos = Position(33921, 31626, 8), toPos = Position(33918, 31639, 8)},
[5] = {fromPos = Position(33922, 31626, 8), toPos = Position(33918, 31639, 8)}
}
local monsters = {
[1] = {pos = Position(33919, 31646, 8), name = "Urmahlullu the Weakened"}
}
local quest_range = {fromPos = Position(33908, 31636, 8), toPos = Position(33930, 31662, 8)} -- see image in thread for explanation
local exit_position = Position(32369, 32241, 7) -- Position completely outside the quest area
function doResetTheBossDukeKrule(position, cid_array)
local tile = Tile(position)
local item = tile and tile:getItemById(config.pulled_id)
if not item then
return
end
local monster_names = {}
for key, value in pairs(monsters) do
if not isInArray(monster_names, value.name) then
monster_names[#monster_names + 1] = value.name
end
end
for i = 1, #monsters do
local creatures = Tile(monsters[i].pos):getCreatures()
for key, creature in pairs(creatures) do
if isInArray(monster_names, creature:getName()) then
creature:remove()
end
end
end
for i = 1, #player_positions do
local creatures = Tile(player_positions[i].toPos):getCreatures()
for key, creature in pairs(creatures) do
if isInArray(monster_names, creature:getName()) then
creature:remove()
end
end
end
for key, cid in pairs(cid_array) do
local participant = Player(cid)
if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then
participant:teleportTo(exit_position)
exit_position:sendMagicEffect(CONST_ME_TELEPORT)
end
end
item:transform(config.lever_id)
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(config.cooldown_storage) >= os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Lever is broke, try tomorrow")
return true
end
local participants, pull_player = {}, false
for i = 1, #player_positions do
local fromPos = player_positions[i].fromPos
local tile = Tile(fromPos)
if not tile then
print(">> ERROR: Annihilator tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").")
return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
end
local creature = tile:getBottomCreature()
if creature then
local participant = creature:getPlayer()
if not participant then
return player:sendCancelMessage(participant:getName() .. " is not a valid participant.")
end
if participant:getLevel() < config.level_req then
return player:sendCancelMessage(participant:getName() .. " is not the required level.")
end
if participant.uid == player.uid then
pull_player = true
end
participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos}
end
end
if #participants < config.min_players then
return player:sendCancelMessage("You do not have the required amount of participants.")
end
if not pull_player then
return player:sendCancelMessage("You are in the wrong position.")
end
for i = 1, #monsters do
local toPos = monsters[i].pos
if not Tile(toPos) then
print(">> ERROR: Annihilator tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").")
return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
end
Game.createMonster(monsters[i].name, monsters[i].pos, false, true)
end
local cid_array = {}
for i = 1, #participants do
participants[i].participant:teleportTo(participants[i].toPos)
participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT)
cid_array[#cid_array + 1] = participants[i].participant.uid
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
end
item:transform(config.pulled_id)
player:setStorageValue(config.cooldown_storage, os.time() + config.cooldown)
addEvent(doResetTheBossDukeKrule, config.duration * 60 * 1000, toPosition, cid_array)
return true
end
Any script?
Do you not have any base scripts, which you are currently trying, with their respective "error"?
local config = {
cooldown = 30, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown)
cooldown_storage = 808855,
duration = 1, -- time till reset, in minutes (lever cooldown)
level_req = 8, -- minimum level to do quest
min_players = 1, -- minimum players to join quest
lever_id = 9825, -- id of lever before pulled
pulled_id = 9826, -- id of lever after pulled
}
local player_positions = {
[1] = {fromPos = Position(33918, 31626, 8), toPos = Position(33918, 31639, 8)},
[2] = {fromPos = Position(33919, 31626, 8), toPos = Position(33918, 31639, 8)},
[3] = {fromPos = Position(33920, 31626, 8), toPos = Position(33918, 31639, 8)},
[4] = {fromPos = Position(33921, 31626, 8), toPos = Position(33918, 31639, 8)},
[5] = {fromPos = Position(33922, 31626, 8), toPos = Position(33918, 31639, 8)}
}
local monsters = {
[1] = {pos = Position(33919, 31646, 8), name = "Urmahlullu the Weakened"}
}
local quest_range = {fromPos = Position(33908, 31636, 8), toPos = Position(33930, 31662, 8)} -- see image in thread for explanation
local exit_position = Position(32369, 32241, 7) -- Position completely outside the quest area
function doResetTheBossDukeKrule(position, cid_array)
local tile = Tile(position)
local item = tile and tile:getItemById(config.pulled_id)
if not item then
return
end
local monster_names = {}
for key, value in pairs(monsters) do
if not isInArray(monster_names, value.name) then
monster_names[#monster_names + 1] = value.name
end
end
for i = 1, #monsters do
local creatures = Tile(monsters[i].pos):getCreatures()
for key, creature in pairs(creatures) do
if isInArray(monster_names, creature:getName()) then
creature:remove()
end
end
end
for i = 1, #player_positions do
local creatures = Tile(player_positions[i].toPos):getCreatures()
for key, creature in pairs(creatures) do
if isInArray(monster_names, creature:getName()) then
creature:remove()
end
end
end
for key, cid in pairs(cid_array) do
local participant = Player(cid)
if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then
participant:teleportTo(exit_position)
exit_position:sendMagicEffect(CONST_ME_TELEPORT)
end
end
item:transform(config.lever_id)
end
local function removeBoss()
local specs, spec = Game.getSpectators(Position(33919, 31646, 8), false, false, 18, 18, 18, 18)
for j = 1, #specs do
spec = specs[j]
if spec:getName():lower() == 'urmahlullu the weakened' then
spec:remove()
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(config.cooldown_storage) >= os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Lever is broke, try tomorrow")
return true
end
local participants, pull_player = {}, false
for i = 1, #player_positions do
local fromPos = player_positions[i].fromPos
local tile = Tile(fromPos)
if not tile then
print(">> ERROR: Annihilator tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").")
return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
end
local creature = tile:getBottomCreature()
if creature then
local participant = creature:getPlayer()
if not participant then
return player:sendCancelMessage(participant:getName() .. " is not a valid participant.")
end
if participant:getLevel() < config.level_req then
return player:sendCancelMessage(participant:getName() .. " is not the required level.")
end
if participant.uid == player.uid then
pull_player = true
end
participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos}
end
end
if #participants < config.min_players then
return player:sendCancelMessage("You do not have the required amount of participants.")
end
if not pull_player then
return player:sendCancelMessage("You are in the wrong position.")
end
for i = 1, #monsters do
local toPos = monsters[i].pos
if not Tile(toPos) then
print(">> ERROR: Annihilator tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").")
return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
end
removeBoss()
Game.createMonster(monsters[i].name, monsters[i].pos, false, true)
end
local cid_array = {}
for i = 1, #participants do
participants[i].participant:teleportTo(participants[i].toPos)
participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT)
cid_array[#cid_array + 1] = participants[i].participant.uid
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
end
item:transform(config.pulled_id)
player:setStorageValue(config.cooldown_storage, os.time() + config.cooldown)
addEvent(doResetTheBossDukeKrule, config.duration * 60 * 1000, toPosition, cid_array)
return true
end
OMG, you're my hero.. <3Try this:
Lua:local config = { cooldown = 30, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown) cooldown_storage = 808855, duration = 1, -- time till reset, in minutes (lever cooldown) level_req = 8, -- minimum level to do quest min_players = 1, -- minimum players to join quest lever_id = 9825, -- id of lever before pulled pulled_id = 9826, -- id of lever after pulled } local player_positions = { [1] = {fromPos = Position(33918, 31626, 8), toPos = Position(33918, 31639, 8)}, [2] = {fromPos = Position(33919, 31626, 8), toPos = Position(33918, 31639, 8)}, [3] = {fromPos = Position(33920, 31626, 8), toPos = Position(33918, 31639, 8)}, [4] = {fromPos = Position(33921, 31626, 8), toPos = Position(33918, 31639, 8)}, [5] = {fromPos = Position(33922, 31626, 8), toPos = Position(33918, 31639, 8)} } local monsters = { [1] = {pos = Position(33919, 31646, 8), name = "Urmahlullu the Weakened"} } local quest_range = {fromPos = Position(33908, 31636, 8), toPos = Position(33930, 31662, 8)} -- see image in thread for explanation local exit_position = Position(32369, 32241, 7) -- Position completely outside the quest area function doResetTheBossDukeKrule(position, cid_array) local tile = Tile(position) local item = tile and tile:getItemById(config.pulled_id) if not item then return end local monster_names = {} for key, value in pairs(monsters) do if not isInArray(monster_names, value.name) then monster_names[#monster_names + 1] = value.name end end for i = 1, #monsters do local creatures = Tile(monsters[i].pos):getCreatures() for key, creature in pairs(creatures) do if isInArray(monster_names, creature:getName()) then creature:remove() end end end for i = 1, #player_positions do local creatures = Tile(player_positions[i].toPos):getCreatures() for key, creature in pairs(creatures) do if isInArray(monster_names, creature:getName()) then creature:remove() end end end for key, cid in pairs(cid_array) do local participant = Player(cid) if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then participant:teleportTo(exit_position) exit_position:sendMagicEffect(CONST_ME_TELEPORT) end end item:transform(config.lever_id) end local function removeBoss() local specs, spec = Game.getSpectators(Position(33919, 31646, 8), false, false, 18, 18, 18, 18) for j = 1, #specs do spec = specs[j] if spec:getName():lower() == 'urmahlullu the weakened' then spec:remove() end end end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(config.cooldown_storage) >= os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Lever is broke, try tomorrow") return true end local participants, pull_player = {}, false for i = 1, #player_positions do local fromPos = player_positions[i].fromPos local tile = Tile(fromPos) if not tile then print(">> ERROR: Annihilator tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").") return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.") end local creature = tile:getBottomCreature() if creature then local participant = creature:getPlayer() if not participant then return player:sendCancelMessage(participant:getName() .. " is not a valid participant.") end if participant:getLevel() < config.level_req then return player:sendCancelMessage(participant:getName() .. " is not the required level.") end if participant.uid == player.uid then pull_player = true end participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos} end end if #participants < config.min_players then return player:sendCancelMessage("You do not have the required amount of participants.") end if not pull_player then return player:sendCancelMessage("You are in the wrong position.") end for i = 1, #monsters do local toPos = monsters[i].pos if not Tile(toPos) then print(">> ERROR: Annihilator tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").") return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.") end removeBoss() Game.createMonster(monsters[i].name, monsters[i].pos, false, true) end local cid_array = {} for i = 1, #participants do participants[i].participant:teleportTo(participants[i].toPos) participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT) cid_array[#cid_array + 1] = participants[i].participant.uid player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.") end item:transform(config.pulled_id) player:setStorageValue(config.cooldown_storage, os.time() + config.cooldown) addEvent(doResetTheBossDukeKrule, config.duration * 60 * 1000, toPosition, cid_array) return true end
local function removeBoss()
local specs, spec = Game.getSpectators(Position(33919, 31646, 8), false, false, 18, 18, 18, 18)
for j = 1, #specs do
spec = specs[j]
if spec:getName():lower() == 'urmahlullu the weakened' then
spec:remove()
end
end
end
No problem, if you want add other bosses, change this the function:
Lua:local function removeBoss() local specs, spec = Game.getSpectators(Position(33919, 31646, 8), false, false, 18, 18, 18, 18) for j = 1, #specs do spec = specs[j] if spec:getName():lower() == 'urmahlullu the weakened' then spec:remove() end end end
Center room pos (33919, 31646, 8)
Room's width and height [SQM] (18, 18, 18, 18)
Boss name: urmahlullu the weakened
Room's width and height [SQM] (18, 18, 18, 18)
Yep !i really didn't understand this part:
does it means i have 18 SQM to north, 18 SQM to south, 18 SQM to west and 18 SQM to east ?????Lua:Room's width and height [SQM] (18, 18, 18, 18)
Yep !
it works but the problem is when I leave the room, the boss doesn't disappear. so the next one to enter, stay with 2 boss
This is an error in the script, not in the part of cleaning the monsters
I didn't see all script, only add to remove the boss when use the item.
Sorry, but I can't think, how to do it now. My scripts always use this parameter.as it is a single boss on the entire map, wouldn't it have a script without needing a position? to remove it, since it is unique.
Sorry, but I can't think, how to do it now. My scripts always use this parameter.
local function removeBoss()
local spectators = Game.getSpectators(Position(33273, 32408, 15), false, false, 18, 18, 18, 18)
for j = 1, #spectators do
local spectator = spectators[j]
if spectator:isMonster() then
spectator:remove()
end
end
end
i have modified, and now it works:
Lua:local function removeBoss() local spectators = Game.getSpectators(Position(33273, 32408, 15), false, false, 18, 18, 18, 18) for j = 1, #spectators do local spectator = spectators[j] if spectator:isMonster() then spectator:remove() end end end