pdrhtdn
New Member
- Joined
- Feb 8, 2022
- Messages
- 5
- Reaction score
- 0
Hi everyone, I've been digging here and on other forums a way to add a cooldown to a lever so the player (solo or in a team of 5) that pulls it can only pull again after 20 hours. For example I've been working on Duke Krule, and I got this so far:
Also, the boss should disappear if the player leaves the room or got killed by it. Appreciate all the help!
Lua:
local config = {
centerRoom = Position(33456, 31473, 13),
BossPosition = Position(33456, 31473, 13),
newPosition = Position(33457, 31466, 13)
}
local graveDangerDukeKruleLever = Action()
function graveDangerDukeKruleLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 then
if player:getPosition() ~= Position(33455, 31493, 13) then
item:transform(9826)
return true
end
end
if item.itemid == 9825 then
local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Duke Krule right now.")
return true
end
end
Game.createMonster("Duke Krule", config.BossPosition, true, true)
for x = 33455, 33459 do
local playerTile = Tile(Position(x, 31493, 13)):getTopCreature()
if playerTile and playerTile:isPlayer() then
playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
playerTile:teleportTo(config.newPosition)
playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end
addEvent(clearForgotten, 30 * 60 * 1000, Position(33446, 33462, 13), Position(33465, 31482, 13), Position(32347, 32167, 12))
item:transform(9826)
elseif item.itemid == 9826 then
item:transform(9825)
end
return true
end
graveDangerDukeKruleLever:uid(30498)
graveDangerDukeKruleLever:register()
Also, the boss should disappear if the player leaves the room or got killed by it. Appreciate all the help!