Code:
-- Made by Third Aid
function monsterSpawns()
local monsters = {"Giant Spider", "Hydra", "Gazer", "Demon Skeleton", "Dark Torturer", "Fury", "Merlkin", "Grim Reaper", "Zombie", "Witch", "Undead Gladiator", "Banshee", "Vampire Bride",
"Dwarf Geomancer", "Kongra"}
local monstersPos = {x=1571, y=1169, z=7} -- Where the monsters should be spawned
local bombPos = {x=1565, y=1170, z=7, stackpos=2} -- Position of the bomb
local getBomb = getThingFromPos(bombPos)
local northWestX = 1559 -- North West X of the room with the bomb
local northEastX = 1571 -- North East X of the room with the bomb
local northWestY = 1167 -- North West Y of the room with the bomb
local southWestY = 1173 -- South West Y of the room with the bomb
local roomFloor = 7 -- 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=1518, y=1141, z=7, stackpos=STACKPOS_TOP_CREATURE} -- The tiles they should stand on when pulling the switch
local playerPos2 = {x=1517, y=1141, z=7, stackpos=STACKPOS_TOP_CREATURE}
local playerPos3 = {x=1516, y=1141, z=7, stackpos=STACKPOS_TOP_CREATURE}
local playerPos4 = {x=1515, y=1141, z=7, stackpos=STACKPOS_TOP_CREATURE}
local getPlayerPos1 = getThingFromPos(playerPos1)
local getPlayerPos2 = getThingFromPos(playerPos2)
local getPlayerPos3 = getThingFromPos(playerPos3)
local getPlayerPos4 = getThingFromPos(playerPos4)
local newPlayerPos1 = {x=1567, y=1169, z=7} -- Where they get teleported in the room with the bomb
local newPlayerPos2 = {x=1563, y=1169, z=7}
local newPlayerPos3 = {x=1567, y=1171, z=7}
local newPlayerPos4 = {x=1563, y=1171, z=7}
local wallName = "Brick Wall" -- Name of the "Wall monster"
local wallPos = {x=1572, y=1170, z=7} -- 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=1565, y=1170, z=7}, "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 5 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
Help please, How do I make it so that you can pull the lever every 15 minutes?
I will add rep+!