Jump to content


Photo

AI Q & A


  • Please log in to reply
111 replies to this topic

#81 Lauri

Lauri

    Let us remember foREVer

  • Hosted
  • 10,419 posts
  • Location:Norway
  • Projects:'The 4th Age' and 'Shadow and Flame'
  •  The very worst T3A Team Chamber Member

Posted 21 December 2008 - 05:08 PM

Are you playing on Easy?

Shadow and Flame BETA 0.6 RELEASED - Link


#82 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 27 December 2008 - 02:40 PM

Most weapons are fired when there is a sufficient threat around.
The values for threat can be changed.

Break dancing into the hearts of millions


#83 Spartan184

Spartan184

    :)

  • Project Team
  • 1,592 posts
  • Location:Moon
  • Projects:Random Modding Projects
  •  Coder, Map.ini Coder, Mapper, and Beta Tester

Posted 12 May 2010 - 11:02 PM

I have a question for you guys :mellow: How do I make the AI use its units more efficiently and use Upgrades like Heavy Armor more??


 

safsignature.png

 


#84 Ganon

Ganon

    What's this?

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

Posted 30 August 2011 - 09:52 PM

I know this is Necro.
But I've come to this thread many times in the past for these great AI tips.
And I'm sure many others will follow.

Now for my AI tip...

I think we've all seen how sometimes while playing in Skirmish, an AI player might get a large part of their base destroyed and they just refuse to rebuild.

Well this stems from the fact that the building system is a little bugged.
When the AI has a base that it's currently building on, it references that base as AI_CURRENT_CONSTRUCTION_SITE.

These scripts set up the reference:

e_Update Current Construction Site:
(This one initializes it)
*** IF ***
    True.
*** THEN ***
  Run Subroutine 'ee_Check Current Construction Site'.
  Run Subroutine 'ee_Set Current Construction Site'.

ee_Check Current Construction Site:
(This one checks if the base has any build plots available)
*** IF ***
     Can player Player '<This Player>' build at base Unit 'AI_CURRENT_CONSTRUCTION_SITE'
*** THEN ***
  Set Flag named 'l_Econ - Current Construction Site Buildable' to TRUE
*** ELSE ***
  Set Flag named 'l_Econ - Current Construction Site Buildable' to FALSE

ee_Set Current Construction Site:
(And this one looks for a new base owned by this player to reference as AI_CURRENT_CONSTRUCTION_SITE if the current one has no build plots left)
*** IF ***
     Flag named 'l_Econ - Current Construction Site Buildable' IS FALSE
*** THEN ***
  Run Subroutine 'ee_Check Expansion 16'.
  Run Subroutine 'ee_Check Expansion 15'.
  Run Subroutine 'ee_Check Expansion 14'.
  Run Subroutine 'ee_Check Expansion 13'.
  Run Subroutine 'ee_Check Expansion 12'.
  Run Subroutine 'ee_Check Expansion 11'.
  Run Subroutine 'ee_Check Expansion 10'.
  Run Subroutine 'ee_Check Expansion 9'.
  Run Subroutine 'ee_Check Expansion 8'.
  Run Subroutine 'ee_Check Expansion 7'.
  Run Subroutine 'ee_Check Expansion 6'.
  Run Subroutine 'ee_Check Expansion 5'.
  Run Subroutine 'ee_Check Expansion 4'.
  Run Subroutine 'ee_Check Expansion 3'.
  Run Subroutine 'ee_Check Expansion 2'.
  Run Subroutine 'ee_Check Expansion 1'.


Spot the problem?

There's no system in place to set the Flag named l_Econ - Current Construction Site Buildable to False IF the base is destroyed.

When an AI player builds an expansion such as an outpost or camp, the AI_CURRENT_CONSTRUCTION_SITE Reference is automatically placed on this new base.
But if this new base get's destroyed while it's actively building, (As in it still had some empty plots) then the reference dies with it. And the AI only knows how to build at a base with the AI_CURRENT_CONSTRUCTION_SITE reference.
Meaning the AI is unable to build at it's earlier bases because they lost the reference when the new base was built.

UNLESS it buys a new expansion somewhere. Because, again the reference is auto-placed on any new base.

The simplest way to fix this is to add 2 new scripts.
Open "ai_economy_execution.map".
And add these scripts to the same folder as the above scripts. (Should be "Economy Execution")

ee_Current Construction Destroyed:
*** IF ***
     Unit 'AI_CURRENT_CONSTRUCTION_SITE' has been destroyed.
*** THEN ***
  Set Flag named 'l_Econ - Current Construction Site Buildable' to FALSE

...

ee_Current Construction Missing:
*** IF ***
     Unit 'AI_CURRENT_CONSTRUCTION_SITE' exists and is alive.
*** THEN ***
  Null operation. (Does nothing.)
*** ELSE ***
  Set Flag named 'l_Econ - Current Construction Site Buildable' to FALSE

And that's it! :grin:

P.S. They should both have these settings:
Capture.JPG

Edited by _Bender_, 30 August 2011 - 10:26 PM.


#85 modboy451

modboy451

    A small Big-time Modder!

  • Project Team
  • 783 posts
  • Location:U.S.A
  •  Experienced INI Coder, Advanced Rigger/Binder.

Posted 20 January 2012 - 03:31 PM

What makes the AI capture the resource bases? like ones where you can build just one resource building (or an ent moot if you are Rohan)?

John 3:16 (NIV)
For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.


Psalm 23:1 (ESV)
A Psalm of David.
The LORD is my shepherd; I shall not want.


Posted Image
Posted Image
Posted Image
Posted Image

#86 Ridder Geel

Ridder Geel

    Master Yelloh

  • T3A Staff
  • 10,833 posts
  • Location:The Netherlands (AKA: Holland)
  • Projects:RC Mod + SEE + RTS Engine
  •  The Dangerous T3A Team Chamber Member
  • Division:BFME
  • Job:T3A Staff

Posted 20 January 2012 - 04:09 PM

The AI itself uses scripts in BFME 1 so if you want to edit those you need to create scripts that check if something belongs to the player, if true then attempt to build on the plot.
Ridder Geel

#87 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 16 April 2012 - 08:56 AM

Thank you past me you saved the day again.

Break dancing into the hearts of millions


#88 Meneldil

Meneldil
  • Members
  • 46 posts
  • Location:Yellowstone National Park, WY, USA

Posted 22 July 2012 - 01:59 AM

I'm attempting to do some basic AI modifications. For the moment, I wish to have new hero abilities become activated by the game AI. For example, I have a blade master ability for Boromir. It works fine when I'm playing as Gondor. Using World Builder, I have edited "lib_hero_behaviors.map" so that there is a script (based on Aragorn's) for Boromir to use this ability. Nonetheless, when playing against Gondor, Boromir fails to use his blade master ability even though he is at the proper level to use it. My initial question is this: Are there any other map files I need to modify other than this one? I have read the tutorials I could find. If there is one that addresses this specifically, I'd appreciate a link to it. Otherwise, your input would be greatly appreciated. Thanks.

#89 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 22 July 2012 - 02:44 AM

You also need to edit the hero in ai_gondor.
Add the script to the Generic tab in Team builder in " Hero - Boromir"

Break dancing into the hearts of millions


#90 Lauri

Lauri

    Let us remember foREVer

  • Hosted
  • 10,419 posts
  • Location:Norway
  • Projects:'The 4th Age' and 'Shadow and Flame'
  •  The very worst T3A Team Chamber Member

Posted 22 July 2012 - 09:47 AM

Yeah, lib_hero_behaviors only makes the preq for when it can fire, but it doesn't say who can use it. So you need to add it where Radspakr said, so the AI knows that when Boromir is on the move, Boromir will use the power when he can and the preq are correct.

Shadow and Flame BETA 0.6 RELEASED - Link


#91 Meneldil

Meneldil
  • Members
  • 46 posts
  • Location:Yellowstone National Park, WY, USA

Posted 23 July 2012 - 02:02 AM

Thank you both, Radspakr and Lauri. Your answers confirm my suspicions. I had already tried modifying my AI_Gondor file as you had indicated, but to no avail. I am not able to add this new command to Boromir’s generic tab because it doesn’t appear in the drop down menu. Please take a look at the attached file for additional details. Can you tell me what I'm doing wrong? Thanks again for your assistance.

Attached Files



#92 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 23 July 2012 - 04:30 AM

The file has to be in a big file that's read by WB.

Break dancing into the hearts of millions


#93 Lauri

Lauri

    Let us remember foREVer

  • Hosted
  • 10,419 posts
  • Location:Norway
  • Projects:'The 4th Age' and 'Shadow and Flame'
  •  The very worst T3A Team Chamber Member

Posted 23 July 2012 - 09:27 AM

What I do when dealing with the AI, is to extract the libraries.big to the main BFME folder, and then move it somewhere safe. Then the ai .maps won't be overwritten by the default ones in BFME.
Or, since you're only doing one change, you might want to try to just copy the name of the script in the hero file, then paste it into the gondor file where it should be, in Boromirs generic section. It'll work in-game. But I'm not sure if WB will accept a 'non-existing' script.. So it might not add it, it might you dissapear when you click Enter, or whatever. The first tip is always working though.

Shadow and Flame BETA 0.6 RELEASED - Link


#94 Meneldil

Meneldil
  • Members
  • 46 posts
  • Location:Yellowstone National Park, WY, USA

Posted 24 July 2012 - 01:44 AM

I'm sorry, but I don't understand. I copied the original library files and put them in another folder (not located in the program folder) where I modified them with WB. I then put the files into my FinalBIG INI file, as shown below.
libraries\ai_gondor\ai_gondor.map
libraries\lib_hero_behaviors\lib_hero_behaviors.map
libraries\lib_object_lists\lib_object_lists.map

Are you saying this is the wrong method?

I know it works at least partially because I've added Frodo, Sam, and Elrond to the game and the AI spawns them automatically and they act normally (except for not using their special abilities). I figure if I can get Boromir's new ability to automatically work, I can get theirs working, too. Would you please try again to help me understand? Thanks.

#95 Lauri

Lauri

    Let us remember foREVer

  • Hosted
  • 10,419 posts
  • Location:Norway
  • Projects:'The 4th Age' and 'Shadow and Flame'
  •  The very worst T3A Team Chamber Member

Posted 24 July 2012 - 07:02 PM

You're doing it right to work in-game, yeah, but for it to work flawless while working in WB, you'll have to do it in a different way. When you open one of your modified .maps, WB will read any imported scripts\whatnot from the ones in the main BFME folder, and Libraries.big first and foremost. So it won't be able to spot changes you've done in other files.

What I do is this;
Extract the Libraries.big into the main BFME folder, and save the .big file somewhere
Edit the files I want from there, so that WB will read all the edited files aswell
When I'm done, I take the files I've edited and place them into my mod working folder\.big, delete the rest of the extracted stuff and move Libraries.big back in place.
Or, if I'm doing alot of work, I keep it all there until I've tested it in-game and what-not.

Shadow and Flame BETA 0.6 RELEASED - Link


#96 Guest_BOO_YA_*

Guest_BOO_YA_*
  • Guests

Posted 09 August 2012 - 07:13 PM

I've tried to download the guides and such, but they all don't download. Its my internet, I can only veiw this topic and two others. I'm having to re-ype this because my net f'ed up and earased it all. But all I want to do is change the command limit and change price of some units. Could some one please (given the state of my terribly net connection) just tell me, if we can, where? Once I know where and what file and how to open that file, I can do the rest. Sorry for the inconvinece.

I've had to repost this several times now........................the page keeps failing every time i hit post........

The mod I'm using is Elven Alliance.

#97 Meneldil

Meneldil
  • Members
  • 46 posts
  • Location:Yellowstone National Park, WY, USA

Posted 11 August 2012 - 03:55 PM

I've been meaning to get back to this forum and provide an update to my previous post. I've had some other obligations and haven't had much time for this lately. Lauri, tusen takk! (I hope that's correct - thank you very much). I am now able to get the AI to make heroes use their new powers when playing against them in skirmish mode.

#98 Meneldil

Meneldil
  • Members
  • 46 posts
  • Location:Yellowstone National Park, WY, USA

Posted 11 August 2012 - 04:12 PM

Guest_BOO_YA_*:
This isn't really an AI question. However, if you just want to change the command limits in the Elven Alliance (or Elven Alliance Community Edition), open data\ini\objects\gamedata1.ini and edit the command point values you see there. As far as changing build prices, the easiest thing would be probably be to go to the unit's or horde's ini file and change the "BuildCost" value to what you want.

#99 Ganon

Ganon

    What's this?

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

Posted 08 January 2013 - 11:57 AM

I've been working on an AI mod, and something's been bothering me. In the past, I noticed that even after I deleted certain scripts from the AI, they still seemed to be working. I didn't understand the AI very well, at the time, and I figured I just missed something. And for some reason, I've been thinking that the engine wasn't capable of reading your AI scripts first, and then the vanilla ones. Being a coder, I should have known better. :whathuh:

But, I've been thinking, what if the engine treats AI scripts the same way as code? As in, if something is missing from your mod's Library files, then it just uses the vanilla ones?
That would mean that anytime you need to do away with any scripts, you can't just delete them. And that you don't want to ever rename one, without replacing it with a fake one of the old name.

I've found that the best way to deal with them, is to make them duds, like this:
*** IF ***
True.
*** THEN ***
Null operation. (Does nothing.)

And in addition, set the script as not active, and to deactivate, if somehow it did run.

It's solved my problem. I no longer have rogue scripts running. :thumbsuphappy:

Edited by Ganon, 08 January 2013 - 12:07 PM.


#100 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 08 January 2013 - 12:09 PM

It makes sense, good idea.

Break dancing into the hearts of millions





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users