okay well i made a little arena and edited an annihilator script for it..
right now it takes one person and makes one monster....
when you pull the lever you get teleported into the room along with the monster
and right now i have it set so that, If you have a certain scroll, it will take it, (whether you have 0, or you have 99, it just takes however many of them you have, if any, and teleports you)
but here is the problem, i can't seem to get it to check if there are any players or monsters in the room, and if there are no players and a monster/corpse, to remove the corpse/monster and turn the lever back to the original state to allow someone else to attempt the quest..
the lever starts at the left, then when you pull it, it faces to the right and just gets stuck there...i get no errors in the console so i'm pretty confused as to what the problem may be...
i'm not really sure if this is the proper way to insert the script but here it is i hope someone might be able to take the time to help me
thanks a lot
local starting= {x = 888, y = 1152, z = 7} -- edit this to the top left sqm of ur annhilator room
local ending= {x = 897, y = 1161, z = 7} -- edit this to the bottom right sqm of ur annhilator room
function onUse(cid, item, frompos, item2, topos)
if item.uid == 5100 then
if item.itemid == 1945 then
ticket = getPlayerItemCount(cid,5952)
player1pos = {x=893, y=1150, z=6, stackpos=253}
player1 = getThingfromPos(player1pos)
if ticket >= 0 then
if player1.itemid > 0 then
player1level = getPlayerLevel(player1.uid)
questlevel = 20
if player1level >= questlevel then
queststatus1 = getPlayerStorageValue(player1.uid,5100)
if queststatus1 == -1 then
doPlayerRemoveItem(cid,5952,ticket)
demon1pos = {x=893, y=1157, z=7}
doSummonCreature("Lightning", demon1pos)
nplayer1pos = {x =891, y =1157, z =7}
doSendMagicEffect(player1pos,2)
doTeleportThing(player1.uid,nplayer1pos)
doSendMagicEffect(nplayer1pos,10)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
if item.itemid == 1946 then
if item.uid == 5100 then
if(cleanArea()) then
doTransformItem(item.uid, 1945)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
end
end
end
end
function cleanArea()
local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253}
local monster = {}
while(checking.y <= ending.y) do
local creature = getTopCreature(checking).uid or getTopCreature(checking)
if(isCreature(creature) == TRUE) then
if(isPlayer(creature) == TRUE) then
return false
else
table.insert(monster, creature)
end
end
if(checking.x == ending.x) then
checking.x = starting.x
checking.y = checking.y + 1
end
checking.x = checking.x + 1
end
for i, c in ipairs(monster) do
doRemoveCreature(c)
end
return true
end
return 1
end
right now it takes one person and makes one monster....
when you pull the lever you get teleported into the room along with the monster
and right now i have it set so that, If you have a certain scroll, it will take it, (whether you have 0, or you have 99, it just takes however many of them you have, if any, and teleports you)
but here is the problem, i can't seem to get it to check if there are any players or monsters in the room, and if there are no players and a monster/corpse, to remove the corpse/monster and turn the lever back to the original state to allow someone else to attempt the quest..
the lever starts at the left, then when you pull it, it faces to the right and just gets stuck there...i get no errors in the console so i'm pretty confused as to what the problem may be...
i'm not really sure if this is the proper way to insert the script but here it is i hope someone might be able to take the time to help me
thanks a lot
local starting= {x = 888, y = 1152, z = 7} -- edit this to the top left sqm of ur annhilator room
local ending= {x = 897, y = 1161, z = 7} -- edit this to the bottom right sqm of ur annhilator room
function onUse(cid, item, frompos, item2, topos)
if item.uid == 5100 then
if item.itemid == 1945 then
ticket = getPlayerItemCount(cid,5952)
player1pos = {x=893, y=1150, z=6, stackpos=253}
player1 = getThingfromPos(player1pos)
if ticket >= 0 then
if player1.itemid > 0 then
player1level = getPlayerLevel(player1.uid)
questlevel = 20
if player1level >= questlevel then
queststatus1 = getPlayerStorageValue(player1.uid,5100)
if queststatus1 == -1 then
doPlayerRemoveItem(cid,5952,ticket)
demon1pos = {x=893, y=1157, z=7}
doSummonCreature("Lightning", demon1pos)
nplayer1pos = {x =891, y =1157, z =7}
doSendMagicEffect(player1pos,2)
doTeleportThing(player1.uid,nplayer1pos)
doSendMagicEffect(nplayer1pos,10)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
if item.itemid == 1946 then
if item.uid == 5100 then
if(cleanArea()) then
doTransformItem(item.uid, 1945)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
end
end
end
end
function cleanArea()
local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253}
local monster = {}
while(checking.y <= ending.y) do
local creature = getTopCreature(checking).uid or getTopCreature(checking)
if(isCreature(creature) == TRUE) then
if(isPlayer(creature) == TRUE) then
return false
else
table.insert(monster, creature)
end
end
if(checking.x == ending.x) then
checking.x = starting.x
checking.y = checking.y + 1
end
checking.x = checking.x + 1
end
for i, c in ipairs(monster) do
doRemoveCreature(c)
end
return true
end
return 1
end