Yalasari
Active Member
- Joined
- Jul 16, 2017
- Messages
- 82
- Solutions
- 8
- Reaction score
- 46
Hello,
In my script i want to destroy all obstacles on tile where i create monster with function createMonster()
This is the code, there's some code that i tried to use but everything causes failure and never destroys tile.
Thanks in advance
In my script i want to destroy all obstacles on tile where i create monster with function createMonster()
Lua:
local bossname = "Corym King" -- nazwa bossa
local isBossPresentID = 66001 -- ID z pliku storages
local xpos = 4840 -- wspolrzedne x
local ypos = 5153 -- wspolrzedne y
local zpos = 9 -- wspolrzedne z
local xrand = math.random(-1, 1)
local yrand = math.random(-1, 1)
local position = Position(xpos + xrand, ypos + yrand, zpos)
local addtionalTime = math.random(0, 180) * 100
local function spawnBoss()
broadcastMessage('executing spawnBoss...', MESSAGE_STATUS_WARNING)
if Game.getStorageValue(isBossPresentID) ~= 1 then
broadcastMessage('if statement... ok', MESSAGE_STATUS_WARNING)
if Tile(position) ~= nil then
Tile(position):remove()
else end
Game.createMonster(bossname, position)
-- // --
xrand = math.random(-1, 1)
yrand = math.random(-1, 1)
addtionalTime = math.random(0, 180) * 100
position = Position(xpos + xrand, ypos + yrand, zpos)
addEvent(spawnBoss, 12 * 100 + addtionalTime) -- respi sie za 12h + losowy czas
Game.setStorageValue(isBossPresentID, 1)
else
broadcastMessage('if statement failed...', MESSAGE_STATUS_WARNING)
addtionalTime = math.random(0, 180) * 100
addEvent(spawnBoss, 12 * 100 + addtionalTime) -- respi sie za 12 h + losowy czas
end
end
function onTime(interval)
broadcastMessage('executing onTime...', MESSAGE_STATUS_WARNING)
addEvent(spawnBoss, addtionalTime)
return true
end
This is the code, there's some code that i tried to use but everything causes failure and never destroys tile.
Thanks in advance