Squad stuff gadgets
Posted: 21 Oct 2008, 19:29
[url]http://kdr_11k.from-hell.net/squads.7z[/url]
Comes with two gadgets, the squadSpawner.lua allows making the construction of one unit spawn a bunch of other ones, the squadHandler.lua makes the squad act as one unit. The statusArrow.tga is only needed for the squadHandler. You can use just the squadSpawner to get a bunch of units in one build order that can still be controlled individually and you can use just the squadHandler if you have a custom build system, you have to call RegisterSquad then though.
To use the squadSpawner you create entries called squadMember1, squadMember2, etc on a unit. The numbers must be contiguous (cannot have one missing) and their value has to be the unitdef name of the squad member. The members are spawned in addition to the unit that was built. Only units that have gone through the TA build process get their squad members, it's possible to give a unit its own kind as squadmembers without causing any infinite recursions.
The squadHandler automatically acts on the squads made by the squadSpawner. It can use the customParam tag formation but doesn't require it (defaults to "circle" with the tag absent). The built unit becomes the leader of the squad with the spawned units being the followers. The player can only select and command the leader of the squad, the followers will automatically arrange themselves in a formation around the leader. If the leader dies a follower becomes the new leader. Squad leaders are marked with an arrow above their head. It might get annoying if the squadmembers have a stopping sound...
To use the squadHandler on your own build system you just call its RegisterSquad function. The parameters are the unitID of the leader, the unitDefID of the unit that defines the formation (probably the leader?) and a table containing the follower unitIDs like {[1]=unit1,[2]=unit2]}, the index numbers match the formation spots. Make sure your chosen formation has enough spots for all the units you put in.
There are no upgrades or reinforcements for the squads yet.
The squadhandler will probably cause issues with units that change their maxSpeed, it'd probably need adjustments for that in such mods...
Comes with two gadgets, the squadSpawner.lua allows making the construction of one unit spawn a bunch of other ones, the squadHandler.lua makes the squad act as one unit. The statusArrow.tga is only needed for the squadHandler. You can use just the squadSpawner to get a bunch of units in one build order that can still be controlled individually and you can use just the squadHandler if you have a custom build system, you have to call RegisterSquad then though.
To use the squadSpawner you create entries called squadMember1, squadMember2, etc on a unit. The numbers must be contiguous (cannot have one missing) and their value has to be the unitdef name of the squad member. The members are spawned in addition to the unit that was built. Only units that have gone through the TA build process get their squad members, it's possible to give a unit its own kind as squadmembers without causing any infinite recursions.
The squadHandler automatically acts on the squads made by the squadSpawner. It can use the customParam tag formation but doesn't require it (defaults to "circle" with the tag absent). The built unit becomes the leader of the squad with the spawned units being the followers. The player can only select and command the leader of the squad, the followers will automatically arrange themselves in a formation around the leader. If the leader dies a follower becomes the new leader. Squad leaders are marked with an arrow above their head. It might get annoying if the squadmembers have a stopping sound...
To use the squadHandler on your own build system you just call its RegisterSquad function. The parameters are the unitID of the leader, the unitDefID of the unit that defines the formation (probably the leader?) and a table containing the follower unitIDs like {[1]=unit1,[2]=unit2]}, the index numbers match the formation spots. Make sure your chosen formation has enough spots for all the units you put in.
There are no upgrades or reinforcements for the squads yet.
The squadhandler will probably cause issues with units that change their maxSpeed, it'd probably need adjustments for that in such mods...