modify ai tag help please!

The place to post your WML questions and answers.

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.
Post Reply
J-bros
Posts: 16
Joined: June 24th, 2011, 2:46 pm

modify ai tag help please!

Post by J-bros »

Hi all,

The trick to the scenario we're working on is for the player's ally (side 2) to delay helping the player until an event is fired. We succeeded in keeping side 2 motionless:

Code: Select all

    [side]
    	side=2
    	controller=ai
    	user_team_name= _ "Rodriguez"
    	team_name=team1
    	type=TG Highwayman
    	id=Rodriguez
    	name= _ "Rodriguez"
    	unrenamable=yes
    	{GOLD 0 0 0}
    	{INCOME 0 0 0}
    	recruit=TG Ruffian,TG Thug,TG Addict,TG Wrestler
    	[ai]
    		[avoid]
    			x=1-71
                        y=1-31
                [/avoid]
        [/ai]
    [/side]
The [avoid] tag pretty much disallows side 2's units from moving anywhere on the map (71x31 is the size of the map). :)

That works to keep side 2 from moving, but it's been trouble getting them to mobilize. :( Essentially, after a certain event is fired, I want the ai tag above to go away, allowing side 2 to do some damage. Suggestions?

Thanks as always,
J-bros
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: modify ai tag help please!

Post by Elvish_Hunter »

Use the [modify_ai] tag in that event: http://wiki.wesnoth.org/DirectActionsWM ... dify_ai.5D
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: modify ai tag help please!

Post by mattsc »

There are a number of other ways you can do this too, depending on what exactly you want. You could set controller=null for Side 2 either from the beginning (in which case I think you need to create the leader of the side manually) or in the prestart or start event. In this case, units will not do anything (not even defend themselves when attacked) and the side will not show up in the statistics either. You then change it to controller=ai for mobilizing the side.

Or, you could have an event

Code: Select all

[event]
    name=side 2 turn refresh
    first_time_only=no

    [if]
        some condition
        [then]
            {MODIFY_UNIT side=2 moves 0}
        [/then]
    [/if]
[/event]
and you make sure that 'some condition' is met at the beginning, and not met after you mobilize the side. In this case, units will not move, but they will attack enemy units that move next to them.
J-bros
Posts: 16
Joined: June 24th, 2011, 2:46 pm

Re: modify ai tag help please!

Post by J-bros »

Thanks you guys!

I took mattsc's second suggestion and it works perfectly.

J-bros
Post Reply