:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: 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 Sun Oct 22, 2017 9:11 pm
All times are UTC + 0
 Forum index » Modding Central » Tiberian Sun Editing Forum » Tutorials Factory
Found a way to make AI fully play as 3rd side
Moderators: Global Moderators, Tiberian Sun Moderators
Post new topic   Reply to topic Page 1 of 1 [24 Posts] View previous topic :: View next topic
Author Message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Fri Sep 03, 2010 4:33 am    Post subject:   Found a way to make AI fully play as 3rd side Reply with quote

While working on the AI for my mod I decided to mess around with the AI and try to make it play as my 3rd mutant faction. After some trial and error I think I've found a pretty flawless way to make the AI play a 3rd (and with some extra work 4th, 5th, etc) factions.

To begin, you'll of course need to have 3 or more factions done. See this tutorial for instructions:
http://www.ppmsite.com/forum/viewtopic.php?t=18889

Next, use this trick to allow the AI to start a match as 3rd, 4th, etc factions:
http://www.ppmsite.com/forum/viewtopic.php?t=16736

Now that that's out of the way, go to [Houses] in rules.ini. You'll need to add a new faction for the AI. In my case:

Code:

[Houses]
0=GDI
1=Nod
2=ForgAI ; This is for the AI only
3=Forg
4=Neutral
5=Special


Note that its important the faction is placed after GDI and Nod. If you wanted a 4th faction playable by the AI, you'd add it after ForgAI. Right below you'll see the [Sides] list. Again, add ForgAI after GDI and Nod.

Code:

[Sides]
GDI=GDI
Nod=Nod
ForgAI=ForgAI
Forg=Forg
Civilian=Neutral
Mutant=Special


Move on to the Country Statistics and add ForgAI there (just search for [GDI]):

Code:

[ForgAI]
Name=Do not choose me!
Suffix=FRA
Prefix=A
Color=DarkBlue
Multiplay=yes
Side=ForgAI
SmartAI=no ; Haven't tested enough to tell if this should be yes or no.


Next, go to the MCV unit entry. You'll have to use a faction shared MCV vehicle as the AI does not understand more than 1 MCV / construction yard. In my case GDI and Nod use the default MCV, while my own faction has a seperate one. You need to edit the GDI / Nod MCV as shown below:

Code:

[MCV]
...
Owner=GDI,Nod,ForgAI,Special
...


Same thing for the default construction yard:

Code:

[GACNST]
...
Owner=GDI,Nod,ForgAI,Special
...


Now it gets bit trickier. You'll need to "hijack" one of the default shared prerequisite settings. Look for this bit in rules.ini:

Code:

; Building prerequisite categories are specified here.
PrerequisitePower=CACSITE,FAKEY ;GAPOWR,NAPOWR,NAAPWR ; Took over this one. CACSITE is my 3rd faction's con.yard. Fakey will be explained later.
PrerequisiteFactory=GAWEAP,NAWEAP
PrerequisiteBarracks=NAHAND,GAPILE
PrerequisiteRadar=GARADR,NARADR
PrerequisiteTech=GATECH,NATECH


In my case the power prerequisite had become obsolete, since in my mod GDI and Nod have seperate refineries, and refinery used to be the only building with POWER as prerequisite. If POWER doesn't work for you, you'll have to find a way to free one of the other shared prerequisites.

Now, go to your 3rd faction's buildings and add this to all of them:

Code:

Prerequisite=POWER


Rest of the prerequisites for specific buildings will of course be listed after this one. But make sure at least one building (probably the power plant) has ONLY this prerequisite. Make sure all your 3rd faction buildings have AIBuildThis=yes set to them, except the construction yard. So in my case every building except CACSITE has it. If you give AIBuildThis=yes to the 3rd faction's construction yard the AI will get the cloning bug, so it's not a good idea.

EDIT: You also need to add the correct ownership to all 3rd faction buildings:

Code:

Owner=Forg,ForgAI,Special


The 3rd faction construction yard is the exception (CACSITE in my case), it needs to have:

Code:

Owner=Forg,Special


Next we need to define FAKEY to give the AI access to the 3rd factions buildings (since he never builds CACSITE):

Code:

[FAKEY]
Name=IM_NOT_HERE! ; Shouldn't be able to see this anyway
Image=INVISO ; I'm not sure this works for buildings... anyway, use an empty shp here.
BuildLimit=0 ; Disables it from human players
Owner=ForgAI,Special ; Notice the owners!!!
AIBuildThis=yes ; Yes, yes, yes!
Nominal=yes ; Rest of these keys simply make this fake building invisible and blow it up when the AI dies
Strength=10000
Cost=1
;Prerequisite=
Armor=wood
TechLevel=1
Adjacent=12
Sight=0
Invisible=yes
InvisibleInGame=yes
RadarInvisible=yes
Insignificant=yes
BaseNormal=no
IsBase=no
Immune=yes
LegalTarget=no
Selectable=no
Repairable=false
Capturable=false
TogglePower=no
Powered=false
Power=0
Crewed=no
Points=1
Explosion=
MaxDebris=0
DamageParticleSystems=
ThreatPosed=0


Finally, go under [AI] and add your side's structures to the list correctly:

Code:

BuildConst=GACNST ; Only accepts 1 value
BuildPower=NAPOWR,GAPOWR,NAAPWR,YOURPOWER
BuildRefinery=PROC ; I don't recommend more than 1 value, it can cause some SERIOUS bugs. Create extra AI only refineries instead.
BuildBarracks=NAHAND,GAPILE,YOURBARRACKS
BuildTech=NATECH,GATECH,YOURTECH
BuildWeapons=GAWEAP,NAWEAP,YOURWEAP
BuildDefense=NAOBEL,YOURDEFENCES
BuildPDefense=NAOBEL,YOURDEFENCES
BuildAA=NASAM,YOURDEFENCES_AA
BuildHelipad=GAHPAD,NAHPAD,YOURHELIPAD
BuildRadar=GARADR,NARADR,YOURRADAR


The AI will now start a match with the shared MCV, move on to construct this FAKEY building, and then gain access to all the 3rd faction structures and units. This method will not mess up sidebar building / unit lists for GDI, Nod or for any other extra factions. However there are few quirks:

1. You have to use up one of the shared Prerequisites as mentioned earlier
2. One extra faction will show up in the side selection box. This can't be exploited though, if you choose to play as ForgAI you'll start with an MCV. But once you deploy it you won't be able to build anything. So choosing the fake side really makes no sense.
3. The AI controlled 3rd faction has to use the default MCV / construction yard. I already tried and the AI does not build anything if he doesn't have the first building listed in BuildConst=. The human controlled 3rd faction can (and must) use a custom MCV / construction yard.
4. For some reason the AI will build some basic nod power plants and some of the 3rd factions power plants, even if you list the new factions power plants in BuildPower=. This might be fixable but I haven't found a way yet.

You can now make the AI build your 3rd factions units like you would with GDI and Nod AI. Just remember to set the owner of the TeamType to your 3rd faction, eg. House=ForgAI. In the AITriggerTypes you'll need to use 3 as the new faction indentifier. An example (the highlighted number needs to be 3):

Code:

08594AB0-G=H_Forg tank attack,07EB8E90-G,<all>,6,-1,<none>,0000000000000000000000000000000000000000000000000000000000000000,40.000000,10.000000,70.000000,1,0,[b]3[/b],0,<none>,0,0,1




Here's some pics of my tests with the AI.

Extra faction shown in the selection box




Forgotten AI base #1




Forgotten AI base #2



Key Words: #Tutorials #Modding #TiberianSun #Firestorm #Rules.INI #AI.INI 

Last edited by SuperJoe on Fri Sep 03, 2010 5:35 am; edited 1 time in total

Back to top
View user's profile Send private message
Palkia323
Pyro Sniper


Joined: 10 May 2008

PostPosted: Fri Sep 03, 2010 4:50 am    Post subject: Reply with quote

Looks very nice. I'll have to try this! Smile
_________________
Tore wrote:
Oh noes Nod32 must have found some GDI32 in the art.ini file!

3ds Topic
Clicky

Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Fri Sep 03, 2010 5:31 am    Post subject: Reply with quote

Something I forgot to mention is that every 3rd faction building of course need both the human and AI as owners. In my case:

Code:

Owner=Forg,ForgAI,Special


Only exception is the 3rd faction construction yard. It must only have:

Code:

Owner=Forg,Special


I've updated the original post to include this.

Back to top
View user's profile Send private message
GameMaster0000
Missile Trooper


Joined: 23 Mar 2006
Location: Thailand

PostPosted: Fri Sep 03, 2010 6:18 pm    Post subject: Reply with quote

Wow, that impressive. nice find.

Any way I can't try this due I my mod have 5 faction. also, add more faction for AI will screwed up my mission.
_________________

Tiberian Sun : True Power - Reality Power Of 5 Factions...

Back to top
View user's profile Send private message MSN Messenger
Death Cultist
Scorpion Sniper


Joined: 28 Apr 2009
Location: Auckland, New Zealand

PostPosted: Fri Sep 03, 2010 9:16 pm    Post subject: Reply with quote

wow, this is very impressive, well done!
_________________
Beta Tester for Mental Omega 3.0


Back to top
View user's profile Send private message
[TiberianFuture]
Scrin Overlord


Joined: 30 Apr 2009
Location: The Mothership

PostPosted: Sat Sep 04, 2010 8:01 am    Post subject: Reply with quote

Nice job, only flaw that I note is that the AI will have same-looking conyard/mcv across all factions... not much you can do for it I guess.
_________________
Check out some TF Kane's Wrath action:
Tournament 3rd place.
Vs. bikeRushOwnz in tournament.
Ladder wars vs. bikeRushOwnz.

Back to top
View user's profile Send private message MSN Messenger
INDIO
GDI Hacker


Joined: 08 Sep 2010

PostPosted: Thu Sep 09, 2010 8:01 pm    Post subject: Reply with quote

greated job, it takes some time to i make et works but i try et, your buildings looks very nice man you mast realese your mod or buildings to public (sorry my english)

Back to top
View user's profile Send private message
DonutArnold
General


Joined: 18 Jan 2005
Location: Finland

PostPosted: Thu Sep 09, 2010 8:34 pm    Post subject: Reply with quote

That's very good find!

Back to top
View user's profile Send private message
Morpher
General


Joined: 28 Jan 2005

PostPosted: Fri Sep 10, 2010 2:34 am    Post subject: Reply with quote

It's good, shame you can't hide the DO NOT CHOOSE side in the menu, I'm guessing the game will IE if you tried to play with it?
_________________


Back to top
View user's profile Send private message
Volgin
Commander


Joined: 07 Mar 2009

PostPosted: Fri Sep 10, 2010 2:36 am    Post subject: Reply with quote

Does the DONOTCHOOSE have to be Multiplay=yes?
_________________
Victory!

Back to top
View user's profile Send private message
Morpher
General


Joined: 28 Jan 2005

PostPosted: Fri Sep 10, 2010 3:13 am    Post subject: Reply with quote

Yeah otherwise AI won't play it
_________________


Back to top
View user's profile Send private message
GameMaster0000
Missile Trooper


Joined: 23 Mar 2006
Location: Thailand

PostPosted: Fri Sep 10, 2010 3:29 am    Post subject: Reply with quote

Can't we use multiplayerpassive with that?

Because we hack exe that can select it.
_________________

Tiberian Sun : True Power - Reality Power Of 5 Factions...

Back to top
View user's profile Send private message MSN Messenger
Morpher
General


Joined: 28 Jan 2005

PostPosted: Fri Sep 10, 2010 4:07 am    Post subject: Reply with quote

Multiplayerpassive sides aren't targetted properly by your units, so it would lead to some very buggy issues and I still think the AI will not select the side, all this hack does is make the ai select a playable side.
_________________


Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Fri Sep 10, 2010 2:52 pm    Post subject: Reply with quote

I already tested Multiplay=no, and it won't work, the AI that was supposed to be the 3rd side simply wasn't there. If a human chooses to play as the DONOTCHOOSE, he will simply start with the default MCV but won't be able to build any structures since he would either need the 3rd side con.yard or the FAKEY building. So it's only a cosmetic issue, it can't be exploited or used to make the game crash. Still, maybe Hyper could take a look if it could be hidden from the list somehow...

INDIO: Some of those structures have been released to public, check this thread:
http://www.ppmsite.com/forum/viewtopic.php?t=25906

The mod itself will be released late this month / early next month, you can check the forum here for updates:
http://www.ppmsite.com/forum/index.php?f=707

Back to top
View user's profile Send private message
iamn00b
Jumpjet Infantry


Joined: 23 Apr 2010
Location: indonesia, sticking at keyboard

PostPosted: Sun Oct 03, 2010 8:25 am    Post subject: Reply with quote

Wow! great find, trying...

note. i think you doesn't need "hijack" the prerequisite, just give all building THENEWSIDEMCV as prerequisite, since AI never use prerequisite
_________________

Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sun Oct 03, 2010 11:34 am    Post subject: Reply with quote

Eh, he said the AI doesn't use the new side CY but the common one. Only the playable new side uses the custom CY.
_________________

Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Sun Oct 03, 2010 12:36 pm    Post subject: Reply with quote

The AI doesn't care about prerequisites when it comes to units, but with buildings it actually does care. If you didn't hijack the generic prerequisite you would have to create an AI only copy of every building and unit of the 3rd side, which is alot more code Wink
_________________

Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Thu Feb 03, 2011 3:58 pm    Post subject: Reply with quote

I know this is a bump, but can someone with the proper rights move this topic to the Tutorials Factory? Also this topic. They should have gone there in the first place, my mistake... #Newbie
_________________

Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Tue Mar 15, 2011 2:01 pm    Post subject: Reply with quote

I've found a partial fix to the "3rd faction keeps building Nod power plants" problem. Create extra copies of your 3rd factions power plants that only the AI can build (BuildLimit=0 disables them from humans). Put them before the other 3rd faction structures in the [BuildingTypes] list, since the AI prefers to build things that are on top of the list first. You can also control the build order by adjusting the prerequisites of each power plant. Make sure the AI has enough of these extra plants, since if the AI ever goes to low power it will build the Nod one. This can still happen though if the enemy takes out enough of the extra plants.

I managed to completely stop the 3rd faction from building Nod power plants by changing the NodRegularPower= to a building that has AIBuildThis=no and a prerequisite that can't be met. Problem is it screws up the Nod AI (gets stuck trying to construct a 2nd basic powerplant), but for some reason it doesn't screw up the 3rd faction. Maybe with some further work it could be used to completely get rid of this problem.

EDIT: I can also confirm that PrerequisitePower seems to be the only prerequisite that can be "hijacked" without completely screwing up the AI. I've tried to use PrerequisiteRadar, PrerequisiteFactory and PrerequisiteTech instead, and every time the GDI and Nod AI stop building the structure related to the key, eg. when I took over PrerequisiteRadar the AI would never build any radars. So the AI building logic is somehow tied to the generic prerequisite keys. Some reason they don't seem to mind PrerequisitePower though.
_________________

Back to top
View user's profile Send private message
[TiberianFuture]
Scrin Overlord


Joined: 30 Apr 2009
Location: The Mothership

PostPosted: Wed Mar 16, 2011 7:00 am    Post subject: Reply with quote

Are you sure with that? I have 'hijacked' the PrerequisiteFactory tag just fine. My Nod does have some serious problems, but they're not related to that...

Sometime ago (year lol) I also took over the PrerequisiteGDI/NodFactory, and that cause no problems either that I remember.
_________________
Check out some TF Kane's Wrath action:
Tournament 3rd place.
Vs. bikeRushOwnz in tournament.
Ladder wars vs. bikeRushOwnz.

Back to top
View user's profile Send private message MSN Messenger
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Wed Mar 16, 2011 7:28 am    Post subject: Reply with quote

^^From my experience do the prerequisite groups NodFactory, GDIFactory and Radar also cause AI problems when used as an OR-conjunction for different buildings.

So i'm quite sure SuperJoe is right with the others too.
_________________
SHP Artist of Twisted Insurrection. Main Nod building SHP creator.

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant unit, 1 Scrin unit, 1 GDI building

Tools
TMP Shop
C&C Executable Modifier

Back to top
View user's profile Send private message
Astor
Cyborg Soldier


Joined: 01 Jan 2010
Location: Austria

PostPosted: Tue Apr 02, 2013 10:27 am    Post subject: Reply with quote

I tried this and it's working, in some way Neutral

After some time the game crashes, to say exactly after the 3rd or 4th faction reach a special point. I haven't set up any taskforces etc. for them, could that be the problem?

Also sometimes they don't deploy their MCVs. Cabal for example crashes when they want to build the War Factory, so I swapped prequisites with tech building. Now they build the factory without problem, then it tries to build tech building -> crash.

So I am not sure if this is a rules or ai problem.

I am looking forward to get some help for this problem Very Happy
_________________


Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Tue Apr 02, 2013 6:35 pm    Post subject: Reply with quote

Astor wrote:
I tried this and it's working, in some way Neutral


Don't use this tutorial anymore, use this instead. It does everything better and has less side-effects.
_________________

Back to top
View user's profile Send private message
DarkVen9109
Pyro Sniper


Joined: 02 Nov 2012
Location: Philippines

PostPosted: Sun Jun 02, 2013 1:16 pm    Post subject: Reply with quote

Not bad. I'll take this at home.

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [24 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Tiberian Sun Editing Forum » Tutorials Factory
Jump to:  
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.1908s ][ Queries: 11 (0.0043s) ][ Debug on ]