Time for action – Creating a latent action
Latent actions have their own section under the SequenceAction tree, under SeqAct_Latent. Instead of creating an entirely new action, we'll move our Spawner Activation action here. We'll do this so we can create a timer instead of having to use delays on the inputs and outputs. Let's get started!
First we need to create the timer. Let's do this in AwesomeGame. We'll start with the
int
variable at the top:var int NextWaveTimer;
Now let's change the
StartWave
function:function StartWave(int WaveSize, int WaveTimer) { local AwesomeEnemy AE; foreach DynamicActors(class'AwesomeEnemy', AE) AE.Destroy(); EnemiesLeft = WaveSize; NextWaveTime = WaveTimer; Broadcast(self, NextWaveTime); SetTimer(1, true, 'WaveCountdown'); }
We've added a new parameter to take the desired countdown time, then set it to our new variable and called a repeating timer for
WaveCountdown
, which we'll write next. We also broadcast the time left, similar...