Jump to content


Photo

How do I make the Rohan AI unable to build Entmoots?


  • Please log in to reply
3 replies to this topic

#1 Baki

Baki

    title available

  • Project Team
  • 357 posts
  • Location:Germany
  • Projects:TDH AI

Posted 20 December 2011 - 03:03 AM

Well the topic title already says everything. Hopefully someone who already messed with the AI in his/their respective mod can help me in this matter.
I also have a problem that is quite similar to the one above, it's about a building you can build on the economy plot in addition to the already existing resource structures.
So my question is where (in which file) do I have to change the AI behavior concerning those economy plot structures? The problem is that the AI builds that new building on ALL economy plots and what I want to do is to make the AI only build it on a few occasions.
Hopefully my text wasn't too confusing and you understood what I meant. :rolleyes:
Posted Image

#2 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 23 January 2012 - 10:45 AM

I think I may have found the solution.

Lookie here:
*** IF ***
      4000  is Less Than or Equal the number of credits possessed by Player '<This Player>'
    *AND*  Unit 'ECON_FLAG_16' is unpackable for the player: Player '<This Player>'.
*** THEN ***
  Unpack the base: Unit 'ECON_FLAG_16'and reference it as UnitRef 'AI_ECON_PLOT_16'.
*** IF ***
      4000  is Greater Than the number of credits possessed by Player '<This Player>'
    *AND*  Unit 'ECON_FLAG_16' is unpackable for the player: Player '<This Player>'.
*** THEN ***
   Unit 'ECON_FLAG_16' use Ability 'Command_UnpackExplicitRohanFarm'.

If you look at the code, the two unpack buttons are coded differently:
CommandButton Command_ConstructEntMoot
  Command          = CASTLE_UNPACK
  Object           = EntMoot
  TextLabel        = CONTROLBAR:ConstructEntMoot
  ButtonImage      = BREntMoot
  ButtonBorderType = BUILD ; Identifier for the User as to what kind of button this is
  DescriptLabel    = CONTROLBAR:ToolTipEntMoot
  Radial           = Yes  
End
CommandButton Command_UnpackExplicitRohanFarm
  Command          = CASTLE_UNPACK_EXPLICIT_OBJECT
  TextLabel        = CONTROLBAR:UnpackRohanFarm
  Object           = RohanFarmMultiplayer
  ButtonImage      = BCFarm 
  ButtonBorderType = BUILD ; Identifier for the User as to what kind of button this is
  DescriptLabel    = CONTROLBAR:ToolTipRohanFarmUnpack
  Radial           = Yes
End

Now then, if you look, the button to unpack a moot is a "CASTLE_UNPACK", and the one for the farm is a "CASTLE_UNPACK_EXPLICIT_OBJECT".

This seems to directly correspond to the AI scripts.
*** THEN ***
  Unpack the base: Unit 'ECON_FLAG_16'and reference it as UnitRef 'AI_ECON_PLOT_16'.
*** THEN ***
   Unit 'ECON_FLAG_16' use Ability 'Command_UnpackExplicitRohanFarm'.


I think these may be the scripts you need to edit. In "ai_rohan.map".
Meaning, remove all the ones that don't build a farm.

If that doesn't fix your problem, let me know, and I can look into it some more. :good:

As for your second question, you should be able to just modify the conditions of these scripts to check how many instances of the building there are already. And decide from there whether another one should be built.

Edited by Ganon, 23 January 2012 - 11:20 AM.


#3 Baki

Baki

    title available

  • Project Team
  • 357 posts
  • Location:Germany
  • Projects:TDH AI

Posted 22 March 2012 - 01:00 PM

Problem solved.
Thanks Ganon.

Edited by Baki, 29 March 2012 - 08:40 PM.

Posted Image

#4 numan

numan
  • Members
  • 82 posts

Posted 12 January 2016 - 01:35 AM

Hi guys. I want to ask something under this topic. I give infinite money to AI. So, rohan builds entmoot at the begining of game. It makes nearly 20 ent. How can I make rohan build  entmoot at mid or late game (not in early game) ? Also rohan must build less entmoot.


Edited by numan, 12 January 2016 - 01:37 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users