Limit AI player to a given area?
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.
Limit AI player to a given area?
Is it possible to limit an AI player to a given area so he can't wander off?
Ideally with the possibility to remove that limitation later on during the game with an event.
Ideally with the possibility to remove that limitation later on during the game with an event.
Re: Limit AI player to a given area?
Yes, it is possible by using the micro AIs with thekurt751 wrote:Is it possible to limit an AI player to a given area so he can't wander off?
Ideally with the possibility to remove that limitation later on during the game with an event.
[filter_location]
tag, depending on what you want your ai-units to perform. You can also delete it in a later event.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Re: Limit AI player to a given area?
There's an easier solution. Just use the [avoid] tag on all locations where you don't want it to go.
Re: Limit AI player to a given area?
Hm, interesting. I haven't played with the MicroAIs yet, and I see some cool stuff there. I'll have to experiment a little with it.SkyOne wrote:Yes, it is possible by using the micro AIs with the[filter_location]
tag, depending on what you want your ai-units to perform.
You can also delete it in a later event.
That been said I didn't see anything which would help in my case, where I just want the AI player to do his usual stuff, but stay inside a given area.
Re: Limit AI player to a given area?
Uh. It's a 120x120 map...Dugi wrote:There's an easier solution. Just use the [avoid] tag on all locations where you don't want it to go.
But I guess I could make some uncrossable "borders" by just blocking the hexes leading from the "allowed" to the "forbidden" areas. And place some unpassable mountains. That might work just fine, but can I change the AI during the game (after turn 10, for instance)?
Besides, is there an easy way to gather all the hexes to put in the tag? I mean besides pen, paper and lots of time?...
Re: Limit AI player to a given area?
You can use in filtering things like x=15-83
Re: Limit AI player to a given area?
What do you mean?Ravana wrote:You can use in filtering things like x=15-83
Re: Limit AI player to a given area?
You can simply write:
to prevent it from entering the area 37-68,12-42.
Code: Select all
[ai]
[avoid]
x=37-68
y=12-42
[/avoid]
[/ai]
Re: Limit AI player to a given area?
That would work for a square area; The problem my areas are really not square...Dugi wrote:to prevent it from entering the area 37-68,12-42.
Re: Limit AI player to a given area?
You can use [or] [not] and [and] tags to compose it. Of course, if the area is really irregular, you might have to stick with terrain types.kurt751 wrote:That would work for a square area; The problem my areas are really not square...Dugi wrote:...
Re: Limit AI player to a given area?
Terrain types? Uh-oh, that would be even more complicated.Dugi wrote:You can use [or] [not] and [and] tags to compose it. Of course, if the area is really irregular, you might have to stick with terrain types.
But the booleans might work, by assembling small pieces.
What's the proper syntax to use them? Something like that?
Code: Select all
[ai]
[avoid]
x=x-y
y=x-y
[and]
x=x-y
y=x-y
[/avoid]
[/ai]
Re: Limit AI player to a given area?
Close tags too, [/and].
Re: Limit AI player to a given area?
Code: Select all
[ai]
[avoid]
x=1-120
y=15-24
[and]
x=1-120
y=56-73
[/and]
[/avoid]
[/ai]
Re: Limit AI player to a given area?
Great! Thanks both of you!