:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Mon Jul 23, 2018 6:00 pm
All times are UTC + 0
 Forum index » Modding Central » Red Alert 2 Editing Forum » Tutorials Vault
Unit recruitment in maps and AI (****)
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
E1 Elite
Commander


Joined: 28 May 2013

PostPosted: Thu Mar 22, 2018 9:32 am    Post subject:  Unit recruitment in maps and AI (****) Reply with quote

During team formation, the units could be recruited from the available units on the map or could be produced from factories or a combination of these two.

Game doesn't recruit units that are busy in system generated activities. Like when unit comes out of factory, it still is running around and hasn't yet settled into a cell. Unit automatically tries to regroup with its team members (not the regroup script action) before performing a script action but is still running around and hasn't yet reached its regroup destination.

When a unit belongs to a team, its behavior is according to its TeamType attributes. TeamType attributes involved in recruitment are AreTeamMembersRecruitable, Priority, Recruiter, Group and Autocreate.

AreTeamMembersRecruitable
AreTeamMembersRecruitable=yes means that the units in that team can be recruited into other teams. When set to no, the team members are not available for recruitment. When the team members finish their script actions, they loose their AreTeamMembersRecruitable value and become available for recruitment into other teams.

Priority
A TeamType with higher Priority value can recruit team members from a TeamType with lower Priority value, even if the lower Priority value team hasn't yet completed its script actions. A lower Priority TeamType cannot recruit from a TeamType with higher Priority value. TeamTypes with equal Priority values cannot recruit from one another. When the team members finish their script actions, they loose their Priority value and can be recruited into teams with any Priority value.

Because of the equal Priority mechanism, similar teams with same Priority don't recruit from one another and also if Max count is more than 1, the next team won't recruit from its previous team. Teams with low Priority are used as pool teams typically doing base defense jobs, when attack teams are formed which has a higher Priority value, then units get recruited from the pool teams to form the attack teams quickly.

Vanilla AI INI uses values in multiples of 4 (in TS) or 5/7 (in RA2/YR). In-between and other numbers (in 0-50) are used in single player maps which gives granular recruitment control  based on the priority status.

Recruiter
A TeamType with Recruiter=yes disregards the unit's Group value when recruiting, which makes inter-Group recruitment possible. When set to no, the TeamType cannot recruit units that have different group value than itself (Group=-2 teamtypes are exception).

As global AI can be enabled in maps, Recruiter=yes and Group numbers 0 to 9, -2 and -40094 (-40094 is used in TS only) which are used in vanilla SP maps should be avoided in AI INI so that unknowingly the hero units in SP maps don't get recruited into generic/global AI teams.

Group
A unit always has a Group value, whether it is in a team or not. Produced units are assigned to the group defined in its TeamType/TaskForce. Units get their Group value from its TeamType except when it has Group=-1 where they get their Group value from its task force's group. When the team members finish their script actions, they still retain their group value. Group value of a unit only changes when it gets recruited into a TeamType with a different Group value. Pre-placed units on maps have their Group defined as part of their format.

Group=-1 is No Group case. Pre-placed units with Group set to -1 and units in its TeamType/TaskForce's Group set to -1 get assigned to Group=-1. Starting units, Freeunits that come with buildings, droppod/paradrop units, units from crates, escaping units from destroyed buildings etc. have their Group set to -1. AI auto-produced units like harvesters which doesn't have a TeamType/TaskForce are also assigned with Group -1.

Group=-2 is Any Group case. TeamType having Group=-2 can recruit units of any Group value, even with Recruiter=no set on the recruiting team. Units with Group=-2 are like any other group other than -1.

Main usage of Group is for recruiting specific pre-placed units on maps for specific missions, we call those as hero/RPG/mission units. Vanilla SP maps uses Group numbers like 0 to 9,-2 and -40094 (-40094 is used in TS only) in conjunction with Recruiter=no to recruit specific pre-placed units into the specific teams.

TeamTypes produced from factories with Groups other than -1/-2 whether in SP or MP maps, fail to execeute their script when Recruiter=no is used. For example, vanilla TS using -40094 in AI INI are such cases. It is not clear how it is coded in the game. After coming out of the factory, these units are kind of busy doing nothing and cannot be recruited further. When TeamTypes produced from factories with Group other than -1/-2 are using Recruiter=yes, then such teams are able to execute its script actions and can be recruited further into other TeamTypes with same Group and are able to execute their script actions with Recruiter=no also.

Unexpected job queuing happen in some cases. Like when a first TeamType with Group other than -1 and Recruiter=no produce units from factory, it fails to execute its script. A next TeamType with Group other than -1 and Recruiter=yes produces units from factory, the game is unable to recruit the first team units but uses those units for the 2nd team and gives replacement for the first teams units. In such case if the 2nd team units finishes their script, it executes the first team's script also after that.

Autocreate
Autocreate in TeamTypes is used to check whether a unit should be recruited from the pre-placed unit on the map or it should be produced from a factory.

Pre-Placed unit formats on the map - Infantry, Units, Aircraft

[Infantry]
Index=Owner,ID,Health,X,Y,Sub_Cell,Mission,Facing,Tag,Veterancy,Group,High,Autocreate_no_recruitable,Autocreate_yes_recruitable

[Units]
Index=Owner,ID,Health,X,Y,Facing,Mission,Tag,Veterancy,Group,High,Follows_Index,Autocreate_no_recruitable,Autocreate_yes_recruitable

[Aircraft]
Index=Owner,ID,Health,X,Y,Facing,Mission,Tag,Veterancy,Group,Autocreate_no_recruitable,Autocreate_yes_recruitable

When a TeamType has Autocreate=no then the units with Autocreate_no_recruitable as 0 are not considered for recruitment. If there are units with Autocreate_no_recruitable as 1 then recruit those and form the team. If it falls short to form the team then produce remaining units from the factory to complete the team. If it fails to recruit the units on the map with Autocreate_no_recruitable as 1, because of any reason like Group mismatch along with Recruiter=no, then it cannot produce replacement for such units from the factory, so the team formation is interrupted.

When a TeamType has Autocreate=yes then the units with Autocreate_yes_recruitable as 0 are not considered for recruitment. If there are units with Autocreate_yes_recruitable as 1 then recruit those and form the team. If it fails to recruit, because of any reason like Group mismatch along with Recruiter=no, then produce those units from the factory and complete the team. If it falls short to form the team then also produce remaining units from the factory to complete the team.

Additional restriction is if Autocreate_no_recruitable is 1, then it cannot produce from factory.

Example: Consider that the concerned house has required factory (barracks/war factory etc.) and has credits to produce units. Map has 2 pre-placed units with same relevant parameters and a TeamType to be formed also requires those 2 units only. Combinations are listed as follows:

Group, Autocreate_no_recruitable, Autocreate_yes_recruitable on pre-placed units : Group, Autocreate yes/no, with Recruiter=no in TeamType
---------------------------------------------------------------------------------------------------
Case: No units present on the map : Any Group, Any Autocreate - Produce from factory
Case: Group -1, 0, 0 : Any Group, Any Autocreate - Produce from factory
Case: Group -1, 0, 1 : Group -1, Autocreate=yes - Recruit the pre-placed units
Case: Group -3, 0, 1 : Group -1, Autocreate=yes - As recruit fails, produce from factory
Case: Group -1, 0, 1 : Group -1, Autocreate=no - Produce from factory
Case: Group -1, 1, 0 : Group -1, Autocreate=yes - Team not formed
Case: Group -1, 1, 0 : Group -1, Autocreate=no - Recruit the pre-placed units
Case: Group -3, 1, 0 : Group -1, Autocreate=no - As recruit fails, can't produce from factory so team not formed
Case: Group -1, 1, 1 : Group -1, Autocreate=yes - Recruit the pre-placed units
Case: Group -3, 1, 1 : Group -1, Autocreate=yes - As recruit fails, Team not formed
Case: Group -1, 1, 1 : Group -1, Autocreate=no - Recruit the pre-placed units
Case: Group -3, 1, 1 : Group -1, Autocreate=no - As recruit fails, Team not formed

In the above example with a team of 2 units, if the map has one additional pre-placed unit that can be recruited into the team successfully, then also the team cannot be formed completely, so the above combinations apply. If there are 2 or more of the additional pre-placed units which can be recruited successfully then if the team formation fails in the above combinations then the team will be formed with the additional units.

FA2/FinalSun creates units with Autocreate_no_recruitable (1), Autocreate_yes_recruitable (0) by default and in TeamTypes with Autocreate=yes. When you find that the pre-placed units are not getting recruited into the expected TeamType, then uncheck the Autocreate checkbox to make it Autocreate=no.

LooseRecruits
It doesn't seem to have any effect, so don't know what it does. When the team members finish their script actions, those units could be recruited immediately into other teams regardless of LooseRecruits being yes or no.

Max
Maximum count of teams of a TeamType produced through AITriggers. -1 is unlimited. Usually when all members of a team are either destroyed or recruited into other teams then the total count of that team is decreased. Game still maintains the total count of a team when that team has finished its script actions. Max count is subject to TotalAITeamCap restrictions. When teams are created through Create Team Action in maps, Max count is not considered.

Key Words: #Tutorials #Modding #TiberianSun #Firestorm #RedAlert2 #YurisRevenge #AI.INI 

Back to top
View user's profile Send private message
McPwny
Vehicle Drone


Joined: 29 Jan 2018

PostPosted: Thu Mar 22, 2018 2:54 pm    Post subject: Reply with quote

yes! moar good informations! ty E1Elite.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Red Alert 2 Editing Forum » Tutorials Vault
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.1131s ][ Queries: 11 (0.0030s) ][ Debug on ]