Since you're trying to spawn enemy actors, you'll probably want to do something like this, rather than spawning specific actors/weapons using their presetnames:
Code:
if math.random() < 0.7 then
act = RandomAHuman("Light Infantry", "ModuleNameHere")
else
act = RandomAHuman("Heavy Infantry", "ModuleNameHere")
end
--team and pos stuff--
act:AddInventoryItem(RandomHDFirearm("Primary Weapons", "ModuleNameHere"))
act:AddInventoryItem(RandomHDFirearm("Secondary Weapons", "ModuleNameHere"))
MovableMan:AddActor(act)
This does mean you'll need to select a module in the create function, probably using code like this:
Code:
self.CPUTechName = self:GetTeamTech(self.CPUTeam)
That code will just get the module from the faction selection screen that comes up when an activity starts. If using this you can just replace the "ModuleNameHere" with self.CPUTechName.
Alternatively, you can also leave the module out of the random functions, in which case it will spawn random actors from any module except base.rte, armed with random weapons from any module except base.rte.
Option three, the most complicated one, is a combination of the last 2: You could leave out the module name for the actors, but then use the actors' module to spawn weapons. So you never know what kind of actors you might face, but the actors will always have weapons from their own tech. This option requires some extra code, that I can't easily copy/paste right now, so let me know if you want to go this route and I'll put together some workable code later.
Edit: You can also change the group in the random weapon line, any group defined in an ini is a valid option. So Light, Heavy, Sniper or Explosive Weapons can all be used.
Expanding it to have some more if math.random() checks to sometimes give the actors grenades, or diggers, is also possible of course. Using RandomTDExplosive("Grenades") and RandomHDFirearm("Diggers").