Today I watched another video by GG:
It's an older tutorial and so it didn't work, because it seems there isn't a GetEntityLUAHealth() function anymore.
But I wanted to give it a try. So I modified the script.
With my script I can determine how often an enemy can respawn.
I hope I did it in the right way. LUA is new to me, but it is similar to Javascript. And I know that. A little bit.
-- LUA Script - precede every function and global member with lowercase name of script
-- 1. - Use a cover zone and set "Main" to this script
-- 2. - Enter the ID of each enemy you like in enemies{} and determine the number of respawns and delay to next respawn after enemy death there as well.
function spawnmaker_init(e)
spawnmaker_cycle = 0
enemies = {}
--[[
syntax:
enemies[0] = { id = enemy ID , max_live = max respawns , delay = delay to next respawn (milliseconds) }
example:
enemies[1] = { id = 5 , max_live = 3 , delay = 6000 }
enemies[2] = { id = 7 , max_live = 2 , delay = 3000 }
...
--]]
enemies[0] = { id = 5 , max_live = 4 , delay = 9000 }
enemies[1] = { id = 7 , max_live = 3 , delay = 6000 }
enemies[2] = { id = 8 , max_live = 2 , delay = 3000 }
--enemies[3] = { id = , max_live = , delay = }
--enemies[4] = { id = , max_live = , delay = }
--enemies[5] = { id = , max_live = , delay = }
--enemies[6] = { id = , max_live = , delay = }
--enemies[7] = { id = , max_live = , delay = }
--enemies[8] = { id = , max_live = , delay = }
--enemies[9] = { id = , max_live = , delay = }
end
function spawnmaker_main(e)
if g_Time > spawnmaker_cycle then
for i = 0, #enemies do
if enemies[i].max_live > 0 then
spawnmaker_cycle = g_Time + enemies[i].delay
if g_Entity[ enemies[i].id ][ 'health' ] <= 0 then
enemies[i].max_live = enemies[i].max_live - 1;
if enemies[i].max_live > 0 then
Spawn( enemies[i].id )
end
end
end
end
end
end
function spawnmaker_exit(e)
end