Change AI cheat mulitpliers in console?

Talk about general things concerning Forged Alliance Forever.

Moderators: FtXCommando, Ze Dogfather

Change AI cheat mulitpliers in console?

Postby swaaye » 06 Oct 2018, 23:09

Is there a way to change the AI cheat mulitpliers within the console during a game? I've always wanted to mess around with that towards the end of a game. :)
swaaye
 
Posts: 8
Joined: 24 Jan 2017, 07:45
Has liked: 0 time
Been liked: 0 time
FAF User Name: swaaye

Re: Change AI cheat mulitpliers in console?

Postby Uveso » 07 Oct 2018, 10:30

Hello swaaye,

there is no way to change the cheat multipliers from the console.
That's not how it works.

If you set a cheat multiplier, then every unit gets a cheat buff on unit creation. (Unit.lua -> OnCreate)

If you want to change the cheat multiplier while playing, you need to loop over every unit, remove the old cheat buff and apply a new buff with your new cheat multipliers.
This can only be done with a (sim) mod.

If you want to make this with a mod (in case you are a LUA coder) your script should do:

1. loop over every unit and remove the cheat buff
Code: Select all
Buff.lua.RemoveBuff(unit, 'CheatIncome', true)
Buff.lua.RemoveBuff(unit, 'CheatBuildRate', true)

2. Set a new cheat factor for eco and buildspeed.
Code: Select all
ScenarioInfo.Options.BuildMult = 2.0
ScenarioInfo.Options.CheatMult = 2.0

3. Call the function SetupCheat to set the new values
Code: Select all
aiutilities.lua.SetupCheat(aiBrain, true)

4. loop over every unit and add the new cheat buff
Code: Select all
Buff.lua.ApplyBuff(unit, 'CheatIncome')
Buff.lua.ApplyBuff(unit, 'CheatBuildRate')

Done.
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Change AI cheat mulitpliers in console?

Postby swaaye » 08 Oct 2018, 06:58

Ah well that's fairly complicated. Thanks for the information.
swaaye
 
Posts: 8
Joined: 24 Jan 2017, 07:45
Has liked: 0 time
Been liked: 0 time
FAF User Name: swaaye

Re: Change AI cheat mulitpliers in console?

Postby Franck83 » 08 Oct 2018, 08:42

Once can make a mod (sim one) with a slider to change cheat level during game.

Otherwise, it could be cool to have a AI mode with dynamic cheat level. If a human player takes a big eco or military lead, AI could increase its cheat level.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Change AI cheat mulitpliers in console?

Postby Uveso » 08 Oct 2018, 17:11

We should have a thread for "Ideas for AI mods". :)

@swaaye:
Since this is a AI related topic, please visit our new "AI" forum section:
viewforum.php?f=88

There you can make a "AI Mod request".
Maybe you will get a standalone mod for it, or i will include this in my new AI.
(btw. did you already played against my AI ?)
viewtopic.php?f=88&t=16381

[Edit] You should also try Franck83's "Alliance of Heroes" Mod. :mrgreen:
viewtopic.php?f=41&t=14919
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest