Aggressive unit?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
Post Reply
User avatar
Acho161293
Posts: 31
Joined: January 29th, 2020, 10:54 am
Location: indonesian
Contact:

Aggressive unit?

Post by Acho161293 »

I made a scenario. and in that scenario on each side there is no leader. I bring up the units at each turn. but on the alliance side. they don't want to move to attack. how to get them all to be able to attack aggressively?? :doh:

User avatar
Heindal
Posts: 1037
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Aggressive unit?

Post by Heindal »

You can add this piece of code into the side you wish to attack aggressively:

Code: Select all

[ai]
            agression=1
            caution=0
            village_value=0.0
            grouping=no
            simple_targeting=yes

            {AI_SIMPLE_ALWAYS_ASPECT combat_ignore_bad_movements yes}
            {AI_SIMPLE_ALWAYS_ASPECT combat_ignore_bad_combat yes}
            {AI_SIMPLE_ALWAYS_ASPECT aggression 1.0}
            {AI_SIMPLE_ALWAYS_ASPECT caution 0}
[/ai]

This piece of code has been crafted by artisticdude.
If you need further information, just check https://wiki.wesnoth.org/AiWML.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses

User avatar
Acho161293
Posts: 31
Joined: January 29th, 2020, 10:54 am
Location: indonesian
Contact:

Re: Aggressive unit?

Post by Acho161293 »

Heindal wrote:
March 13th, 2020, 6:06 pm
You can add this piece of code into the side you wish to attack aggressively:

Code: Select all

[ai]
            agression=1
            caution=0
            village_value=0.0
            grouping=no
            simple_targeting=yes

            {AI_SIMPLE_ALWAYS_ASPECT combat_ignore_bad_movements yes}
            {AI_SIMPLE_ALWAYS_ASPECT combat_ignore_bad_combat yes}
            {AI_SIMPLE_ALWAYS_ASPECT aggression 1.0}
            {AI_SIMPLE_ALWAYS_ASPECT caution 0}
[/ai]

This piece of code has been crafted by artisticdude.
If you need further information, just check https://wiki.wesnoth.org/AiWML.
I will try it. Thanks

vghetto
Posts: 106
Joined: November 2nd, 2019, 5:12 pm

Re: Aggressive unit?

Post by vghetto »

small typo. Type in aggression=1 instead of agression=1

User avatar
Acho161293
Posts: 31
Joined: January 29th, 2020, 10:54 am
Location: indonesian
Contact:

Re: Aggressive unit?

Post by Acho161293 »

vghetto wrote:
March 17th, 2020, 10:46 pm
small typo. Type in aggression=1 instead of agression=1
it's appropriate, I tried it but there was no change in my unit.

Thanks.

User avatar
sergey
Posts: 455
Joined: January 9th, 2015, 9:25 pm

Re: Aggressive unit?

Post by sergey »

Acho161293 wrote:
March 2nd, 2020, 11:38 pm
I made a scenario. and in that scenario on each side there is no leader. I bring up the units at each turn. but on the alliance side. they don't want to move to attack. how to get them all to be able to attack aggressively?? :doh:
Do they make any moves or stay at their starting positions? Check that you have controller=ai inside of the side tag. If that doesn't help post the whole code of the side tag.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

User avatar
Acho161293
Posts: 31
Joined: January 29th, 2020, 10:54 am
Location: indonesian
Contact:

Re: Aggressive unit?

Post by Acho161293 »

sergey wrote:
March 20th, 2020, 8:03 am
Do they make any moves or stay at their starting positions? Check that you have controller=ai inside of the side tag. If that doesn't help post the whole code of the side tag.
thank you for your answer. at this moment my scenario has gone well. I added the target unit and it worked and made my unit move from its place.

I tried to put this down... :D

Code: Select all

[ai]
    [goal]
        [criteria] #NOTE: this is a SUF, because we're targeting a unit
            side=2
        [/criteria]
        value=5
    [/goal]
[/ai]
and it works well :lol:

User avatar
sergey
Posts: 455
Joined: January 9th, 2015, 9:25 pm

Re: Aggressive unit?

Post by sergey »

Oh, that makes sense. Usually AI moves units in direction to enemy leader or villages. As you said there is no leaders.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

Post Reply