Created by: Third Aid!
When i die in the quest and try to do it again, it says someone is already in the quest! when i restart the server it says same thing! tfs 0.3.6
When i die in the quest and try to do it again, it says someone is already in the quest! when i restart the server it says same thing! tfs 0.3.6
Code:
-- Made by Third Aid
function monsterSpawns()
local monsters = {"Rat", "Rotworm", "Bog Raider", "Giant Spider", "Diabolic Imp", "Destroyer", "Dark Torturer", "Behemoth", "Hellspawn", "War Golem", "Serpent Spawn", "Hellhound", "Plaguesmith",
"Demon", "Undead Dragon"}
local monstersPos = {x=4605, y=4695, z=8} -- Where the monsters should be spawned
local bombPos = {x=4600, y=4695, z=8, stackpos=2} -- Position of the bomb
local getBomb = getThingFromPos(bombPos)
local northWestX = 4595 -- North West X of the room with the bomb
local northEastX = 4607 -- North East X of the room with the bomb
local northWestY = 4692 -- North West Y of the room with the bomb
local southWestY = 4698 -- South West Y of the room with the bomb
local roomFloor = 8 -- Floor / Z of the room with the bomb
if getGlobalStorageValue(17001) == 0 then
doTransformItem(getBomb.uid, 9890)
end
setGlobalStorageValue(17001, getGlobalStorageValue(17001)+1)
doSendAnimatedText(bombPos, "" .. 16-getGlobalStorageValue(17001) .. " min", TEXTCOLOR_YELLOW)
if getGlobalStorageValue(17001) <= 15 then
doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
addEvent(monsterSpawns, 60*1000)
else
setGlobalStorageValue(17000, 0)
setGlobalStorageValue(17001, 0)
doTransformItem(getBomb.uid, 9891)
for x = northWestX, northEastX do
for y = northWestY, southWestY do
local explosionArea = {x=x, y=y, z=roomFloor, stackPos=253}
local getCreatures = getTopCreature(explosionArea).uid
doSendMagicEffect(explosionArea, CONST_ME_FIREATTACK)
if(isCreature(getCreatures) == TRUE) then
doCreatureAddHealth(getCreatures, -getCreatureHealth(getCreatures))
end
end
end
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(pid, 17000) == 1 then
setPlayerStorageValue(pid, 17000, 0)
doCreatureAddHealth(pid, -getCreatureHealth(pid))
setGlobalStorageValue(17000, 0)
end
end
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos1 = {x=4935, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE} -- The tiles they should stand on when pulling the switch
local playerPos2 = {x=4934, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
local playerPos3 = {x=4933, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
local playerPos4 = {x=4932, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
local getPlayerPos1 = getThingFromPos(playerPos1)
local getPlayerPos2 = getThingFromPos(playerPos2)
local getPlayerPos3 = getThingFromPos(playerPos3)
local getPlayerPos4 = getThingFromPos(playerPos4)
local newPlayerPos1 = {x=4602, y=4694, z=8} -- Where they get teleported in the room with the bomb
local newPlayerPos2 = {x=4602, y=4696, z=8}
local newPlayerPos3 = {x=4598, y=4694, z=8}
local newPlayerPos4 = {x=4598, y=4696, z=8}
local wallName = "Brick Wall" -- Name of the "Wall monster"
local wallPos = {x=4607, y=4695, z=8} -- Where the wall should be
if getPlayerPos1.itemid > 0 and getPlayerPos2.itemid > 0 and getPlayerPos3.itemid > 0 and getPlayerPos4.itemid > 0 then
if getGlobalStorageValue(17000) <= 0 then
setPlayerStorageValue(getPlayerPos1.uid, 17000, 1)
setPlayerStorageValue(getPlayerPos2.uid, 17000, 1)
setPlayerStorageValue(getPlayerPos3.uid, 17000, 1)
setPlayerStorageValue(getPlayerPos4.uid, 17000, 1)
doTeleportThing(getPlayerPos1.uid, newPlayerPos1)
doTeleportThing(getPlayerPos2.uid, newPlayerPos2)
doTeleportThing(getPlayerPos3.uid, newPlayerPos3)
doTeleportThing(getPlayerPos4.uid, newPlayerPos4)
doSendMagicEffect(newPlayerPos1, CONST_ME_TELEPORT)
doSendMagicEffect(newPlayerPos2, CONST_ME_TELEPORT)
doSendMagicEffect(newPlayerPos3, CONST_ME_TELEPORT)
doSendMagicEffect(newPlayerPos4, CONST_ME_TELEPORT)
doSendMagicEffect(playerPos1, CONST_ME_POFF)
doSendMagicEffect(playerPos2, CONST_ME_POFF)
doSendMagicEffect(playerPos3, CONST_ME_POFF)
doSendMagicEffect(playerPos4, CONST_ME_POFF)
setGlobalStorageValue(17000, 1)
setGlobalStorageValue(17001, 0)
doSummonCreature(wallName, wallPos)
addEvent(doSendAnimatedText, 30*1000, {x=4600, y=4695, z=8}, "ACTIVATED", TEXTCOLOR_GREEN)
addEvent(monsterSpawns, 30*1000)
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(pid, 17000) == 1 then
doPlayerSendTextMessage(pid, 22, "The bomb will start ticking in 30 seconds, you have 15 minutes to destroy the wall and get out of the room before it explodes! Three monsters will spawn every minute!")
end
end
else
doPlayerSendTextMessage(cid, 22, "Some people are already in there, wait until they're done.")
end
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end