Yalasari
Active Member
- Joined
- Jul 16, 2017
- Messages
- 82
- Solutions
- 8
- Reaction score
- 46
Hello,
I have boss spawning script using globalevents, boss appears every 12 hour + random addtional time, and there's problem, if nobody will kill boss, duplicate will appear, then next one appears, next one ...
And i have problem how to pause this script if already boss is present. (in script, demon is only for explain purposes)
Thanks in advance
I have boss spawning script using globalevents, boss appears every 12 hour + random addtional time, and there's problem, if nobody will kill boss, duplicate will appear, then next one appears, next one ...
And i have problem how to pause this script if already boss is present. (in script, demon is only for explain purposes)
Lua:
local xrand = math.random(-2, 2)
local yrand = math.random(-2, 2)
local position = Position(930 + xrand, 1265 + yrand, 10)
local addtionalTime = math.random(0, 180) * 60 * 1000
local function spawnBoss()
Game.createMonster("Demon", position)
addtionalTime = math.random(0, 180) * 60 * 1000
xrand = math.random(-2, 2)
yrand = math.random(-2, 2)
position = Position(930 + xrand, 1265 + yrand, 10)
addEvent(spawnBoss, 12 * 60 * 60 * 1000 + addtionalTime)
end
function onTime(interval)
addEvent(spawnBoss, addtionalTime)
return true
end
Thanks in advance