Jump to content
Sign in to follow this  
Lensflare

AI must capture

Recommended Posts

Hello fans of Red Alert 2

 

 

I am trying to make a simple mod by manipulating the *.ini files of Yuris Revenge and I need some advice:

 

The mod requires the AI Player (played by the computer) to capture certain buildings with the engineer.

These buildings can be seen as additional tech buildings (like oil derricks or airport for paratroopers).

 

For example, I have altered the "Einstein's Lab" to be capturable and placed it somewhere in the map by a map editor.

When I play the map, I can capture it, but the AI Player doesn't do it. Even if this building is in the middle of his base.

 

I looked into the "aimd.ini" file, where i hoped to find the solution for my problem and I found a piece of "code" that apparently lets the AI capture oil derricks.

I tried to extend this code to let the AI capture also the "Einstein's Lab" but I couldn't make it work.

 

Maybe someone knows how to make this or can tell me about a simple trick or something.

 

 

thanks in advance

Edited by Lensflare

Share this post


Link to post

Create a new ScriptType that uses Einstein's Lab as the numeric identifier for the building to 'attack.' Then create a new TeamType that uses the new script and a TaskForce that has an Engineer. Then create an AI trigger to have the AI actually use the new TeamType.

Share this post


Link to post
Create a new ScriptType that uses Einstein's Lab as the numeric identifier for the building to 'attack.' Then create a new TeamType that uses the new script and a TaskForce that has an Engineer. Then create an AI trigger to have the AI actually use the new TeamType.

 

Where do I find the numeric identifier for a building?

Is not a string used to identify Buildings? (Einsteins's Lab: "CALAB")

 

The ScriptTypes in aimd.ini look like this:

 

[0C9C878C-G]
Name=Allied Refinery Guard
0=58,1
1=5,10
2=58,196609
3=5,10
4=58,196609
5=5,10
6=6,1

 

Is there somewhere an explanation about the meaning of these numbers?

Or is there something like a refere for the ini files (especially for rulesmd.ini and aimd.ini) where all attribute names are listed and explained?

 

Share this post


Link to post
Where do I find the numeric identifier for a building?

Is not a string used to identify Buildings? (Einsteins's Lab: "CALAB")

That would be in the BuildingTypes list. If you want the number for CALAB, search CALAB in Rules until you find something like this:

 

[buildingTypes]

1=GAPOWR

2=GAREFN

3=GACNST

4=GAPILE

5=GASAND

6=GADEPT

7=GATECH

8=GAWEAP

;9=GAHPAD

9=CALAB <- Appears to be "9"

10=NAPOWR

11=NATECH

12=NAHAND

13=GAWALL

14=NARADR

15=NAWEAP

16=NAREFN

17=NAWALL

;18=NATMPL

18=CAHSE07

 

...appearances can be deceiving, it's actually 8. Capture Einstein's Lab script ought to look something like this:

[01000001]
Name=Capture Einstein's Lab
0=46,8

Share this post


Link to post

thank you very much

 

it seems to work now for Allied Engineer and Einstein's Lab.

 

(please don't close this topic because I will probably need further help with this engineer script)

Share this post


Link to post
(please don't close this topic because I will probably need further help with this engineer script)

We don't make a habit of closing topics when the question has been answered, only if it becomes disruptive, off-topic, or necroposted (and even those cases have exceptions).

Share this post


Link to post

Corrected BuildingType Arrays

For future reference.

 

Those modifiers for structure types do have significance, by the way.

Array Index + 0 - pick structure whose position poses the least threat

Array Index + 65536 - pick structure whose position poses the most threat

Array Index + 131072 - pick structure which is closest to you

Array Index + 196608 - pick structure which is the farthest away from you

Share this post


Link to post

This website ist great! :D

modenc.renegadeprojects.com

 

I found there a list of all possible Attributes that a building can have

and inserted these 3 into the [CALAB] definition to make Einstein's Lab invulnerable:

 

[CALAB]
...
Immune=yes
Crushable=no
OmniCrushResistant=yes
...

 

As intended, I can't attack this building now and it doesn't take damage from nearby explosions.

But it still can be blown up by tanya and the navy seal. Why?

 

When I change the strength from 1000 to -1

Strength=-1

... tanya and the navy seal go into the building and keep "shooting" C4 on it in a loop.

The building is prevented from being destoyed but the C4-laying units get stuck in there forever (or until they are killed).

 

Another strange effect is that if I capture this building, the AI enemy fires at it with tanks and GIs (although it is not attackable for me). This prevents the AI from being a strong enemy because he is focused on killing that building all the time.

 

 

So do you have an idea how to make this building completely invulnerable and not being attacked by the AI player?

 

 

Share this post


Link to post
So do you have an idea how to make this building completely invulnerable and not being attacked by the AI player?

Insignificant=yes

Share this post


Link to post

CanC4=no

this prevents tanya and the navy seal from using C4 on the building. But now they fire on it with their primary weapons (pistols, rifle).

This is really weird because other units can not fire on it (thanks to "Immune=yes").

 

Insignificant=yes

this were set to "yes" all the time in my ini file. I have tried yes and no. The AI player attacks Einsteins's Lab with both settings.

 

 

here is my definition of Einstein's Lab:

;Einsteins Lab
[CALAB]
UIName=Name:EinsteinLab
Name=Einstein's Lab
TechLevel=-1
Strength=-1
Immune=yes
CanC4=no
OmniCrushResistant=yes      ;seems to not have any effect for tanya and navy seal.
RevealToAll=yes                  ;does not work. maybe because it is captured and not build?
EligibileForAllyBuilding=yes
Insignificant=yes
Nominal=yes
Points=5
Armor=steel
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=0
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Sight=6
ClickRepairable=no
LeaveRubble=yes
RadarVisible=yes

 

Share this post


Link to post

That seems a little odd...

 

You should add these too, I think:

CanBeOccupied=no
MaxNumberOccupants=0
CanOccupyFire=no

 

Also, Strength=-1 is redundant since it is Immune=yes already. I've never used that value before myself.

Share this post


Link to post
That seems a little odd...

 

You should add these too, I think:

CanBeOccupied=no
MaxNumberOccupants=0
CanOccupyFire=no

 

I've tried it.

Unfortunately, this does not solve the problem :/

 

 

 

Share this post


Link to post
I've tried it.

Unfortunately, this does not solve the problem :/

I didn't think it would... just some codes to refine the CALAB as a tech structure.

 

I'm not seeing any errors here, it could be missing something, I haven't done any serious modding for a couple months and have fallen out of the reading-code-as-my-life nature.

The only thing I can think of is that you might have written some bad/conflicting/whatever scripts. How many AI scripts did you write for this, did you delete them all except for the last, functional, one? Did you add any excessive instructions in your script that could be unnecessary and causing this problem? Did you include units other than just the engineer in your taskforce?

 

Perhaps you could toss your Taskforce/Teamtype/Script codes up here too.

Share this post


Link to post
LegalTarget=no.

I knew I forgot one.

 

This one indeed prevents the AI Player from attacking the building, but unfortunately it also prevents the AI from capturing it with the engineer.

For me (as human player), the building is still capturable.

 

 

These are my changes in the file "aimd.ini" (just additions, I did not remove any lines):

[ScriptTypes]
;...
88=01000001-G

;ScriptType
[01000001-G]
Name=Capture Einstein Lab
0=46,8

;==========================================================

[TeamTypes]
;...
163=02000001-G

;TeamType
[02000001-G]
;This TeamType is a modification of the "Allied Tech Oil Capture" TeamType
;I only changed the following 3 attributes:
Name=Einstein Lab Capture Team
Script=01000001-G
TaskForce=03000001-G
;...

;==========================================================

[TaskForces]
;...
132=03000001-G

;TaskForce
[03000001-G]
Name=One Allied Engineer
0=1,ENGINEER
Group=-1

;==========================================================

[AITriggerTypes]
;...
09000001-G=Einstein Lab Capture Team,02000001-G,<all>,1,7,CALAB,0100000003000000000000000000000000000000000000000000000000000000,
5000.000000,5000.000000,5000.000000,1,0,0,0,<none>,1,1,1

 

I used this site as a reference:

http://modenc.renegadeprojects.com/AITriggerTypes

 

 

Share this post


Link to post

I don't recommend against using '0' for the side. I'd use '1' to signify an owner. But other than that, the AI should still capture anything with LegalTarget=no.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×