How do I create an endless wave-based round system with Promises?

So I tried using this: Making a gamemode system - #2 by dthecoolest
I managed to create a basic round system, but couldn’t figure out how to turn it into a endless wave-based system.

2 Likes

You can edit the part where it restarts the game by passing the start capture point game function.

So you can do something like .startWave(5) somehow with an number value in the class to keep track.

andThen(function() -- can't use andThenReturn here because of conditional
		print("Restart game? Or not enough players")
		return enoughPlayers() and RoundSystem.startCapturePointGame or RoundSystem.waitForPlayers
		-- return the next block of code we should do!
	end)
3 Likes

Thanks for the reply! Works perfectly!

return Promise.race({
		Promise.delay(30),
		Promise.fromEvent(self.FoddersWipedOut),
		playersWipedOut():andThenReturn("Players")
		--override():andThenReturn("FullStop") override not implemented yet
	}):andThen(function(case)
		if case == "Players" or case == "FullStop" then
			if case == "Players" then
				Promise.delay(5)
			end
			self:clear()
			return not roundControl.enoughReadys() and roundControl.WaitForReadys or roundControl.Intermission
		else
			self.Wave += 1
			return self.AdvanceWave
		end
	end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.