At this rate, I’ll have this module script be 5,000+ lines once I push the game for release. Is there any way to improve this? I was going to have values located in ServerStorage but I didn’t want to spend time looking for them, instead I’m just making tables in this module script.
Don’t get me wrong, I’m not complaining about this, but for those massive RPG based games where they have over 100+ unique AI, is this truly how they keep track of the stats for each one?
I don’t have a huge setup, but once I hit like 30 units I started to track their 20+ stats in a spreadsheet that I would then copy that into a script that would initialize the table from that.
i dont understand what you want do
but if you want to do what i think you can just store every mob in a module like that
[“Ice archer”] = {Level = 1, DamageAmount = 11}
and then make a loop every wave to spawn the right amount of mobs
You could then make stat modifiers per wave that affect all enemies then just list enemy_name (amount) modifier_randomize_range (or some other description.
That way you can describe a wave just by defining a few basic rulesets for assigning stats to a group instead of handling each enemy one by one.
local Waves = {} --- or wereever your table is
local currentplacement = 1 -- Idk if you wanted specific placement
function InsertWaveMob(WaveNum, count,name, level, damageamount)
if Waves["Wave"..tostring(WaveNum)] == nil then --- If the wave does not exist
Waves["Wave"..tostring(WaveNum)] = {}
end
for i = 1, count do
table.insert(Waves["Wave"..tostring(WaveNum)],{Name = name, Placement = currentplacement, Level = level, DamageAmount = damageamount})
currentplacement = currentplacement+1
end
end
InsertWaveMob(1, 2,"Ice Hobo",1,10)
for i,v in pairs(Waves["Wave1"]) do
print(v.Name)
end
----Output: Ice Hobo (x2)
you’re on the right track, you can use the code made by @WindowsXPisathing as it is valid.
You should use a module script if you will have multiple scripts handling the enemies, however if the provided script is the only wave handler you should just create a table inside of the aforementioned script with general non-variable enemy information, like name and damage.