Author Topic: Glest AI  (Read 1099 times)

mockrocker

  • Guest
Glest AI
« on: 19 March 2010, 11:48:09 »
Is it possible to turn off the AI in scenario completely? I'm trying to create a scenario where the two opposing factions will not attack each other unless I require them to.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Glest AI
« Reply #1 on: 19 March 2010, 13:01:05 »
Yes, I'm pretty sure you can do that with Lua, but you'll have to wait for someone with more Lua experience to reply, to tell you how to do it.
Egypt Remastered!

Proof: Owner of glest@mail.com

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest AI
« Reply #2 on: 19 March 2010, 16:13:33 »
Yes you can see here:



<?xml version="1.0" standalone="yes" ?>
<scenario>
<difficulty value="2"/>
<players>
   <player control="human" faction="goths" team="1"/>--0
   <player control="cpu"  faction="aztec" team="3"/>--1
   <player control="cpu" faction="goths" team="3"/>--2
   <player control="cpu" faction="goths" team="3"/>--3
</players>
<map value="booing"/>
<tileset value="desert"/>
<tech-tree value="vbros_pack_5"/>
   <default-resources value="true"/>   
   <default-units value="false"/>
   <default-victory-conditions value="false"/>
   <scripts>
      <startup>
         --disable AI
         disableAi(1)
         disableAi(2)
         disableAi(3)
         disableAi(0)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

mockrocker

  • Guest
Re: Glest AI
« Reply #3 on: 19 March 2010, 16:58:25 »
Yeah that works but when an opposing faction get close to another faction, it automatically attacks. What I want is to prevent AI from attacking even when they are close to each other unless otherwise instructed.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest AI
« Reply #4 on: 19 March 2010, 18:57:23 »
A more indepth bit:

Firstly, you will need to know the basics to scripting. You can see that here. Now, the command used to stop an AI is:
Code: (lau) [Select]
disableAi(#)The number is the faction number, which is INDEXED (starts at 0). For example:

The first player control mentioned, EVEN IF IT IS CLOSED, is faction 0, the next is 1, and so on.

However...
where the two opposing factions will not attack each other unless I require them to.
That will be tricky (impossible?). There is a way to disable the AI, but no way to renable them, meaning you'd have a crappy ai if they are attacked (ie, if their base is attacked, the individual units must be able to see the attackers, while normally if you attack one person, that ai will know and send its forces out to get you).

Guess GAE/MegaGlest should improve that by making disableAi a toggle command... (or maybe enableAi?).
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert