Hello.
I have problem with this moveevents scripts. When in room have monster, not remove him.
Create next , and next...
Who can edit this for me?
I have problem with this moveevents scripts. When in room have monster, not remove him.
Create next , and next...
Who can edit this for me?
Lua:
local teleports = {
-- Tile UID = {storage of task, amount of monsters, monsters to spawn}
[1054] = {monsters = {"Necropharus"}, telePos = {x = 270, y = 374, z = 11}, spawnPos = {x = 270, y = 371, z = 11}, from = {x = 267, y = 367, z = 11}, to = {x = 272, y = 374, z = 11}},
[1009] = {monsters = {"The Horned Fox"}, telePos = {x = 1880, y = 1266, z = 9}, spawnPos = {x = 1884, y = 1265, z = 9}, from = {x = 1882, y = 1261, z = 9}, to = {x = 1886, y = 1266, z = 9}},
[1053] = {monsters = {"Ron The Ripper"}, telePos = {x = 343, y = 864, z = 6}, spawnPos = {x = 344, y = 858, z = 6}, from = {x = 341, y = 860, z = 6}, to = {x = 347, y = 864, z = 6}},
[1022] = {monsters = {"Demodras"}, telePos = {x = 1876, y = 1271, z = 8}, spawnPos = {x = 1878, y = 1267, z = 8}, from = {x = 1878, y = 1265, z = 8}, to = {x = 1881, y = 1269, z = 8}},
[1029] = {monsters = {"Tiquandas Revenge"}, telePos = {x = 1417, y = 814, z = 7}, spawnPos = {x = 1415, y = 807, z = 7}, from = {x = 1412, y = 805, z = 7}, to = {x = 1420, y = 811, z = 7}},
}
local function getCreaturesInArea(fromPos, toPos, creatureType)
local creatures = {}
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
for z = fromPos.z, toPos.z do
local creature = getTopCreature({x = x, y = y, z = z}).uid
local cType creatureType:lower()
if (cType == "players" and isPlayer(creature)) then
table.insert(creatures, creature)
elseif (cType == "monsters" and isMonster(creature)) then
table.insert(creatures, creature)
elseif (cType == "npcs" and isNpc(creature)) then
table.insert(creatures, creature)
elseif (cType == "all") then
table.insert(creatures, creature)
end
end
end
end
return creatures
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local now = teleports[item.uid]
if (#getCreaturesInArea(now.from, now.to, "players") > 0) then
doTeleportThing(cid, fromPosition, true)
doPlayerSendCancel(cid, "Someone else is in the room.")
end
if getPlayerStorageValue(cid,(90000+item.uid)) == 999 then
for _, monster in ipairs(getCreaturesInArea(now.from, now.to, "monsters")) do
doRemoveCreature(monster)
end
setPlayerStorageValue(cid,(90000+item.uid),1000)
doTeleportThing(cid, now.telePos)
doSendMagicEffect(now.telePos, CONST_ME_TELEPORT)
doCreatureSay(cid, "This is your last chance to kill this boss!", TALKTYPE_ORANGE_1, false, cid)
doSummonCreature(now.monsters[math.random(#now.monsters)], now.spawnPos)
doSendMagicEffect(now.spawnPos, CONST_ME_TELEPORT)
return true
end
doPlayerOpenChannel(cid, 16)
doPlayerSendChannelMessage(cid,"Daniel Steelsoul","You already kill this boss or you do not have a completed task.", TALKTYPE_CHANNEL_MANAGEMENT, 16)
doTeleportThing(cid, fromPosition, true)
return true
end