Page 1 of 1

factory that builds multiple units at once

Posted: 27 Apr 2012, 06:37
by knorke
Four times the flash spam \o/
Image

A factory that builds multiple clones of a unit at once.
I know some mods already have squad-building (S44) but with this you can see the units being concstructed.

Basically just define your buildspots like this:

Code: Select all

local buildSpots = {
	[1] = piece "spawn1",
	[2] = piece "spawn2",
	[3] = piece "spawn3",
	[4] = piece "spawn4",
}
(can be more than 4)
and tada.

Idea is that the unit that is "originally" built by the factory is made invisible and then you do:
buildprogress_of_clones = buildprogress_of_original_unit
until done.
:shock: :shock: And then you kill the original and only the clones survive :shock: :shock:

blabla:
1) tooltip lets you find the invisible unit:
http://h9.abload.de/img/multifaggtori52brv.jpg
(solution: find some function to hide it better or hide it in hitsphere of factory. Spring.SetUnitNoDraw (bID, true) does not do it..)

2) nanoframes of units with too long buildtime decay (lol)
(solution: do not use nanoframe animation by changing:
local newUnit = Spring.CreateUnit (bdefID, x,y,z, i, teamID, false) (was true)

3) units do not inherit waypoints/states from factory
(shouldnt be hard to put in, left it out for now)

4) assisting does not work
(would require some gadget part to pass the guard-click to the invisible unit)

5) units do not follow movement/rotation of the buildpad pieces
5b) nanoframes can be bumped out of the factory
(solution: put in some movectrl or magnets)

Eventually one would want to add those things but then the script would have been longer.
So I thought before I tweak it for the actual unit, here is the "simple version" without much bling-bling:
http://code.google.com/p/springtutorial ... ltipad.lua
There are even some comments!

Re: factory that builds multiple units at once

Posted: 27 Apr 2012, 08:31
by SanadaUjiosan
Very neat! I don't know if I have any use for this right now, but I'll keep an eye on it if it gets improved.