Ay, what an AI!!
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Ay, what an AI!!
I coded this way a neutral side on an scenario.
My intention is to have a neutral side that only retreats, or at least doesn't go and attack the enemy. I also wanted to keep the leader out of the keep, so the player can use it to recruit. With these settings I get an AI that attacks the enemy, and a leader that moves away from it's original position, that is, don't know why, the keep (the keep is not in 25, 16). What am I doing wrong? I went through the documentation and follow it.
[side]
type=Mage
description=Kaliostali
user_description= _ "Kaliostali"
x = 25
y = 16
share_view=yes
side=2
canrecruit=0
gold=50
team_name=humans
[ai]
agression=-1
caution=1
leader_value=0
passive_leader=yes
[avoid]
x = 9
y = 13
[/avoid]
[/ai]
[/side]
My intention is to have a neutral side that only retreats, or at least doesn't go and attack the enemy. I also wanted to keep the leader out of the keep, so the player can use it to recruit. With these settings I get an AI that attacks the enemy, and a leader that moves away from it's original position, that is, don't know why, the keep (the keep is not in 25, 16). What am I doing wrong? I went through the documentation and follow it.
Code: Select all
[side]
type=Mage
description=Kaliostali
user_description= _ "Kaliostali"
x = 25
y = 16
share_view=yes
side=2
canrecruit=0
gold=50
team_name=humans
[ai]
agression=-1
caution=1
leader_value=0
passive_leader=yes
[avoid]
x = 9
y = 13
[/avoid]
[/ai]
[/side]
type=Mage
description=Kaliostali
user_description= _ "Kaliostali"
x = 25
y = 16
share_view=yes
side=2
canrecruit=0
gold=50
team_name=humans
[ai]
agression=-1
caution=1
leader_value=0
passive_leader=yes
[avoid]
x = 9
y = 13
[/avoid]
[/ai]
[/side]
That's ridiculous, dragons have no windows...
Re: Ay, what an AI!!
aggression=-1 means it considers its own units twice as important as the enemies, meaning it will still attack if it can do more than twice the damage it receives and not terribly expose itself (the caution).
It may help to set [target] to 0 (or lower, if possible) to all other sides.
Also, I've found that skirmishing units ignore [avoid] tags.
It may help to set [target] to 0 (or lower, if possible) to all other sides.
Also, I've found that skirmishing units ignore [avoid] tags.
Re: Ay, what an AI!!
In 1.4 it's impossible to create an AI behaving as you want it to do. The most you can achieve is one that values its units much higher than enemys and attacks very rarely and with overhelming numbers (caution and agression keys).
Pasive leader sets AI leader passive (meaning not moving), [avoid] tells it not to place units on hexes specified inside (but it will still attack enemy on them), leader value sets relative value in comparison to other units (not absolute targetting one), [target] basicaly serves the same purpose.
The most you can achieve is an AI that withdraws following a scheudle (by setting an [ai] for each turn with increasingly larger [avoid] area)
Pasive leader sets AI leader passive (meaning not moving), [avoid] tells it not to place units on hexes specified inside (but it will still attack enemy on them), leader value sets relative value in comparison to other units (not absolute targetting one), [target] basicaly serves the same purpose.
The most you can achieve is an AI that withdraws following a scheudle (by setting an [ai] for each turn with increasingly larger [avoid] area)
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
Re: Ay, what an AI!!
But if in doing this you make it so one of the AI's units cannot move anywhere not in the [avoid] area, it'll just sit there doing nothing, not retreat... at least last time I checked it was like that.Mist wrote:The most you can achieve is an AI that withdraws following a scheudle (by setting an [ai] for each turn with increasingly larger [avoid] area)
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Re: Ay, what an AI!!
True, that's why the [avoid] area can't grow rapidly, and even then you won't be able to support border case scenarios like unit stuck in ZoC or behind an impassable terrain strech. It's going to get much easier in 1.5 with formula AI and ability to modify [ai] in events.
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
Re: Ay, what an AI!!
Ok....
agression and caution can have values higher or lower that -1 to 1?
How do I define an area. I tried with
But of course, wouldn't work. Would it be like x=9,10,11... and y=1,2,3... The number of combination can be quite big as the area gets groing, not talk about big maps...
agression and caution can have values higher or lower that -1 to 1?
How do I define an area. I tried with
Code: Select all
[avoid]
x > 9
y < 11
[/avoid]
That's ridiculous, dragons have no windows...
Re: Ay, what an AI!!
You can specify the ranges with -
for example
[avoid]
x=1-10
y=1-10
[/avoid]
will tell it to avoid hexes with 1 < x and y <10
for example
[avoid]
x=1-10
y=1-10
[/avoid]
will tell it to avoid hexes with 1 < x and y <10
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
Re: Ay, what an AI!!
Also, spelling aggression with two 'g' will help wesnoth recognize the key, and set it to your preferred -1 and not 0.
Try some Multiplayer Scenarios / Campaigns
Re: Ay, what an AI!!
actually, it's .5 by default, meaning it considers the enemy's units twice as important as its own.