Heya There!
I’m working on a wave-based, PVE game and I’m trying to format a wave system. I have a somewhat solid system, but it can be improved since I’ve encountered a few issues with it. One of them being that I don’t know how would I be able to add more variables to the system.
In the system, there is a dictionary named “WaveList
” that, as you might’ve guessed, contains every single wave format. As of now, it only has two values being the enemy name and how many of the enemy is going to spawn. The issue is that I want to add more values to the dictionary. An example would be something like a 0.5 second delay per enemy spawn (And when I mean by that, I mean something like a basic enemy having 5 clones of itself that spawn every 0.5 seconds).
Of course, there are other issues with the system and some I might’ve not encountered yet. Here’s the two scripts and see what I can improve upon.
GameHandler
--[[MODULE REQUIRING]]--
local RoundHandler = require(script:WaitForChild("RoundHandler"))
--[[GAME]]--
--//Wave list & current waves
local CurrentWave = 1
local WaveList = { --//TBA
[1] = {
["Brickbattler"] = 5
},
[2] = {
["Brickbattler"] = 15,
["Rioter"] = 10
},
[3] = {
["Test"] = 1
}
}
--//Game Loop
task.wait(5)
CurrentWave = 3
RoundHandler:StartNewWave(WaveList,CurrentWave)
RoundHandler
--[[SERVICES]]--
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
--[[REQUIRING]]--
local EntityHandler = require(ServerScriptService.Modules.EntityHandler)
--[[VARIABLES]]--
local BaseIntermissionTime = 25
local BaseWaveTime = 180
local EnemiesAlive = 0
--[[MODULE]]--
local RoundHandlerModule = {}
function RoundHandlerModule:PreperationTime()
--//TBA
end
function RoundHandlerModule:IntermissionBreak()
--//TBA
end
function RoundHandlerModule:StartNewWave(WaveList, CurrentWave)
for EnemyName, AmountofEnemies in WaveList[CurrentWave] do
EntityHandler:SpawnEntity(EnemyName,AmountofEnemies)
end
end
return RoundHandlerModule