local config = {
monsterPositions = {
[{x = 100, y = 100, z = 7}] = {"ice golem", "crystal spider", "frost dragon"},
[{x = 100, y = 101, z = 7}] = {"ice golem", "ice witch", "frost dragon"}
},
bossPosition = {x = 110, y = 110, z = 7, stackpos = 255},
bossNewPosition = {x = 110, y = 100, z = 7},
storage = 5000
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.itemid == 7362 and item.itemid == 2361) then
if(getGlobalStorageValue(config.storage) == -1) then
if(math.random(1, 5) == 1) then
doCreatureSay(cid, "The frozen starlight shattered, but you have awoken the icewitch Yakchal from her slumber! She seems not amused ...", TALKTYPE_ORANGE_1)
doPlayerRemoveItem(item.uid, 1)
else
doCreatureSay(cid, "You have awoken the icewitch Yakchal from her slumber! She seems not amused ...", TALKTYPE_ORANGE_1)
end
doSummonCreature("yakchal", config.bossPosition)
setGlobalStorageValue(config.storage, 1)
addEvent(setGlobalStorageValue, 15 * 60 * 1000, config.storage, -1)
for k, v in pairs(config.monsterPositions) do
timer = 7 * 1000
for i = 1, 3 do
addEvent(doSummonCreature, timer, v[i], k)
addEvent(doSendMagicEffect, timer, k, CONST_ME_TELEPORT)
timer = timer + 60 * 1000
end
end
addEvent(doTeleportThing, 3 * 60 * 1000 + 7 * 1000, getThingfromPos(config.bossPosition).uid, config.bossNewPosition)
addEvent(doSendMagicEffect, 3 * 60 * 1000 + 7 * 1000, config.bossNewPosition, CONST_ME_TELEPORT)
else
doPlayerSendCancel(cid,"You can not use this object.")
end
end
return true
end