How to make AI use for a custom fraction ??

Everything about mods can be found here.

Moderator: Morax

How to make AI use for a custom fraction ??

Postby Mavr390 » 27 Nov 2019, 09:26

Hi guys!!!
I`m created custom fraction, but I don’t know how to make AI use it.
Please tell me how to do this.
Mavr390
 
Posts: 5
Joined: 26 Oct 2019, 07:54
Has liked: 2 times
Been liked: 0 time
FAF User Name: Mavr390

Re: How to make AI use for a custom fraction ??

Postby ZLO_RD » 27 Nov 2019, 10:25

http://www.youtube.com/user/dimatularus
http://www.twitch.tv/zlo_rd
TA4Life: "At the very least we are not slaves to the UI"
User avatar
ZLO_RD
Supreme Commander
 
Posts: 2209
Joined: 27 Oct 2011, 13:57
Location: Russia, Tula
Has liked: 295 times
Been liked: 380 times
FAF User Name: ZLO

Re: How to make AI use for a custom fraction ??

Postby Uveso » 28 Nov 2019, 00:27

Hello Mavr,

you only need unitplatoons to make the AI using your custom units.

You can use Nomads as example.

Here is the AIR platoon file for nomads:
https://github.com/FAForever/nomads/blo ... plates.lua

In line 129 starts the table for air scout units as example:
https://github.com/FAForever/nomads/blo ... s.lua#L129

Nomads is added simply as 5. table.
In case you want your own air scout unit used from the AI simply add it to the table.
If you new Faction has the name "Marver" and your airscout has the unitID "ABC1234" then you need to add this table:
Code: Select all
        Marver = {
            { 'abc1234', 1, 1, 'scout', 'GrowthFormation' }
        },

Now if the AI plays the faction Marver and it want to build an Air scout it will know that your air scout has the unitID ABC1234 and will build it.

Thats all :)
User avatar
Uveso
Supreme Commander
 
Posts: 1651
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 64 times
Been liked: 261 times
FAF User Name: Uveso

Re: How to make AI use for a custom fraction ??

Postby Mavr390 » 28 Nov 2019, 04:25

Hi Uveso!
I did as you said, but when the game starts, ACU appears and does not move. What and where should I add to the code so that it behaves like other ACU ???
Mavr390
 
Posts: 5
Joined: 26 Oct 2019, 07:54
Has liked: 2 times
Been liked: 0 time
FAF User Name: Mavr390

Re: How to make AI use for a custom fraction ??

Postby Uveso » 28 Nov 2019, 04:59

Hard to say.

First i hope you have no errors inside the error log.
Any error can prevent the ACU from moving!

Normaly the AI starts to use the ACU with the Initial platoon builder.

As example:
If you start a game with an AI Rush then the AI will choose the "Land Rush Initial ACU Builders"
https://github.com/FAForever/fa/blob/de ... s.lua#L215

This platoon builder will build the first factory and energy:
https://github.com/FAForever/fa/blob/de ... s.lua#L232

This platoonbuilder will also add a special function called "CommanderBehaviorImproved":
https://github.com/FAForever/fa/blob/de ... s.lua#L221

This function will control the ACU for fighting and moving in case the ACU is not building something.
User avatar
Uveso
Supreme Commander
 
Posts: 1651
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 64 times
Been liked: 261 times
FAF User Name: Uveso

Re: How to make AI use for a custom fraction ??

Postby Mavr390 » 28 Nov 2019, 10:46

Uveso, i not have errors in the log.
I`m tested and stock AI and Sorian AI. Аll that you showed, I found in stock AI code and Sorian AI code, but nothing has changed.
Maybe I haven’t added anything to the stock code yet?
Mavr390
 
Posts: 5
Joined: 26 Oct 2019, 07:54
Has liked: 2 times
Been liked: 0 time
FAF User Name: Mavr390


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest