• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Yalahar Quest (bug, monsters alive)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
If a team die inside of room then if next team come they have to kill all alive monsters to start quest.
How can I do to remove all monsters alive?
Lua:
function onStepIn(cid, item, position, fromPosition)

--Config-->
local starting = {x = 570, y = 550, z = 10, stackpos = 253}
local ending = {x = 592, y = 578, z = 10, stackpos = 253}
local checking = {x = starting.x, y = ending.y, z = starting.z, stackpos = starting.stackpos}
local queststatus = getPlayerStorageValue(cid, 1974)
local player_pos_entrada = {x = 582, y = 574, z = 10}
--EndConfig-->

--Do not touch this--
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
--Don't edit this unless you know what you are doing.

if item.actionid == 1974 and queststatus == -1 then
doCreatureSay(cid, "It seems by defeating Azerus you have stopped this army from entering in your world! Better leave this ghastly place forever.", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 1974, 1)
return TRUE
end

if item.actionid == 1973 and queststatus == -1 then
totalmonsters = 0
monster = {}

repeat
creature = getThingfromPos(checking)

if creature.itemid > 0 then
if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 6 then
totalmonsters = totalmonsters + 1
monster[totalmonsters] = creature.uid
end
end

checking.x = checking.x + 1

if checking.x > ending.x then
checking.x = starting.x
checking.y = checking.y + 1
end

until checking.y > ending.y

if totalmonsters ~= 0 then
current = 0
repeat
current = current + 1
doRemoveCreature(monster[current])
until current >= totalmonsters
end

doTeleportThing(cid, player_pos_entrada)
doSendMagicEffect(player_pos_entrada, 10)

else
doMoveCreature(cid, newdir)
end
end
 
I'm not a master of scripting, but try to script check first, here are monsters in area. If are, script should check area again and remove all creatures.
Code:
function onUse(cid, item, fromPosition, item2,toPosition)
  --Config-->
  local starting = {x = 2380, y = 2131, z = 12, stackpos = 253}
  local ending = {x = 2406, y = 2143, z = 12, stackpos = 253}
  local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
  local player_pos_entrada = {x = 2393, y = 2136, z = 12}
  --EndConfig-->
  --Don't edit this unless you know what you are doing.

   local players = 0
   local totalmonsters = 0
   local monster = {}
   
if (item2.itemid == 7538) or (item2.itemid == 7539) then
		if s == 1 then
			doTransformItem(item2.uid, (itemEx.itemid + 6))
			doSendMagicEffect(toPosition, CONST_ME_POFF)
			doDecayItem(item2.uid)
		else
			doSendMagicEffect(toPosition, CONST_ME_POFF)
		end
end
-- here is maybe the important part, where it checking if is monsters and then remove them.
if item2.uid == 18133 and getPlayerStorageValue(cid,18103) == 2 then
    repeat
      creature = getThingfromPos(checking)
      if creature.itemid > 0 then
        if (isPlayer(creature.uid)) then
          players = players + 1
          plname = getPlayerName(creature.uid)
        end
        if isMonster(creature.uid) then
          totalmonsters = totalmonsters + 1
          monster[totalmonsters] = creature.uid
        end
      end
      checking.x = checking.x + 1
      if checking.x > ending.x then
        checking.x = starting.x
        checking.y = checking.y + 1
      end
    until checking.y > ending.y
    if players == 0 then
      if totalmonsters ~= 0 then
        current = 0
        repeat
          current = current + 1
          doRemoveCreature(monster[current])
        until current >= totalmonsters	
      end 
      doTeleportThing(cid, player_pos_entrada)
      doSendMagicEffect(player_pos_entrada, 10)
    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ''.. plname .. ' is in the room now. Wait a moment!')
    end
else
    doPlayerSendCancel(cid, 'You cannot use this object.')
end
return true
end

I've found this script, when I searched for Pythius the Rotten teleport, so script is not mine!
It checking, on arena is players or monsters. If is player, script won't work, if is monster without players, script remove him.
I hope, I helped you :)
 
Back
Top