Okay - a request:
Group members - what do they do and how do i use them ?In short: there are 3 types of groups:
- FightGroups;
- MiningGroups;
- BuildingGroups.
Do NOT use ScGroup by itself, and do NOT create groups using the
new keyword; use the CreateGroup functions instead!
The type of group you use depends on what you want the group to do.
- If you want to build something (eg. buildings, tubes, walls) use the BuildingGroup type. Use this type also if you want to create new vehicles at a VF. Theoreticly you can assign ANY unit type to this group, but it's advisable to only assign units with building capabilities, such as ConVecs, Earthworkers, RoboMiners and factories;
- Obviously, a MiningGroup is used for mining operations. You should only assign cargotrucks to this type of group;
- FightGroups are used for grouping units for grouped actions. This does not necessarily have to be fighting actions, it can be any action.
If you do not have any
special action for the group (you only need the units to be grouped to be referenced later), use a FightGroup
[dohtml]<center><hr width=80%></center>[/dohtml]
TakeUnit: adds a unit to the group. Use this to put your units into the group one by one.
TakeAllUnits: if you want to combine 2 groups, use this class member. It will move the units from one group to the other. Be careful: a unit can only belong to 1 group at any time. After using TakeAllUnits the old group is void & invalid (referencing it will cause the game to crash).
SetDeleteWhenEmpty: can be used to delete the group after all its units are removed, for example: after using TakeAllUnits, or after they all been killed. As far as i know, you cannot UNset it again. Just use this right after you've created the group, and added some units. Always remove unused groups either by setting this option, to save up resources. Outpost2 can only have 255 ScStubs assigned, which includes Triggers as well.
SetTargCount: is to be used together with RecordVehReinforceGroup; see the earlier post about groups. It can be used several times: each time you add one more targetcount to the reinforce-list. In this manner you can set up a FightGroup to be reinforced automaticly with different types of units.
ClearTargCount: removes any and all targetcounts set by SetTargCount. Since there's no way of removing a specific targetcount (in case you've added multiple, see above), the only way to remove 1 of them, is to use this class member, and adding the targetcounts again.
RemoveUnit: remove a single unit from the group. The unit will no longer execute the group actions.
GetFirstOfType: This is rather complicated. It returns the first unit it finds in the group, that meet your classifications. It returns false (0) when no such unit can be found, or when all units have been returned already.
SetRect: (included in both BuildingGroup and FightGroup) sets a Rect where your vehicles will go to, when they are not performing any actions. For a buildingGroup this is where your convecs will go to when they are waiting for the next kit to be done, for fightergroups, when there's no more enemies to attack. This Rect is
ALSO included in MiningGroups, but it is set with the Setup class member, rather than Setrect. Also, for mining groups, you cannot change this rect after the group has been initialised other then initialising it again. For the other group types, you can always change the rect.
SetAttackType: was probably to be used for having your group attack a certain type of units, although this doesn't seem to work.
SetCombineFire: units will try to combine their firepower onto a target.
DoAttackEnemy: will attack ANY and ALL units set as 'enemy'. It will only target military units/buildings. This means agridomes and residences will be left alone. The group will go towards the closest enemy unit, even if they are found on the other side of the map, in the dark, with their lights off!
DoAttackUnit: sets a single target to be attacked (SetTargetUnit). The group will not seek out enemies, but
will fire on enemy units when they come into range/view.
DoExitMap: will make the group drive to the side of the map, after which they will dissapear.
DoGuardGroup/DoGuardUnit: will guard the target group (SetTargetGroup/SetTargetUnit).
SetPatrolMode: uses the waypoints structure to set up a list of waypoints for a group to patrol. The group will NOT seek out enemies, but will fire if they come into range/view. Use DoPatrolOnly to initiate patrol, and ClearPatrolMode to stop the units patrolling. They will return to the SetRect region.
DoGuardRect: units will attack any enemy unit that enters one of the guarded rects -that can be added/removed with AddGuardedRect and ClearGuarderdRects. They will NOT stay inside the rects all the time. After all enemy units have either been killed or left the guarded rect(s), the group will return to the rect defined by SetRect. BE ADVICED:
After using DoGuardRect you MUST supply a SetRect, not
before, since that has side-efftecs.
ClearGuarderdRects: NOTE the extra r in ClearGuarderdRects, it's a typo that the outpost coders made. Unfortunately you have to include this misspelled member as shown. It will remove all guarded rects added to the group by AddGuardedRectI hope this clears out some questions.
If some things are unclear, let me know. I did not test ANY of the members above while writing this, all is done by memory, so i might have some mix-ups :whistle:
[EDIT] some minor changes, and took out some spelling typos