flaviiojr
Active Member
- Joined
- Jan 20, 2017
- Messages
- 230
- Solutions
- 13
- Reaction score
- 39
By killing the "parasite" creature 4 times next to the wall, the wall does not disappear ...
Could you help me figure out why you're not removing the wall? Thank you very much in advance!
Could you help me figure out why you're not removing the wall? Thank you very much in advance!
Lua:
local positions = {
Position(33097, 31976, 11),
Position(33097, 31977, 11),
Position(33097, 31978, 11),
Position(33097, 31979, 11)
}
local barrierPositions = {
Position(33098, 31976, 11),
Position(33098, 31977, 11),
Position(33098, 31978, 11),
Position(33098, 31979, 11)
}
local function clearArena()
local spectators = Game.getSpectators(Position(33114, 31956, 11), false, false, 10, 10, 13, 13)
local exitPosition = Position(33011, 31937, 11)
for i = 1, #spectators do
local spectator = spectators[i]
if spectator:isPlayer() then
spectator:teleportTo(exitPosition)
exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You were teleported out by the gnomish emergency device.')
return
end
spectator:remove()
end
end
function onKill(creature, target)
if not target:isMonster() or target:getName():lower() ~= 'parasite' or Game.getStorageValue(GlobalStorage.Weeper) >= 1 then
return true
end
local barrier, targetPosition = false, target:getPosition()
for i = 1, #positions do
if targetPosition == positions[i] then
barrier = true
break
end
end
if not barrier then
return true
end
local tile, item
for i = 1, #barrierPositions do
tile = Tile(barrierPositions[i])
if tile then
item = tile:getItemById(18459)
if item then
item:remove()
addEvent(function(itemid, count, position) Game.createItem(itemid, count, position), 30 * 60 * 1000, 18459, 1, barrier[i])
end
item = tile:getItemById(18460)
if item then
item:transform(19461)
end
end
end
Game.setStorageValue(GlobalStorage.Weeper, 1)
addEvent(Game.setStorageValue, 30 * 60 * 1000, GlobalStorage.Weeper, 0)
Game.createMonster('gnomevil', Position(33114, 31953, 11))
addEvent(clearArena, 32 * 60 * 1000)
return true
end