[solved] Artificial Inteligence more [avoid] tags
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.
- ZombieKnight
- Posts: 283
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
[solved] Artificial Inteligence more [avoid] tags
Hi,
How to make AI units avoid some terrains, while some of them (units with micro_ai goto) could still get on those terrains?
Thats my micro_ai, and since [avoid] seems much stronger...
...
This breaks my micro_ai:
How to modify [avoid] so it's terrains are only much less preferable, but when theres no non-avoided tiles in range units could move there?
or
How to achieve similar thing without [avoid] tag?
How to make AI units avoid some terrains, while some of them (units with micro_ai goto) could still get on those terrains?
Code: Select all
[micro_ai]
side=7
ai_type=goto
action=add
ignore_enemy_at_goal=yes
ca_score=300000
[filter]
find_in=side_7_retreat_micro_ai
[/filter]
[filter_location]
x,y=36,7
radius=2
[/filter_location]
[/micro_ai]
...
This breaks my micro_ai:
Code: Select all
[modify_ai]#BREAKS retreat micro_ai
side=7
action=add
path=aspect[avoid].facet[]
[facet]
[value]
terrain=U*^*,Cud*^*
[/value]
[/facet]
[/modify_ai]
or
How to achieve similar thing without [avoid] tag?
Last edited by ZombieKnight on April 15th, 2024, 3:17 pm, edited 1 time in total.
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Artificial Inteligence question
If you want units to avoid certain terrains only when they're not using the Goto MicroAI, that's easy. Set up the avoid tag for the avoided terrains like normal. Then add an empty avoid tag in the Goto Micro AI definition. For MicroAIs that support it, an avoid tag inside their definition overrides the default avoid tag for the side, and an empty avoid tag means to avoid nothing.
Off the top of my head, I'm not sure how to make units step on specific terrains only when there is no other option.
Off the top of my head, I'm not sure how to make units step on specific terrains only when there is no other option.
- ZombieKnight
- Posts: 283
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Artificial Inteligence question
Great! I had no idea that I can do that.
Should I put [avoid] tag right inside [micro_ai] tag?
Should I put [avoid] tag right inside [micro_ai] tag?
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills
- ZombieKnight
- Posts: 283
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Artificial Inteligence question
Jup I've found it even in documentation.
Has to be: actually
Thanks for quick and simple answer!!! ^^
Has to be: actually
Code: Select all
[avoid]
[not]
[/not]
[/avoid]
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [solved] Artificial Inteligence more [avoid] tags
Yeah, you're right, you need the empty not tag as well.