Posted: Sat Mar 23, 2013 3:26 pm Post subject:
Multiple MCVs, con.yards and factions (*****)
This tutorial allows you to have separate MCV / Construction yard for every faction, and it will allow you to add a 3rd (or more) factions into the game. All of these things work with the AI as well. This method will force you to sacrifice a few things:
1. Short Game will be forced off. Means to win you must destroy all enemy units, not just buildings.
2. Unit Count will be forced to one. You will only start a match with your factions MCV.
3. Bases mode will be forced on. The AI would suck anyway with Bases off, so no big loss here.
The logic is based on the fact the AI needs to own the structure listed in BuildConst, but that structure does NOT need to be a construction yard. It can be a fake invisible and immune structure that blows up when the AI has lost. When the AI has this fake structure and any sides-specific construction yard it will be able to build up it's base normally.
If you only want to have side-specific MCV / construction yard for 2 factions (GDI and Nod), simply ignore all the Forgotten parts in the tutorial.
First, do these general changes in rules.ini:
Code:
BaseUnit=HELPER ; An extra fake unit needed for AI to work properly
BuildConst=HELPERDEP1 ; An extra fake building needed for AI to work properly
[MultiplayerDefaults]
...
Bases=yes ; So you always start with the unit listed in BaseUnit=, and the side-specific MCV.
ShortGame=no ; Setting this yes would require redesigning the HELPER unit and how it works
UnitCount=2 ; BaseUnit (HELPER) + side-specific MCV
[CrateRules]
...
FreeMCV=no ; Has to be No or the game might give you HELPER units from crates
To counter the fact we set FreeMCV=no you could create extra clones of MCVs to increase the likelihood of getting an MCV from a crate. Give the clone MCVs TechLevel=-1 and AllowedToStartInMultiplayer=no. Also don't forget to set their Image= key!
Then give AllowedToStartInMultiplayer=no to every unit. It defaults to yes, so you must add it to every single unit, both vehicles and infantry. Remember to add it to units in firestrm.ini as well!
Every buildable structure for all factions need to have an extra owner, Special. E.g.
Code:
[GAWEAP]
Owner=GDI,Special
[NATECH]
Owner=Nod,Special
Let's move on to the vehicles required for the logic. This tutorial only lists the important keys required by the logic. You need to define the other properties of the units yourself.
Code:
[VehicleTypes]
...
xx=MCV_GDI ; GDI MCV
xx=MCV_NOD ; Nod MCV
xx=MCV_FORG ; Forgotten MCV
xx=HELPER ; Fake unit needed for logic to work
[MCV_GDI]
...
Name=GDI MCV
Image=MCV_GDI
Owner=GDI
TechLevel=1 ; This MUST be 1 or starting a match with tech level 1 would lead to an IE!
Prerequisite=GAWEAP,GATECH ; Prerequisites can be used to force a higher tech level on the MCV
DeploysInto=GACNST ; GDI con.yard
CrateGoodie=yes
AllowedToStartInMultiplayer=yes
Cost=2500 ; If you adjust this, you might have to adjust the cost of HELPER too.
Secondary=DeployWeapon ; Required for AI to deploy them correctly. Does not create side-effects on the unit.
[MCV_FORG]
...
Name=Forgotten MCV
Image=MCV_FORG
Owner=Forg ; Note that units do not need Special as the owner, only structures do.
TechLevel=1
Prerequisite=CAWEAP,CATECH ; Forgotten prerequisites (need to define them...)
DeploysInto=CACNST ; Forgotten con.yard
CrateGoodie=yes
AllowedToStartInMultiplayer=yes
Cost=2500
Secondary=DeployWeapon
; Fake vehicle needed for logic to work
[HELPER]
Name=-
Nominal=yes
Image=HELPER
Strength=10
Primary=DeployWeapon ; So the human owned HELPER units suicide (AI versions deploy)
Elite=DeployWeapon2 ; The weapon's 2nd stage must be used here to avoid a crash
LargeVisceroid=yes ; These 2 keys make it fire the weapon right away
GuardRange=255
Category=Support
Armor=wood
DeploysInto=HELPERDEP1 ; Deploys into a special fake structure (that AI needs)
TechLevel=-1 ; Safe to set this to -1, since everyone gets it due to BaseUnit=HELPER.
Sight=0
Speed=10
Owner=GDI,Nod,Forg ; Every playable faction
CrateGoodie=no ; Never ever make this a crategoodie
Cost=5000 ; If you adjust the costs of the MCVs you might have to adjust this too
Points=0
ROT=30
Crewed=no
Crusher=no
Selectable=no
MaxDebris=0
Locomotor={4A582741-9839-11d1-B709-00A024DDAFD1}
Weight=1
MovementZone=Normal
Accelerates=false
ThreatPosed=0
AllowedToStartInMultiplayer=yes ; The only unit beside the MCVs you get at start
LegalTarget=no
NonVehicle=yes
Note that if you want any or all of the MCVs to have weapons, you might need to adjust the unit a bit since it already has Secondary=DeployWeapon.
Next up the required structures. All the side-specific construction yards and two special structures required for the AI to play along nicely. Put these structures AT THE TOP of the BuildingTypes list!!! AI builds things in the order that they appear in the list. It must be able to build the HELPERDEP2 structure right away.
Code:
[BuildingTypes]
1=GACNST ; GDI construction yard
2=NACNST ; Nod construction yard
3=CACNST ; Forgotten construction yard
4=HELPERDEP1 ; Fake structure needed for logic to work
5=HELPERDEP2 ; Another fake structure needed for logic
...
[GACNST]
...
Name=GDI Construction Yard
Image=GACNST
Owner=GDI
TechLevel=-1 ; This is not built directly
AIBuildThis=no ; Never ever set this yes or AI will get cloning bug
UndeploysInto=MCV_GDI ; Undeploys into the GDI MCV
[NACNST]
...
Name=Nod Construction Yard
Image=NACNST
Owner=Nod
TechLevel=-1
AIBuildThis=no
UndeploysInto=MCV_NOD ; Undeploys into the Nod MCV
[CACNST]
...
Name=Forgotten Construction Yard
Image=CACNST
Owner=Forg ; Special isn't needed because this is never built
TechLevel=-1
AIBuildThis=no
UndeploysInto=MCV_FORG ; Undeploys into the Forgotten MCV
; Fake building needed for logic to work
[HELPERDEP1]
Name=
Nominal=yes
Strength=1000
Immune=yes ; So it can't be destroyed (would stop AI base building)
BridgeRepairHut=yes ; Makes it immune to C4
IsCoreDefender=yes ; Makes it immune to EMP
InvisibleInGame=yes ; Should be safe to use this as the structure does not have weapons
LegalTarget=no
Unsellable=yes
Repairable=no
Capturable=no
Powered=no
TogglePower=no
Insignificant=yes ; So it blows up when AI has lost all structures and units
Armor=heavy
TechLevel=-1
AIBuildThis=no ; Not built, the fake unit deploys into this.
Adjacent=0
Sight=0
Owner=GDI,Nod,Forg,Special ; Every playable faction + Special
Cost=0
Points=0
Power=0
Crewed=no
MaxDebris=0
ThreatPosed=0
; Fake building needed for logic to work
[HELPERDEP2]
Image=GALITE ; This CANNOT be 0x0 or AI will build them forever. Since it has InvisibleInGame=yes we can use GALITE here.
Name=-
Nominal=yes
Strength=1000
Immune=yes ; So it can't be destroyed (would stop AI base building)
BridgeRepairHut=yes ; Makes it immune to C4
IsCoreDefender=yes ; Makes it immune to EMP
InvisibleInGame=yes ; Should be safe to use this as the structure does not have weapons
Bib=yes ; Since this is a 1x1 structure, Bib=yes allows units to pass over this cell.
LegalTarget=no
Unsellable=yes
Repairable=no
Capturable=no
Powered=no
TogglePower=no
Insignificant=yes ; So it blows up when AI has lost all structures and units
Armor=heavy
TechLevel=1 ; This structure is built by the AI so give it 1
Prerequisite= ; No prerequisites so all factions can build it
BuildLimit=0 ; Disables it from human players
AIBuildThis=yes ; This works as the prerequisite for all the structures for the AI
;;AlphaImage=ALPHATST ; Can be used to test and see if the AI actually built this
Adjacent=0
Sight=0
Owner=GDI,Nod,Forg,Special ; Every playable faction + Special
Cost=0
Points=0
Power=0
Crewed=no
MaxDebris=0
ThreatPosed=0
We need to define the weapon required for the logic to work:
Code:
[DeployWeapon]
Damage=0
ROF=500 ; So it won't get to fire twice
Range=255 ; Max range
Projectile=DeployWeaponPR ; Special projectile to swap into the 2nd stage of the weapn
ProjectileRange=0 ; Change into the 2nd stage of the weapon right away
Speed=100
Warhead=ZeroWH
Anim=SUICIDE ; Self-destructs the HELPER unit when it fires this weapon
[DeployWeaponPR]
Shadow=no
Proximity=no
Cluster=1
Ranged=yes
Range=0
AA=no
Image=120MM
ROT=8
Splits=yes ; Uses reaper splits logic
AirburstWeapon=DeployWeapon2 ; Fire the 2nd stage of the weapon
IgnoresFirestorm=yes
RetargetAccuracy=100%
[DeployWeapon2]
Damage=0
ROF=500
Range=1 ; So it can't reach the target
Projectile=Invisible
Speed=100
Warhead=ZeroWH
[ZeroWH]
Spread=0
Verses=1%,1%,1%,1%,1% ; Allows it to target everything. Use Damage=0 on weapon to prevent damage.
InfDeath=0
ProneDamage=1%
Add these things to the Warheads and Animations lists:
Code:
[Warheads]
...
xx=ZeroWH
[Animations]
...
xx=SUICIDE
Define some stuff in art.ini:
Code:
; An invisible SHP
[HELPER]
Voxel=no
PrimaryFireFLH=0,0,0 ; Needs to be this to center the anim damage on the unit
SecondaryFireFLH=0,0,0
; To make the fake building invisible and immune
[HELPERDEP1]
Image=INVISO
Remapable=yes
Foundation=0x0 ; Makes the structure invisible and immune, and units can pass through it.
Buildup=INVISO
DemandLoadBuildup=true
FreeBuildup=true
NewTheater=no
; Self-destructs the HELPER unit (for human players, AI ones deploy)
[SUICIDE]
Image=INVISO
Damage=20 ; Enough to guarantee the HELPER unit dies
DamageRadius=0
Surface=yes
Start=0
End=1
Next we need to take over some of the OR prerequisites in rules.ini. You need to take over as many of them as you have factions in your mod. In this tutorial we have 3 factions so we take over 3 OR prerequisites. If any structures or units in your mod already use these OR prerequisites, you need to adjust or remove those prerequisites!
Code:
PrerequisiteBarracks=HELPERDEP2,GACNST ; Fake structure AI always has + GDI construction yard
PrerequisiteRadar=HELPERDEP2,NACNST ; Fake structure AI always has + Nod construction yard
PrerequisiteTech=HELPERDEP2,CACNST ; Fake structure AI always has + Forgotten construction yard
If you had more factions in your mod, you'd need to take over one or more of the following OR prerequisites for them:
I seemed to run into some problems with the OR prerequisites again, no idea why. Had them working perfectly already but suddenly the entire thing just blew up on my face again. Taking over PrerequisitePower, which is supposed to always work, made the GDI and Nod go crazy. You need to be very careful when dealing with these, even minor changes somewhere can make the AI go full retard.
Next we need to edit the [AI] section to make the AI use the OR prerequisites properly. HELPERDEP2 absolutely needs to be the first structure in the lists where it appears! If it isn't listed first, the game will give you an IE. This happens because the AI thinks some of its structures have unreachable prerequisites. If you have more factions, add HELPERDEP2 to the proper lists here, depending which OR prerequisites you took over. E.g. if you took over PrerequisiteFactory, add HELPERDEP2 into BuildWeapons list as the first entry.
Code:
[AI]
BuildTech=HELPERDEP2,NATECH,GATECH,CATECH ; Since we took this over, HELPERDEP2 needs to be listed first here!
BuildBarracks=HELPERDEP2,NAHAND,GAPILE,CABRCK ; Since we took this over, HELPERDEP2 needs to be listed first here!
BuildRadar=HELPERDEP2,GARADR,NARADR,CARADR ; Since we took this over, HELPERDEP2 needs to be listed first here!
BuildConst=HELPERDEP1 ; An extra fake building needed for AI to work properly
BuildRefinery=GAPROC,NAPROC,CAPROC ; Every factions refineries
BuildPower=NAPOWR,GAPOWR,NAAPWR,CAPOWR ; Every factions power plants
BuildWeapons=GAWEAP,NAWEAP,CAWEAP ; Every factions warfactories
BuildDefense=NAOBEL ; Every factions base defences
BuildPDefense=NAOBEL ; Every factions excess power base defences
BuildAA=NASAM ; Every factions anti-air defences
BuildHelipad=GAHPAD,NAHPAD,CAHPAD ; Every factions helipads
IMPORTANT: You MUST put a building owned by each faction into each main category here (const, refinery, power, barracks, weapons, radar, tech and helipad). In my quick test I hadn't given the Forgotten a helipad, so BuildHelipad had only the GDI and Nod helipads. This made the Forgotten AI stop all construction right there, preventing it from ever building the tech center. The AI is very picky in what it builds and when, and it really really wants to build some helipads after the radar and warfactory.
NOTE: Don't forget to update firestrm.ini too if you are using it! The unmodified firestrm.ini lists PrerequisiteFactory, PrerequisiteGDIFactory, PrerequisiteNodFactory and BuildWeapons in it, and these values override the rules.ini values. Either modify them or remove them.
To make full use of the OR prerequisites we just defined we need to adjust the Prerequisite of every buildable structure. Every structure must have the OR prerequisite + the real prerequisites. The first structure (power plant?) must have ONLY the OR prerequisite.
Code:
; GDI Power Plant
[GAPOWR]
Prerequisite=BARRACKS ; We took over the BARRACKS prerequisite for GDI
Owner=GDI,Special ; Also remember to add Special as the owner for every buildable structure
; Nod Power Plant
[NAPOWR]
Prerequisite=RADAR ; We took over the RADAR prerequisite for Nod
Owner=Nod,Special
; Forgotten Power Plant
[CAPOWR]
Prerequisite=TECH ; We took over the TECH prerequisite for Forgotten
Owner=Forg,Special
; GDI Tech Center
[GATECH]
Prerequisite=BARRACKS,GAWEAP,GARADR ; Note how BARRACKS must be present for all GDI structures
Owner=GDI,Special
; Nod warfactory
[NAWEAP]
Prerequisite=RADAR,NAPROC,NAHAND ; Note how RADAR must be present for all Nod structures
Owner=Nod,Special
; Forgotten barracks
[CABRCK]
Prerequisite=TECH,CAPOWR ; Note how TECH must be present for all Forgotten structures
Owner=Forg,Special
Now let's add some things required for the 3rd faction (Forgotten) to work. If you don't want more than 2 factions, you can skip over this part.
Code:
[Houses]
0=GDI
1=Nod
2=Forg ; Added Forgotten as a faction. If you want more Houses, add them BEFORE Neutral and Special.
3=Neutral
4=Special
[Sides]
GDI=GDI
Nod=Nod
Forg=Forg ; Added Forgotten as a side. If you want more Sides, add them BEFORE Civilian and Mutant.
Civilian=Neutral
Mutant=Special
[Forg] ; This is the new Forgotten faction
Name=Forgotten
Suffix=FRG
Prefix=F
Color=DarkGreen
Multiplay=yes
Side=GDI ;Forg ; Nod has Side=GDI too, so playing it safe.
SmartAI=yes ; Think it should be on. Set it to Yes for GDI too (by default they don't have it).
That's all the ini editing. We need a few hacks to the EXE to make all of this work. You can use a tool like Hex Editor Neo to do this. Open Game.exe and:
Go to offset 0x1DEE36. You should see 6A 0A there. Change it to 6A 0E. This hack will make AI starting units in a match go into "Hunt" mode instead of "Area Guard". Needed to make the AI deploy it's side-specific MCVs properly.
Go to offset 0x1DEE45. You should see 6A 05 there. Change it to 6A 00. This hack will put human starting units in a match into "Sleep" mode instead of "Guard". Needed so the human MCV does not move around at the start of the match.
This final hack is only needed if you added a 3rd or more factions:
Go to offset 0x1DE389. You should see 01 there. If you have one new faction, change it to 02. For two new factions, change it to 03, for three new factions, change it to 04, etc. This hack will make AI play as the new factions you have defined.
You should also edit the language.dll to hide the Bases, Short Game and Unit Count settings. I've attached a version of it with those settings disabled (still visible though). Edit the language.dll to hide them properly and rearrenge the menu. You can use Resource Hacker to do this.
One final thing to do. This sure is a long ass tutorial. Every skirmish / multiplayer map in your mod needs to have one special Trigger. This trigger will silence the annoying EVA "unit lost" message you would get at the start of a match. Define the Trigger as shown below. Remember that EVERY skirmish / multiplayer map needs to have this. Even if you forget to add it, it won't cause a crash or anything, but you will hear the annoying EVA message.
Update: Will need to add another special Trigger to fix a problem with the HELPER unit. As it targets someone to fire the suicide weapon, the shroud around the HELPER unit is revealed a bit. This trigger will reshroud the area right away at the start of the match. If I find a way to stop the shroud from being revealed in the first place, I'll update the tutorial. For now this can be used to get around the problem.
I will write some ai.ini tips later, writing this tutorial took ages as it is. The ai.ini stuff will cover how to make the AI build a backup MCV and replace lost con.yards, and how to handle the AI for 3rd or more factions.
I've attached a mini test mod here that you can use to test this logic. Put it over an unmodified TS/FS. Test it in the Grand Canyon map as it's the only map I've added the EVA Shut Up trigger to, and it also has a reveal trigger so you can see what the AI is doing.
Credits to AlexB for pointing out the starting unit hacks. Without them this logic would have never worked. Credits to GameMaster0000 for his original 3rd faction tutorial, from which this tutorial borrows alot from.
Just tested how engineer capturing works with the side-specific con.yards and I have to say I am positively surprised. Was almost certain that there'd still be a small issue:
You are playing as Nod and capture a GDI con.yard. Now you've fulfilled the prerequisite to build a GDI power plant. Then, you undeploy, sell or lose the GDI con.yard. I assumed you'd still be able to construct the GDI power plant since you met the prerequisite already, and you still had your own Nod con.yard alive, so you wouldn't have lost the GDI tech.
To my surprise you can't build any GDI structures anymore, not with the Nod con.yard. So each sides structures can only be constructed as long as you have their con.yard. Works with the 3rd faction as well. Was almost certain having placed Special in the Owner key for all structures would keep them available regardless of your con.yard, but apparently not. I don't know why it works like it does, but I couldn't be happier about it _________________ QUICK_EDIT
Is it possible to use Alternative Factory logic by making the conyards have multiple owners such as:
Owner=GDI, GDINaval, GDIHeavy ?
This didn't work with the standard method, might work all of a sudden with this.
EDIT: Additionally, you can completely disable EVA Voices via triggers using Action 102 which is incorrectly labelled as Lightning Storm Strike at Waypoint. Select 0 for disable and 1 for activated, it's been a while since I used it so I may be wrong, just check the Firestorm missions.
EDIT 2: If I recall, this will also screw up singleplayer missions due to how it handles buildconst, the fix is to simply add the rules.ini section for BuildConst into the map itself to directly use the players conyard but doing this crashes FinalSun when it attempts to load the map so only add it once you're done with the map. _________________ QUICK_EDIT
Ran into some problems with AI replacing con.yards with the Unload mission type. Stupid thing got stuck when the AI's own structures were in the way. Changing the script to Hunt solved the problem, it doesn't seem to get stuck anymore.
Morpher wrote:
Is it possible to use Alternative Factory logic by making the conyards have multiple owners such as:
Owner=GDI, GDINaval, GDIHeavy ?
This didn't work with the standard method, might work all of a sudden with this.
Yes the con.yard can have multiple owners, but every buildable structure must have multiple owners as well. That is a GDI con.yard could have Owner=GDI,GDINaval, but the Naval Yard wouldn't work with just Owner=GDINaval. It would need a second owner. What would you try to achieve with the alt factory logic in this case? It already works as it should, GDI con.yard can only build GDI structures. Lose it and it doesn't matter if you still have a Nod con.yard, you can't build the GDI stuff anymore.
Morpher wrote:
EDIT: Additionally, you can completely disable EVA Voices via triggers using Action 102 which is incorrectly labelled as Lightning Storm Strike at Waypoint. Select 0 for disable and 1 for activated, it's been a while since I used it so I may be wrong, just check the Firestorm missions.
Playing the empty EVA voice accomplishes the same though, with just one trigger / action. This might work with just one trigger too though, but it would at least require 2 actions.
Morpher wrote:
EDIT 2: If I recall, this will also screw up singleplayer missions due to how it handles buildconst, the fix is to simply add the rules.ini section for BuildConst into the map itself to directly use the players conyard but doing this crashes FinalSun when it attempts to load the map so only add it once you're done with the map.
What are all the things BuildConst affects in singleplayer missions? I know the AI at least checks that it has the structure listed in BuildConst before trying to build anything. Guess you could edit the singleplayer missions and give the AI the HELPERDEP2 structure so the BuildConst condition is satisfied. Or when they deploy an MCV mid-mission, give them the HELPER unit at the same time and order it to deploy. _________________ QUICK_EDIT
One little annoyance I hadn't thought about, since the test map was using a reveal trigger. When the human HELPER unit fires the weapon to suicide itself, it reveals the shroud around itself to the enemy it targetted. Is there a way to stop this from happening on the ini side? Like some animation or something that would reshroud the area. Or some special key that removes the shroud revealing for the unit. Already found a way to stop it with a map trigger that reshrouds the map after 1 time unit has passed, but I seriously would not want to add yet another trigger to maps. Can't use the EVA trigger to do this action, since the EVA trigger requires elapsed time 0, while this requires at least elapsed time 1. _________________ QUICK_EDIT
As for the Alternative Factory logic just realised you could do it with this. But it works kind of the opposite with con.yards. The con.yard needs to have one owner, while the structures it builds have two owners, and the con.yard as the prerequisite. E.g.
Isn't this the solution to the years old tech-tree bug?
You could give the tech center a new side, so all the things that have it as prerequisite are removed again, once the tech center is destroyed again.
At least buildings. Units would still stay or you make the tech center as another warfactory. _________________ SHP Artist of Twisted Insurrection: Nod buildings
First off, as I suspected earlier, under [CrateRules] you have to set FreeMCV=no. The game would keep giving you the HELPER units otherwise, even if they had CrateGoodie=no. If you wanted to increase the likelihood of MCVs popping from crates, create extra clones of the MCVs and give them TechLevel=-1 and AllowedToStartInMultiplayer=no.
Next, all the MCVs need to swap the Jellyfish=yes to Secondary=DeployWeapon. Jellyfish has a small glitch that allowed the MCV to occupy the same cell with other units. You could put as many MCVs as you wanted into a single cell. We can make the AI deploy them correctly by giving them the DeployWeapon as secondary weapon. Since the unit has no primary, the unit really doesn't have a weapon. But as the AI is deploying the unit, it does take into account the Range of the secondary weapon that really doesn't even exist. This makes the AI deploy MCVs properly without having any side-effects on the unit.
Another thing to make AI deploying even smoother is to change the hack on AI starting unit behavior from "Unload" to "Hunt".
The other small problem I noticed was the HELPER unit revealing shroud to the player it happened to target with it's fake weapon. Haven't found any other way to fix this yet but to add another map trigger that immediately grows the shroud by 2 steps at the start of the match (enough to hide the area that was revealed by the HELPER unit).
The first post has been updated with all of these new changes and additions. Can someone upload the pics to PPM? _________________ Last edited by SuperJoe on Wed Mar 27, 2013 7:12 am; edited 1 time in total QUICK_EDIT
And as promised here are instructions on how to make AI replace lost con.yards. It's actually more effective than what the original game uses.
First off I'd recommend a few tweaks in rules.ini
Code:
[General]
UseMinDefenseRule=no ; I'd recommend always setting this to No, it can make the AI passive at start.
FillEarliestTeamProbability=90,90,90 ; Important so AI replaces MCVs faster
To start off in ai.ini we need to define the TaskForce.
Next a few Scripts to make the MCV behave correctly.
Code:
[ScriptTypes]
...
xx=MCV_IDLE
xx=MCV_DEPLOY
; MCV Idle Script
[MCV_IDLE]
Name=MCV Idle
0=5,20 ; Becomes recruitable after guard job is over
; MCV Deploy Script
[MCV_DEPLOY]
Name=MCV Deploy
0=42,0 ; Force facing (north). These help it not get stuck.
1=21,0 ; Scatter
2=42,0 ; Force facing (north)
3=42,6 ; Force facing (west)
4=11,14 ; Do this -> Hunt (Makes it deploy until successful)
Next up two TeamTypes.
Code:
[TeamTypes]
...
xx=MCV_GDI_IDLE
xx=MCV_GDI_DEP
; MCV GDI Idle TeamType
[MCV_GDI_IDLE]
Name=MCV GDI Idle
House=GDI
Priority=100
Max=1 ; If you wanted the AI to build even more backup MCVs, increase this.
Script=MCV_IDLE
TaskForce=MCV_GDI
Aggressive=no
AvoidThreats=yes
Annoyance=no
Suicide=no
Whiner=no
Group=-40094 ;-1
AreTeamMembersRecruitable=yes ; Needs to be Yes so it can be recruited
Recruiter=no ; This is built not recruited
LooseRecruit=no
IsBaseDefense=no ; No, so trigger condition can be used.
GuardSlower=yes
OnlyTargetHouseEnemy=no
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Reinforce=no
Droppod=no
Full=no
; MCV GDI Deploy TeamType
[MCV_GDI_DEP]
Name=MCV GDI Deploy
House=GDI
Priority=100
Max=1 ; No more than 1 or AI can get cloning bug!!!
Script=MCV_DEPLOY
TaskForce=MCV_GDI
Aggressive=yes
AvoidThreats=yes
Annoyance=no
Suicide=no
Whiner=yes
Group=-40094 ; Special MCV grouping
AreTeamMembersRecruitable=yes ; Should it get stuck somehow or lose the team
Recruiter=yes ; Primarily recruit, only build it if no MCV available.
LooseRecruit=yes
IsBaseDefense=no ; No, so trigger condition can be used.
GuardSlower=no
OnlyTargetHouseEnemy=no
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Reinforce=no
Droppod=no
Full=no
1. AI checks if he has less than one MCV. If true, build an MCV. But do not deploy it yet. If you wanted more backup MCVs increase the condition to less than X.
2. AI checks if he has less than one Construction Yard. If true, fire the emergency trigger (all weights 5000.0000 = FIRE THIS TRIGGER NOW). If the AI at this point has the backup MCV(s), it will recruit one of them and order it to deploy. It won't get stuck in terrain, units or buildings, the keys on the unit and the script ensure it will keep deploying until successful. If the AI didn't have a backup MCV, it will instead construct a new MCV and order it to deploy right away.
Both of the triggers become active / inactive as the AI meets their condition or no longer meets it. No backup MCV -> Build a backup MCV. No con.yard -> recruit or construct a new MCV and order it to deploy.
This final part solves a small issue under very specific circumstances. When the AI has lost it's warfactory, all triggers that contain a TeamType with vehicles become inactive. Same is true for barracks, and for helipads. This creates a bit of a problem: What if the AI has lost both the con.yard and the warfactory, but it still has the backup MCV. Since all triggers involving vehicles are disabled, the AI is too stupid to deploy the MCV. To get around this we need to adjust the HELPERDEP1 structure to become a "fake" warfactory.
Code:
[HELPERDEP1]
WeaponsFactory=yes ; These ensure AI will deploy backup MCV when he has already lost the real warfactory
Factory=UnitType
DeployTime=999999999999
Owner=GDI,Nod,Forg,Special
Cloakable=yes ; So AI does not waste Ion Cannon on it (it counts as a warfactory)
ThreatPosed=0 ; So AI does not waste Cluster Missile on it
Now the AI will always have a "warfactory", thus vehicle triggers like the backup MCV never go inactive. But since this warfactory has a 0x0 foundation, the AI does not use it to build vehicles, or get the cloning bug. All it does is keep the AI thinking it should still be firing vehicle based Triggers. With this change the AI will recover from a situation where it has lost both the con.yard and warfactory, but still has the backup MCV(s). Small side-effect is that the AI will never do the "sell everything and rush at the enemy" tactic when it has basically lost. This is because it still thinks it has a warfactory and still has a chance to win. Small price to pay to make the AI recover from losing both con.yard and warfactory.
The fix works as such if you only have 2 factions. For 3rd faction it won't work without some extra work. This is due to HELPERDEP1 being listed in BuildConst. Took me a while to realise what's wrong, but the issue is that the Owner of HELPERDEP1 is being forced to be either GDI or Nod, upon deploying. It's not very hard to make it work for 3rd or more factions, but I'm still trying to find the cleanest way to achieve it. Will update this tutorial later when I've find the most efficient way to do it.
Oh and for those new to working with ai.ini for 3rd or more factions, there are only 2 small things you need to know.
- For the TeamType, set the House key to your new faction. E.g. House=Forg.
- For the Trigger, adjust the house ID number to the new faction. 1 = GDI, 2 = Nod, 3 = New faction A, 4 = New faction B, etc. The number (3) is highlighted in the example below:
xxxxxxxx=Forg Test Trigger,FORGTESTT,<all>,1,1,CABRCK,0100000003000000000000000000000000000000000000000000000000000000,90.000000,90.000000,90.000000,1,0,3,1,<none>,1,1,1 _________________ QUICK_EDIT
[AI]
BuildBarracks=HELPERDEP2,NAHAND,GAPILE,CYBBAR,MABARR ; barracks ratio based on these buildings
BuildRadar=HELPERDEP2,GARADR,NARADR,CRADR,FAARAY
BuildTech=HELPERDEP2,NATECH,GATECH,MUPILE,CYTECH ; should build on each of these
BuildWeapons=HELPERDEP2,GAWEAP,NAWEAP,CWEAP,DGWEAP,MECHFACT
; construction yard
[GACNST]
Name=GDI Construction Yard
Image=GACNST
ConstructionYard=yes
Strength=1000
Armor=heavy
TechLevel=-1
Adjacent=2
Factory=BuildingType
UndeploysInto=GMCV
Sight=10
Owner=GDI,Special
Cost=2500
Points=80
Power=0
Capturable=true
Crewed=yes
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
ThreatPosed=0 ; This value MUST be 0 for all building addons
DamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSys
DamageSmokeOffset=1470, 1060, 1078
AIBuildThis=no
TogglePower=no
[NACNST]
Name=Nod Construction Yard
ConstructionYard=yes
Strength=1000
Armor=heavy
Image=GACNST
TechLevel=-1
Adjacent=2
Factory=BuildingType
UndeploysInto=NMCV
Sight=10
Owner=Nod,Special
Cost=2500
Points=80
Power=0
Capturable=true
Crewed=no
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
ThreatPosed=0 ; This value MUST be 0 for all building addons
DamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSys
DamageSmokeOffset=1470, 1060, 1078
AIBuildThis=no
TogglePower=no
[CACNST]
Name=CABAL Construction Yard
ConstructionYard=yes
Strength=1000
Armor=heavy
Image=GACNST
TechLevel=-1
Adjacent=2
Factory=BuildingType
UndeploysInto=CMCV
Sight=10
Owner=CAB,Special
Cost=2500
Points=80
Power=0
Capturable=true
Crewed=no
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
ThreatPosed=0 ; This value MUST be 0 for all building addons
DamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSys
DamageSmokeOffset=1470, 1060, 1078
AIBuildThis=no
TogglePower=no
[FACNST]
Name=Forgotton Construction Yard
ConstructionYard=yes
Strength=1000
Armor=heavy
Image=GACNST
TechLevel=-1
Adjacent=2
Factory=BuildingType
UndeploysInto=FMCV
Sight=10
Owner=FORG,Special
Cost=2500
Points=80
Power=0
Capturable=true
Crewed=no
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
ThreatPosed=0 ; This value MUST be 0 for all building addons
DamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSys
DamageSmokeOffset=1470, 1060, 1078
AIBuildThis=no
TogglePower=no
You know what could be wrong? Btw do power buildings from 3th and 4th faction need the AIBuildThis=yes tag?
Players can deploy the 3th and 4th MCV without problems. QUICK_EDIT
I would guess the problem lies in the AI not being able to meet the prerequisites for some of their core structures (listed under [AI]). Make sure all the prerequisites for Cabal and Forgotten structures are correct and the AI can access them all. Make sure the Owner keys are correct for all of them (e.g. Owner=Cabal,Special). Also make sure the buildings are listed in correct order under [BuildingTypes]. E.g. the power plant first, then refinery, barracks, etc. In the order that they become available to build. HELPERDEP1 and HELPERDEP2 need to be at the very top of the list.
The construction yards of each side do not need Special as the owner, only the real owner. Power plants for 3rd+ factions need some extra work. You need to create AI-only clones of them, enough that the AI generally does not go into low power. If he goes to low power, he will construct a Nod basic powerplant. So just create enough power plant clones for the AI, and make sure he builds them in an order where he doesn't go into low power. And yes they need AIBuildThis=yes. _________________ QUICK_EDIT
Hmm, all owner tags are right...the prerequisites too...
Strange thing, your old method worked, but this one doesn't seem to go right for me. It had to be a minor mistake by me. Have to look once more. _________________
You could send me your rules.ini and I could try to find out what the problem is. When exactly does the IE happen? Right when the factions deploy the MCV? Or right when the match starts? Happens for both Cabal and Forgotten? _________________ QUICK_EDIT
Check your PM and try it with the edited rules.ini. Cabal and Forg were missing buildings under BuildPower=, which would certainly cause the AI to get into problems as the first thing it constructs is a power plant. You also still had Special as the owner of all MCVs and con.yards, which should not be there.
None of the units need Special as the owner either, remove it from all of them or they might appear incorrectly available for sides they do not belong to. Only all structures require Special as the secondary owner.
EDIT: I recall structures having a problem with something if they weren't named in a specific way. Like the structure name has to start with either GA, NA or CA or it can't have theater specific version? Or buildup anims? I remember something about a problem like this years and years ago when I first added Forgotten structures to my mod. If this is true, then you might have to change the Forgotten building names from e.g. FACNST to something else. Though could be that I was doing something else wrong back then. _________________ QUICK_EDIT
I managed the AI to build up their bases till AA. What building do they build next? They build up their Factory, Tech building, defense and AA. After that the game get an IE
I looked what GDI and Nod AI do...tried to understand in what order they build up. But I don't get it really.
EDIT: Ok I got it fixed now...it was the gates. _________________
I managed the AI to build up their bases till AA. What building do they build next? They build up their Factory, Tech building, defense and AA. After that the game get an IE
I looked what GDI and Nod AI do...tried to understand in what order they build up. But I don't get it really.
EDIT: Ok I got it fixed now...it was the gates.
You should probably leave ConcreteWalls= as it is by default, the AI doesn't build walls anyway so it might just lead to problems. If you get similar problems later on, try removing things one by one from BuildDefense=, BuildPDefense= or BuildAA=. None of these are absolutely required for the AI, unlike the other things under [AI]. _________________ QUICK_EDIT
Okey but how can I force to build the AI buildings after the tech building, for example the Cabal Core? I have set AIBuildThis=yes but the AI ignores it. Would it work with a dummy clone instead?
EDIT: Nevermind got it to work, by making the Cabal Core AIs TECH building and removing the CYTECH requirment for it. _________________
Okey but how can I force to build the AI buildings after the tech building, for example the Cabal Core? I have set AIBuildThis=yes but the AI ignores it. Would it work with a dummy clone instead?
Huhh... can't say I noticed that before but you're right, the AI didn't build the structure with tech center as prerequisite in my mini test mod either. Did some testing on this and found out something odd / interesting. The 3rd+ faction AI does not construct the structure that has the highest prerequisites of them all. This is true for your Cabal Core too?
But then I added one more structure, that has the problematic structure as prerequisite. Now the AI builds the problematic structure, but not the new structure I added. So to solve your problem, add one more AI-only structure that has the Cabal Core as prerequisite. Make sure the new structure has AIBuildThis=yes, a proper TechLevel, and BuildLimit=0 (this will disable it from human players). Now the AI should build the Cabal Core (and the other high tech stuff?), but not this new fake structure. Let me know if this solved the problem for you, I'd be interested to hear. Will need to update the tutorial if this really solves it. _________________ QUICK_EDIT
Yes it's true, now CABAL builds it Core. It looks like any building after the Tech building needs a dummy building after it.
What if you list all the high tech buildings as prerequisites for the same fake structure? If it works this way you'd only need one fake structure. _________________ QUICK_EDIT
ok lol now I got the AI to build all the structures after the tech center. I had them like this:
[STRUCTURE_A]
Prerequisite=FACTORY,CATECH
[STRUCTURE_B]
Prerequisite=FACTORY,CATECH
[STRUCTURE_C]
Prerequisite=FACTORY,CATECH
If the AI has only one structure with the highest prerequisite (FACTORY,CATECH), it won't build it. But if there are two or more structures that have the same highest prerequisites (FACTORY,CATECH), it will build all of them. Maybe the AI wants to like have options on what it builds next, and if there's only one option it's too stupid to build it? That's pretty messed up.
EDIT: ok so the best solution is that if you have only one structure with the highest possible prerequisites, you need to create another structure that has the same prerequisites. Either it is a real structure, or a fake AI-only one. It's better to let the AI build a fake AI-only structure than to have it "stuck" not being able to build the last structure. That could probably mess up the AI down the road. _________________ QUICK_EDIT
I think the easiest way to fix this (if you have only one structure with the highest prerequisites) is to give the AI a cloned base defence that shares those highest prerequisites. Give it IsBaseDefense=no so the AI will only build one of them. This way the extra added structure isn't hacky, and doesn't lead to anything weird since you can't capture base defences with engineers.
Unfortunately the AI wants to be a dick about this, if you lower the tech level the problem might arise again if on that specific tech level it runs into the same situation again (only one structure with the highest prerequisite). I'd go around testing each tech level and see if the AI is getting the problem, and if he does, add a new cloned base defence to sort it out. I doubt it happens on every tech level since warfactory, radar, etc are always built. This problem concerns structures that are not listed under [AI] at all.
When I tried to solve it with a structure that has TechLevel=1 and prerequisites the AI could not reach at the lower tech levels, I got some IEs after setting the game speed to 6 and waiting for a while. I've attached them if anyone can figure out what caused them.
I noticed that 3rd Faction has still problems with Nod buildings...here I have a screenshot from a longer game. The AI on the screen was close before defeat. It started rebuilding...but yeah with Nod buildings and Forgotten ones
mutant_127.jpg
Description:
Filesize:
525.21 KB
Viewed:
38536 Time(s)
Last edited by Astor on Fri Apr 05, 2013 8:50 pm; edited 1 time in total QUICK_EDIT
I noticed that 3rd Faction has still problems with Nod buildings...here I have a screenshot from a longer game. The AI on the screen was close before defeat. It started rebuilding...but yeah with Nod buildings and Forgotten ones
Which ones are Nod structures, which ones Forgotten? When did this happen, what structures did he have left when it glitched out? Did he have the con.yard all the time, never lost it? Which Nod structure did it build first (excluding the Nod power plants, that is a known bug)? Also, did you remove Special as the owner from all the MCVs and con.yards as I instructed before?
I haven't gotten this sort of bug despite blowing the 3rd faction AI base to pieces. It has always recovered normally. I have never tried a 4th faction so can't tell if that would lead to problems. But I highly doubt that, cause WW hasn't coded any sort of things for a 3rd faction, so there shouldn't really be any difference between a 3rd and a 4th faction.
Btw can you scale that image down, it's really making this topic hard to read for my ancient 1280x1024 monitor (need to scroll horizontally to be able to read posts). _________________ QUICK_EDIT
The Nod buildings are the Nod Factory, those 2 normal looking Refineries and the Nod Power Plants.
Actually I have seen another Forgotten AI after some time building a GDI Armory and anothers faction refinery (GDI or Nod one). It looks like it randomly picks up buildings o_O.
EDIT: yes Special is not a owner of the MCVs neither the conyards. This happen just to the Forgotten (4th faction) The Cabal AI does it job perfect. _________________
Could you send me your rules.ini again, and if you have firestrm.ini in use, that too? Can you remember which structure it built first, the Nod refinery or warfactory? What is a GDI armory (warfactory, barracks, tech center)?
EDIT: Also try this quick test. Swap the Forgotten and Cabal around, so Forg is the 3rd faction and Cabal the 4th. Rearrenge the lists under [AI] as well, so the structures are listed in the order of GDI, Nod, Forg, Cabal.
Also add this unit into your map (grand canyon?) to make the testing easier:
I am not sure which building came first...was with gamespeed 6 and I was scrolling to the Forgotten base, then I saw them.
I think it was the refinery, because another Forg AI build it also one time (late gameplay)
The GDI armory is nothing special AI wise. I use it as early tech building. It has Prerequisite=BARRACKS,GAPILE,GARADR. It has just the tag AIBuildThis=yes but it's not in any AI Build list.
Meh...I can't reproduce that. Tried destroying all kind of buildings...only building Nod Power Plants but not refinaries or factories. Strange.... _________________
AIAlternateProductionCreditCutoff=-1000 ; So AI would not try to build the default harv / ref
HarvesterUnit=HARVX
[IQ]
Harvester=6 ; So AI does not use the hardcoded way to replace harvesters
Since you are using side-specific harvesters and refineries for every side, you should do these changes. The game has a hardcoded logic to replace lost harvesters, but it attempts to build the unit listed in HarvesterUnit=. To stop the AI from using the default harvester replacement logic, set Harvester=6 under [AI]. The HARVX unit listed in HarvesterUnit= should be owned by all the playable factions, cause the AI does sometimes force itself to build one of them. I've been having this annoying bug in my mod for years, haven't found a way to stop it. The AIAlternateProductionCreditCutoff thingy tries to make sure the AI doesn't go and try to build the default harv / first entry listed in BuildRefinery=.
In my mod I've been using only one value for BuildRefinery. For my 3rd faction I've created 3 clone refineries, so in the end it builds 4 refineries in total. The reason why I've had only one value in BuildRefinery is that loooong time ago I had 2 values in it, one for GDI and one for Nod. I remember that at some point the Nod AI went all out crazy and started constructing civilian structures out of nowhere. It does sound bit like what you ran into... I'm not 100% sure the Nod AI bug was caused by having multiple values in BuildRefinery, but I know I haven't gotten the bug since then.
Infact I've been advicing people not to put more than one value for BuildRefinery for years, but recently when creating this tutorial I decided to test it again. I haven't run into any problems myself yet, but it is possible it could be behind this. Try the changes I listed here first, and try swapping Forgotten and Cabal around and see if the problem occurs for Cabal instead. If none of this helps you should try using only one value for BuildRefinery (possibly with none of the factions as its Owner). Then create clone refineries for each faction (remember to put them all into the Dock key for the harvesters!). You also need to create harvester replacement teams / triggers in ai.ini if you get rid of the hardcoded logic for it. Though I advice you to do it, then you can decide yourself how many harvesters you want the AI to have (think the hardcoded logic tries to keep 4 harvesters going at all times, at least for the hard AI). _________________ QUICK_EDIT
I remembered that around the time when the Nod AI went crazy, I also had recently rearrenged the [BuildingTypes] list to sort out the sidebar (the original WW list was a complete mess). And as we know the AI build order is tied to the way that list is arrenged. It could be that the Nod AI going crazy was due to that change, or that AND the BuildRefinery change together causing it somehow. Check out that the Forgotten structures are properly ordered in the list. Look especially where the problematic structures are placed in the list (Nod refinery, Nod warfactory, GDI armory) in relation to the Forgotten ones.
Does anyone remember how exactly the list worked for the AI? I recall it starts from the top of the list, builds the 1st structure it has the proper prerequisites to construct, then continues down the list, again building the next structure for which it has met the prerequisites for. It continues this way all the way through the list, then starts again from the top? When it builds something, does it continue down the list from there, or does constructing something make it jump back to the top of the list? I also believe the things under [AI] affect the build order to some degree (and give out IEs if something critical is missing). Though clearly BuildRefinery= is not critical, at least for the 3rd+ factions since I've had only one structure listed there, and it's only owned by GDI and Nod. _________________ QUICK_EDIT
About the BuildingTypes list....AI tries always to build the highest in the list...you could add 20 clones of a building before a wepaons factory. The result would be that the AI build ALL 20 clones first, before it goes on. If one is destroyed it stops building later buildings unitil the destroyed building is build again. _________________
I remembered that around the time when the Nod AI went crazy, I also had recently rearrenged the [BuildingTypes] list to sort out the sidebar (the original WW list was a complete mess). And as we know the AI build order is tied to the way that list is arrenged. It could be that the Nod AI going crazy was due to that change, or that AND the BuildRefinery change together causing it somehow. Check out that the Forgotten structures are properly ordered in the list. Look especially where the problematic structures are placed in the list (Nod refinery, Nod warfactory, GDI armory) in relation to the Forgotten ones.
Interesting.... Superjoe, did you mean that the AI buildings, are depending on with position the bulding is listet? =/.... 1. barracks 2. PROC? =/
When that is true... it will be explain, why the AI is building the walls (in the buildingphase) before it builds the Techcentre) =/ QUICK_EDIT
- AI MCV doesn't deploy in cases where the opponent is not reachable by land.
e.g. IslandWarfare2 (tresisles)/MountGlacier maps - separated by water or
by a dirt cliff. Once the bridge is repaired or the dirt cliff is destroyed
then MCV deploys! Blocking with overlays like Walls, also causes it.
Simple map changes to make it reachable solves it, in a way.
- EVA shut up uses 1,13,0,0 event, first event after map starts. Any event
case 1,8,0,0 catches it and we still hear Unit Destroyed message. Found
only in one user map - IslandWarfare2 map. Replacing 01000010=1,8,0,0
with like 01000010=1,13,0,2 solves it.
THANKs for a working method to bring 3rd AI side to TS. QUICK_EDIT
Tried updating this logic with something that would allow you to get rid of both the map triggers. Instead of suiciding the human owned HELPER unit at the start of the match, it would attach itself (with limpet logic) into an enemy infantry unit and thus disappear without EVA messages or revealing the map. This updated logic would make everyone start with the side-specific MCV and 1 infantry unit.
But alas, Westwood strikes again. While attaching limpets into infantry does not seem to slow the infantry down or change its selection box color, it does make it reveal terrain for you. So the ONLY part of the limpet logic that would be harmful for this updated trick is the one that is true. A big fcking sigh. _________________ QUICK_EDIT
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