@@ -49,6 +49,7 @@ function WaveDefense:StartActivity(isNewGame)
49
49
self .AI .HuntTimer = Timer ();
50
50
51
51
self .AI .bombChance = math.min (math.max (self .Difficulty / 100 + math.random (- 0.1 , 0.1 ), 0 ), 1 );
52
+ self .AI .timeToSpawn = 8000 - 50 * self .Difficulty ; -- Time before the first AI spawn: from 8s to 3s
52
53
self .AI .timeToBomb = (42000 - 300 * self .Difficulty ) * math.random (0.7 , 1.1 ); -- From 42s to 12s
53
54
self .AI .baseSpawnTime = 9000 - 40 * self .Difficulty ; -- From 9s to 5s
54
55
self .AI .randomSpawnTime = 6000 - 30 * self .Difficulty ; -- From 6s to 3s
@@ -98,11 +99,6 @@ function WaveDefense:StartNewGame()
98
99
self .wave = 1 ;
99
100
self .wavesDefeated = 0 ;
100
101
101
- -- Just spawn all the time
102
- -- We used to vary this by difficulty, but eh, why bother. It just stretches the length of each round out.
103
- -- Instead we spawn constantly >:)
104
- self .AI .timeToSpawn = 0 ;
105
-
106
102
-- Set all actors defined in the ini-file to sentry mode, and set their team to the player's.
107
103
for actor in MovableMan .AddedActors do
108
104
if actor .ClassName == " AHuman" or actor .ClassName == " ACrab" then
@@ -444,9 +440,12 @@ function WaveDefense:UpdateActivity()
444
440
445
441
if obstacleHeight > 200 and math.random () < 0.4 then
446
442
-- This target is very difficult to reach: cancel this attack and search for another target again soon
443
+ self .AI .timeToSpawn = 500 ;
447
444
self .AI .AttackTarget = nil ;
448
445
self .AI .AttackPos = nil ;
449
446
else
447
+ self .AI .timeToSpawn = (self .AI .baseSpawnTime + math.random (self .AI .randomSpawnTime )) * rte .SpawnIntervalScale ;
448
+
450
449
if obstacleHeight < 30 then
451
450
self :CreateHeavyDrop (xPosLZ , self .AI .AttackPos );
452
451
elseif obstacleHeight < 100 then
@@ -492,6 +491,7 @@ function WaveDefense:UpdateActivity()
492
491
else
493
492
-- No target found
494
493
self .AI .SpawnTimer :Reset ();
494
+ self .AI .timeToSpawn = 5000 ;
495
495
end
496
496
end
497
497
end
0 commit comments