Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Tue Mar 19, 2024 3:18 am
All times are UTC + 0
Allying with the AI (****)
Moderators: Global Moderators, Tiberian Sun Moderators
Post new topic   Reply to topic Page 1 of 1 [13 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Sun Jan 29, 2012 8:32 am    Post subject:  Allying with the AI (****) Reply with quote  Mark this post and the followings unread

This tutorial will allow you to ally with AI players in TS (without possible crashes). Though there are some limitations:

1. Can only ever ally with 1 AI player
2. Only opposing sides can ally, GDI + GDI and Nod + Nod alliances won't work. This could be corrected with AI only sides for GDI and Nod, but I won't cover that here.
3. Has to be enabled for each map specifically. Though this could be considered a good thing since the logic might force human players to ally with each other, so I would leave it for skirmish only maps or figure something else out.


Let's begin in rules.ini. Create this new infantry first:

Code:

; Informant
[INFORM]
Name=
Image=E1 ; Should use an invisible infantry SHP here
Category=Support
Prerequisite=CABHUT
Primary=none
Crushable=no
Immune=yes
Insignificant=yes
Strength=100
Armor=none
TechLevel=1
Sight=0
Speed=5
Owner=GDI,Nod
AllowedToStartInMultiplayer=no
Cost=0
Points=0
PhysicalSize=1
JumpJet=yes
Locomotor={92612C46-F71F-11d1-AC9F-006008055BB5}
MovementZone=Fly
ThreatPosed=0
ImmuneToVeins=yes


Then search for [VariableNames] and add these to the bottom:

Code:

...
12=GDI Exists
13=Nod Exists



Next up ai.ini. First we need to define a taskforce. Just as a reminder, remember to add each taskforce, script and teamtype to their respective index lists.

Code:

[00000001-G]
Name=Inform
0=1,INFORM
Group=-1



Then a few triggers.

Code:

[00000002-G]
Name=GDI Exists
0=12,12 ; Set "GDI exists" global variable "true"
1=3,97   ; Move to waypoint 97 to get out of the way

[00000003-G]
Name=Nod Exists
0=12,13 ; Set "Nod exists" global variable "true"
1=3,97   ; Move to waypoint 97 to get out of the way



Get's bit messier here, need to add a bunch of teamtypes. They are pretty much copies of each other, only the side and scripts are changed.

Code:

[00000004-G]
Name=GDI set self
House=GDI
Priority=1
Max=1
Script=00000002-G   ; Set GDI
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no

[00000005-G]
Name=GDI set GDI
House=GDI
Priority=1
Max=1
Script=00000002-G   ; Set GDI
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no

[00000006-G]
Name=GDI set Nod
House=GDI
Priority=1
Max=1
Script=00000003-G   ; Set Nod
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no

[00000007-G]
Name=Nod set self
House=Nod
Priority=1
Max=1
Script=00000003-G   ; Set Nod
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no

[00000008-G]
Name=Nod set Nod
House=Nod
Priority=1
Max=1
Script=00000003-G   ; Set Nod
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no

[00000009-G]
Name=Nod set GDI
House=Nod
Priority=1
Max=1
Script=00000002-G   ; Set GDI
TaskForce=00000001-G
Aggressive=no
AvoidThreats=no
Annoyance=no
Suicide=yes
Whiner=no
Group=-1
Reinforce=no
AreTeamMembersRecruitable=no
Recruiter=no
LooseRecruit=no
IsBaseDefense=no
GuardSlower=no
OnlyTargetHouseEnemy=yes
Autocreate=no
Prebuild=no
Loadable=no
OnTransOnly=no
TransportsReturnOnUnload=no
VeteranLevel=1
TechLevel=0
IonImmune=no
Droppod=no
Full=no



Finally, the triggers.

Code:

;GDI set self
00000010-G=GDI 1,00000004-G,<all>,1,1,GAPILE,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,1,0,<none>,1,1,1

;GDI set GDI
00000011-G=GDI 2,00000005-G,<all>,1,0,GAPILE,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,1,0,<none>,1,1,1

;GDI set Nod
00000012-G=GDI 3,00000006-G,<all>,1,0,NAHAND,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,1,0,<none>,1,1,1


;Nod set self
00000013-G=Nod 1,00000007-G,<all>,1,1,NAHAND,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,2,0,<none>,1,1,1

;Nod set Nod
00000014-G=Nod 2,00000008-G,<all>,1,0,NAHAND,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,2,0,<none>,1,1,1

;Nod set GDI
00000015-G=Nod 3,00000009-G,<all>,1,0,GAPILE,0100000003000000000000000000000000000000000000000000000000000000,5000.000000,5000.000000,5000.000000,1,0,2,0,<none>,1,1,1



If you haven't been scared away yet, I will explain what the idea is here. Normally alliances can't be formed on multiplayer maps cause we don't know which factions are actually participating in the match. Trying to ally with a faction that doesn't exist in the match would result in a crash. Since there's no apparent way to check if a certain faction exists (since the check itself would crash if that faction didn't exists), we let the AI do the work. Each AI will first look if they own a GDI Barracks or Hand of Nod, and if so set each faction's global variable enabled. E.g. Nod AI sees that he has a Hand of Nod, thus we can assume Nod is present in the match, and set the global variable true. Then the AI does the same check on their enemy, checking if they have a GDI Barracks or Hand of Nod, and again set the global variable true. This is needed because human players wouldn't be setting any global variables, so the AI needs to do it instead. After this ai.ini stuff, we now know which factions are present in the mission.

P.S. That new fake infantry is needed so the AI will only do these checks once. If the infantry could be killed the AI would keep replacing it.


Final part is to make use of all this in the map file. Open FinalSun and open the Trigger Editor. You need to add 2 new triggers, one for GDI and one for Nod. Below shows the GDI trigger details:


Nothing special here...




Here you need to add another event in addition to the one shown in the pic. Event 1 should be exactly the same as the one here, just change the Parameter value to 13.




...




Now add the trigger for Nod. Just clone this one and change every GDI value to Nod, and vice versa. Finally, add the special waypoint 97 to your map to make the AI send out their fake infantry away from blocking base construction. Should be placed somewhere remote.




That should cover it, if you run into any problems just ask here. There are a few instances where no alliances are made:

1. All players are of the same faction. Since GDI can't ally with GDI, nothing will happen.

2. A really small chance that the human player is the only one playing a certain faction (e.g. Nod) while all the AI are playing GDI, AND none of the AI's consider the player an enemy. Thus Nod's existence would never be set true, at least not until one of the AI's got mad at the Nod human player.


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

_________________

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


Joined: 03 Sep 2009

PostPosted: Sun Jan 29, 2012 8:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Made few fixes to the code, especially to the infantry. Also this

1. Can only ever ally with 1 AI player

Is only half true. You can only ally with 1 AI player of a faction type. So if you had 3 factions in your mod (e.g. GDI, Nod, Forgotten), a GDI human player could ally with 1 Nod AI and 1 Forgotten AI. I have no idea if those 2 AI players would then be allied too.

_________________

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


Joined: 03 Nov 2012

PostPosted: Wed May 01, 2013 1:55 pm    Post subject: Public map with this feature? Reply with quote  Mark this post and the followings unread

Is there any public map with this feature?
I felt so envious of RA2/YR skirmish map that allowed us to ally with the AI..

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


Joined: 16 Feb 2005
Location: North America Posts: You cannot comprehend...

PostPosted: Fri May 03, 2013 11:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

The AI gets soft though when allied to humans. They just don't attack as aggressively as enemy AIs.

_________________
Destroy to create. All for the hunt to dominate!

IN-GAME NAME: MAKINTOKE

Back to top
View user's profile Send private message
Bittah Commander
Defense Minister


Joined: 21 May 2003
Location: The Netherlands

PostPosted: Sat May 04, 2013 2:12 am    Post subject: Reply with quote  Mark this post and the followings unread

I think what you're referring to is the AI an allied human player turns into after that human player has left the game. That AI is indeed less competent, but that's not because it's allied to another human player (it'll be just as incompetent if it's not allied to anyone) and thus this doesn't say anything about how the AI will play after it allies with a human player via Super Joe's method.

_________________

Back to top
View user's profile Send private message Send e-mail ModDB Profile ID YouTube User URL Facebook Profile URL
DoMiNaNt_HuNtEr
General


Joined: 16 Feb 2005
Location: North America Posts: You cannot comprehend...

PostPosted: Sun May 05, 2013 12:14 am    Post subject: Reply with quote  Mark this post and the followings unread

OK

In Yuri's Revenge, when setting up AI team players before the match starts - in game, that team AI is definitely less competent when it is allied to humans. They just never seem to have the same aggression level as enemy AIs.

I presumed this was the same deal in TS/FS (less aggresive Allied AIs), and, when people presume, they make the president outta u & me  Very Happy

_________________
Destroy to create. All for the hunt to dominate!

IN-GAME NAME: MAKINTOKE

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


Joined: 23 Mar 2011

PostPosted: Sun May 19, 2013 2:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Why can't you ally AI in TS? In the latest patch to RA95 Westwood disabled allying AI in a hacky way with a special check that always fails, after removing that check you can ally the AI but the AI won't ally you back.

So I had to patch the game to make the AI ally you back when you allied them in Skirmish.

And not so long ago I made it so you can create alliances, select spawn locations, select colours, select handicaps and select countries for human and AI players when configured in a special INI file and the game launched with a special command line argument (-SPAWN) as part of hifi's spawner code for RA95.

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Sun May 19, 2013 3:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Because there is a simple check to not allow it for Skirmish in TS.

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


Joined: 23 Mar 2011

PostPosted: Sun May 19, 2013 9:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

what happens when you remove it?

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Mon May 20, 2013 5:11 am    Post subject: Reply with quote  Mark this post and the followings unread

I think it works somewhat, but the AI just goes to sleep.

Not 100% sure.

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


Joined: 02 Nov 2012
Location: Philippines

PostPosted: Mon Jun 10, 2013 5:57 am    Post subject: Reply with quote  Mark this post and the followings unread

What map did you used as a basis? Also how or when did you learn all of this? With your permission, may I post this tutorial somewhere? I'll give you a credit.

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


Joined: 02 Nov 2012
Location: Philippines

PostPosted: Fri Jun 21, 2013 6:06 am    Post subject: Reply with quote  Mark this post and the followings unread

oh yeah it worked. However AI still attacks me, forcing me to attack him though.

Back to top
View user's profile Send private message Send e-mail
DoMiNaNt_HuNtEr
General


Joined: 16 Feb 2005
Location: North America Posts: You cannot comprehend...

PostPosted: Sun Jul 07, 2013 5:23 am    Post subject: Reply with quote  Mark this post and the followings unread

I just tried this, did a single run through, added unit, added ai shit, added map stuff.

I made the map's shroud revealed, selected my unit, and hovered the cursor over all 7 other AI unit's, every one of them triggered an attack cursor.

So.. I fucked up. Sad

For the [Inform] unit, it's image is still E1. How can I get an invisible unit image?

I Saw the little dude flying, lolz. Awesome. he flew to the waypoint, but attack cursors all around.  All seven AI's sent their little emissaries to the way point at the top north end of the map. Then the AI situated at that starting point started shooting at him.

I'm using Twisted Insurrection. There was already a unit named [INFORM], so I made [INFORM2]. Plus, in TI, theres GDIA,B and NodA,B.

Not sure if I just fucked up, or if TI needs more to it than stock TS for this thing to work.

_________________
Destroy to create. All for the hunt to dominate!

IN-GAME NAME: MAKINTOKE

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [13 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
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

[ Time: 0.1613s ][ Queries: 11 (0.0091s) ][ Debug on ]