Important Dates

Currently Online

Latest Posts

Topic: scenario AI

hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-12, 22:11

I'm trying to make a scenario which for me could be empires mission 3. It will show some micromanagement, seafaring and some advanced tricks like coping with limited space. my prob lem is that the AI in my scenarion (barbarian) refuses to build any military building to widen it's territory. What could have been gone wrong? While playing the map itself without scripting the AI does pretty well but not in the scenario version of the map. Where is the difference?

best regards hessenfarmer


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-11-12, 22:20

Hi,

If AI is otherwise working - building some buildings (productionsites) - this should not happen. AI is not aware of a scenario mode...


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1525
Ranking
One Elder of Players
Posted at: 2016-11-12, 22:29

maybe you set it to no ai? a player set to no ai will just stand there and do nothing, though workers will keep working.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-13, 00:42

just tested it again. in normal mode the Ai starts with building sentries. in scenario it builds just lumberjacks, forresters, quarry, wood hardener etc.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-11-13, 09:23

Can you provide savegame or anything?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-13, 16:40

yes I can provide savegame as well as the map with scripting. But first of all I will try to set up a clean installation and retry the behaviour (found out there could be a mix up of two builds). I'll keep you informed.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-13, 17:56

Just found out that when reloading a saved game the AI is almost instantly starting to build sentries. seems as if something is changed by the save. I'll do some further checks and provide the files by tomorrow evening


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-14, 21:35

ok I found out why the thing works after having saved and reload. The game adds a file "allowed_building_types" to the map files in the savegame. when I copy this file to the scenario files the scenario works fine from the beginning. therefore I think there is some problem in the script files to define the allowed buildings for the AI player. What woulld be the right lua command to allow all buildings? I have the following line in my script: p2:allow_buildings("all") where p2 is defined as wl.Game().players[2] in the init.lua. Anyhow for player 1 having this line in allows all buildings of the tribe to be build. But commenting it out for player 1 does not make any difference.

best regards hessenfarmer


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3159
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-11-15, 07:35

player:allow_buildings("all") should do it.

Without having access to your script, I guess that player 1 has a starting condition set somewhere that is taking care of this.


Busy indexing nil values

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1154
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2016-11-23, 22:30

I fixed most of my problems. Map is uploaded as "Neprun's revenge". Scenario can be activated by renaming scripting directory in the archive. Happy to receive feedback.

As this is the only thing how I can contribute except testing and bug reporting I hope this idea would eventually make it to the directory of the campaigns. (in an improved version of course)


Top Quote