jollebollen
08-24-2014, 08:19 PM
Right now, I get siren.wav playing when alarm gets on, I want to change that to the sound file called creature detected~.
How can I change it?
And I can't change name of siren etc because I need siren.wav for another script.
local config = {
monsterLimit = 4, -- alarm when this or more monsters on screen
monsterList = ({"Wyrm", "Energy Elemental"}), --which monsters to count
delay = 5000 -- play sound every x milliseconds
}
function getMonsterCount()
local count = 0
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if creature:isValid() and creature:isMonster() and creature:isOnScreen() and creature:isAlive() then
if (table.find(config.monsterList, creature:Name(), true)) then
count = count + 1
end
end
end
return count
end
while true do
if getMonsterCount()>=config.monsterLimit then
alert()
wait(config.delay)
end
wait(1000)
end
How can I change it?
And I can't change name of siren etc because I need siren.wav for another script.
local config = {
monsterLimit = 4, -- alarm when this or more monsters on screen
monsterList = ({"Wyrm", "Energy Elemental"}), --which monsters to count
delay = 5000 -- play sound every x milliseconds
}
function getMonsterCount()
local count = 0
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if creature:isValid() and creature:isMonster() and creature:isOnScreen() and creature:isAlive() then
if (table.find(config.monsterList, creature:Name(), true)) then
count = count + 1
end
end
end
return count
end
while true do
if getMonsterCount()>=config.monsterLimit then
alert()
wait(config.delay)
end
wait(1000)
end