Spoking
Oldschool Developer
- Joined
- Sep 4, 2007
- Messages
- 434
- Reaction score
- 34
Hello, I edited this script, but it seems to not be working
Its the end, where it should be looking for monsters in that area.
If there are monsters, say: Please kill the monsters first.
If the area is cleared, it will do
Its the end, where it should be looking for monsters in that area.
If there are monsters, say: Please kill the monsters first.
If the area is cleared, it will do
Code:
elseif clicks == 5 and monsters1 == 0 then
setGlobalStorageValue(50000, clicks+1)
doPlayerSay(cid, "You have finished this quest, run on the chair for your reward!", 19)
addEvent(reset, 30*1*1000) -- 30 seconds
Code:
-- Config #1 --
local BlindField = {x=797, y=934, z=7, stackpos=1}
-- end --
function mapArea(fromPos, toPos, stack)
-- Area iterator by Colandus.
local pos = {x=fromPos.x, y=fromPos.y-1, z=fromPos.z}
return function()
if (pos.y < toPos.y) then
pos.y = pos.y+1
elseif (pos.x <= toPos.x) then
pos.y = fromPos.y
pos.x = pos.x+1
else
pos.x = fromPos.x
pos.y = fromPos.y
pos.z = pos.z+1
end
if (pos.x <= toPos.x and pos.y <= toPos.y or pos.z < toPos.z) then
if (stack == nil) then
return pos
else
pos.stackpos = stack
--return pos, getTileThingByPos(pos)
return pos, getThingfromPos(pos)
end
end
end
end
function getMonstersfromArea(fromPos, toPos)
local monsters = {}
for _, thing in mapArea(fromPos, toPos, 253) do
if isMonster(thing.uid) == TRUE then
table.insert(monsters, thing.uid)
end
end
local bfm = getThingfromPos(BlindField)
if isMonster(bfm.uid) == TRUE then
table.insert(monsters, bfm.uid)
end
return monsters
end
function getMonstersNumbersfromArea(fromPos, toPos)
for _, thing in mapArea(fromPos, toPos, 253) do
if isMonster(thing.uid) == TRUE then
return 1
else
return 0
end
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- CONFIG #2!!!! --
-- Map checking --
local topLeft = {x=790, y=927, z=7}
local buttomRight = {x=800, y=942, z=7}
-- Immortality of Azerus
local monsters = getMonstersfromArea(topLeft, buttomRight)
local monsters1 = getMonstersNumbersfromArea(topLeft, buttomRight)
-- Position Of TP --
local tp = {x=795, y=928, z=7}
-- Position of Gllobus
local glo = {x=795, y=934, z=7}
-- END OF CONFIG! --
function FirstWave()
doSummonCreature("Rift Worm", {x= glo.x - 4,y=glo.y,z=glo.z})
doSummonCreature("Rift Worm", {x= glo.x + 4,y=glo.y,z=glo.z})
doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 4,z=glo.z})
doSummonCreature("Rift Worm", {x=glo.x,y=glo.y - 4,z=glo.z})
doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 5,z=glo.z})
doSummonCreature("Azerus", {x=glo.x,y=glo.y - 5,z=glo.z})
end
function SecondWave()
local monsters1 = getMonstersfromArea(topLeft, buttomRight)
for _, monster in pairs(monsters1) do
if getCreatureName(monster) == "Azerus" then
doRemoveCreature(monster)
end
end
doSummonCreature("Azerus1", {x=glo.x,y=glo.y - 5,z=glo.z})
doSummonCreature("Rift Brood", {x= glo.x - 4,y=glo.y,z=glo.z})
doSummonCreature("Rift Brood", {x= glo.x + 4,y=glo.y,z=glo.z})
doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 4,z=glo.z})
doSummonCreature("Rift Brood", {x=glo.x,y=glo.y - 4,z=glo.z})
doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 5,z=glo.z})
end
function ThirdWave()
local monsters1 = getMonstersfromArea(topLeft, buttomRight)
for _, monster in pairs(monsters1) do
if getCreatureName(monster) == "Azerus" then
doRemoveCreature(monster)
end
end
doSummonCreature("Azerus2", {x= glo.x - 5,y=glo.y,z=glo.z})
doSummonCreature("Rift Scythe", {x= glo.x - 4,y=glo.y,z=glo.z})
doSummonCreature("Rift Scythe", {x= glo.x + 4,y=glo.y,z=glo.z})
end
function ThirdWave1() -- with 2s delay
doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y + 4,z=glo.z})
doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y - 4,z=glo.z})
doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y + 5,z=glo.z})
end
function FourthWave()
local monsters1 = getMonstersfromArea(topLeft, buttomRight)
for _, monster in pairs(monsters1) do
if getCreatureName(monster) == "Azerus" then
doRemoveCreature(monster)
end
end
doSummonCreature("Azerus3", {x= glo.x - 5,y=glo.y,z=glo.z})
doSummonCreature("War Golem", {x= glo.x - 4,y=glo.y,z=glo.z})
doSummonCreature("War Golem", {x= glo.x + 4,y=glo.y,z=glo.z})
doSummonCreature("War Golem", {x=glo.x,y=glo.y - 4,z=glo.z})
doSummonCreature("War Golem", {x=glo.x,y=glo.y + 4,z=glo.z})
end
function Glllobe()
local GlobePos = {x=795, y=934, z=7, stackpos = 1}
doItemSetAttribute(getThingFromPos(GlobePos).uid, "aid", 58261)
end
function reset()
setGlobalStorageValue(50000, 0)
local monsters1 = getMonstersfromArea(topLeft, buttomRight)
for _, monster in pairs(monsters1) do
doRemoveCreature(monster)
end
end
local monsters = getMonstersfromArea(topLeft, buttomRight)
local monsters1 = getMonstersNumbersfromArea(topLeft, buttomRight)
local clicks = getGlobalStorageValue(50000)
if clicks < 1 then
addEvent(FirstWave, 0)
setGlobalStorageValue(50000, 1)
elseif clicks == 1 then
addEvent(SecondWave, 0)
setGlobalStorageValue(50000, clicks+1)
elseif clicks == 2 then
addEvent(ThirdWave, 0)
addEvent(ThirdWave1, 0)
setGlobalStorageValue(50000, clicks+1)
elseif clicks == 3 then
addEvent(FourthWave, 0)
setGlobalStorageValue(50000, clicks+1)
elseif clicks == 4 then
addEvent(Glllobe, 0)
setGlobalStorageValue(50000, clicks+1)
elseif clicks == 5 and monsters1 == 0 then
setGlobalStorageValue(50000, clicks+1)
doPlayerSay(cid, "You have finished this quest, run on the chair for your reward!", 19)
addEvent(reset, 30*1*1000) -- 30 seconds
elseif clicks == 5 and monsters1 == 1 then
doPlayerSendTextMessage(cid,22,"Kill first.")
elseif clicks == 6 then
doPlayerSendTextMessage(cid, 22, "You may not spam this machine, please wait 30 seconds.")
end
return TRUE
end