really? so you can "spawn" dead characters? i didn't know this, if that's true then that's a nice find
the main issue is this part needs to be moved outside of the Started == 1 check
if killed == number_of_enemies then
Started = 1
wave = wave + 1
killed = 0
end
but with the way you have set it up you will also need to check wave is greater than 0 or change the init number_of_enemies so that it wont mess up as with the current init setup killed and number_of_enemies both equal 0 - thus the condition is true.
function zombiespawn_init(e)
wave = 1
Killed = 0
number_of_enemies = -1
Started = -1
end
function zombiespawn_main(e)
Prompt("Loading Round")
if GetPlayerInZone(e) == 1 and Started == - 1 then
Started =1
end
if Started == 1 then
if wave == 1 then
PromptDuration("Round 1 Start",3000)
Spawn(3)
Spawn(4)
Spawn(5)
Spawn(6)
Spawn(7)
number_of_enemies = 5
Started = 0
end
if wave == 2 then
PromptDuration("Round 2 Start",3000)
Spawn(8)
Spawn(9)
Spawn(10)
Spawn(11)
Spawn(12)
Spawn(13)
Spawn(14)
number_of_enemies = 7
Started = 0
end
if wave == 3 then
PromptDuration("Round 3 Start",3000)
Spawn(15)
Spawn(16)
Spawn(17)
Spawn(18)
Spawn(19)
Spawn(20)
number_of_enemies = 10
Started = 0
end
if Started == 0 or Started == -1 then
Prompt ("Round " ..wave.. " Hasn't Started Yet")
end
end
if killed == number_of_enemies then
Started = 1
wave = wave + 1
killed = 0
end
end
(untested but should work)
edit, just tried it and you can indeed bring dead characters back to life using Spawn(#), this would make you need much less characters.
just store the location of the desired starting point for them when they reset and then
*replace the #'s with the entity number of the character to use*
CollisionOff(#)
SetPosition(#,x,y,z)
AIEntityGoToPosition(g_Entity[#]['obj'],g_PlayerPosX,g_PlayerPosZ)
CollisionOn(#)
Spawn(#)
then instead of needing 22 enemies you only need 10 (using the numbers in your script)
i made a quick sample video of a script respawning the same enemy each time he dies in a random location near the player using a version of the above technique
life\'s one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11