[SOLVED] moveto micro ai seemingly doesn't work

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
Anagkai
Posts: 50
Joined: February 12th, 2012, 10:05 am

[SOLVED] moveto micro ai seemingly doesn't work

Post by Anagkai » September 14th, 2018, 4:10 pm

I'm using a micro ai to have red mages move to villages. I'm not sure, though that it does anything, if a red mage moves onto a village which happens from time to time it seems rather random.

This is the code used, which is inside the prestart event:

Code: Select all

        [micro_ai]
			side=2
			type=Red Mage
            ai_type=goto
            action=add
            ca_id=burningvillages

            [filter]
                id=burningvillages
            [/filter]
            [filter_location]
				terrain=Gs^Vh, Ss^Vhs, Hh^Vhh
            [/filter_location]
            ca_score=350000
        [/micro_ai]
Last edited by Anagkai on September 16th, 2018, 1:52 pm, edited 1 time in total.
My campaigns: Princess Nilwyn (available) & Relocate (in dev)

mattsc
Posts: 1062
Joined: October 13th, 2010, 6:14 pm
Location: Wandering, mostly aimlessly

Re: moveto micro ai seemingly doesn't work

Post by mattsc » September 14th, 2018, 8:31 pm

You have the syntax mixed up, at least if you are trying to do what I think you want to do. Your current setup will try to move a unit with id 'burningvillages' to the terrain given in the location filter. You need to move the type=Red Mage line into the [filter] tag (and delete the id inside the tag, of course).
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on

#wesnoth-dev.2018-??-??.log:< c?????> mattsc, I think you broke Vultraz.

enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: moveto micro ai seemingly doesn't work

Post by enclave » September 15th, 2018, 1:45 pm

mattsc wrote:
September 14th, 2018, 8:31 pm
You have the syntax mixed up, at least if you are trying to do what I think you want to do. Your current setup will try to move a unit with id 'burningvillages' to the terrain given in the location filter. You need to move the type=Red Mage line into the [filter] tag (and delete the id inside the tag, of course).
in short it probably means something like this:

Code: Select all

        [micro_ai]
	    side=2
	    ai_type=goto
            action=add
            ca_id=burningvillages

            [filter]
              type=Red Mage
            [/filter]
            [filter_location]
				terrain=Gs^Vh, Ss^Vhs, Hh^Vhh
            [/filter_location]
            ca_score=350000
        [/micro_ai]
what this supposed to do if everything is right, - all red mages will go to Gs^Vh, Ss^Vhs, Hh^Vhh

given that your [micro_ai] is in the right place as well.. or that you dont have same filter doing other stuff with higher priority. Let us know if it still not works.

Anagkai
Posts: 50
Joined: February 12th, 2012, 10:05 am

Re: moveto micro ai seemingly doesn't work

Post by Anagkai » September 16th, 2018, 1:47 pm

It does work now. Thanks.
My campaigns: Princess Nilwyn (available) & Relocate (in dev)

Post Reply