How can I remove the ai_special=guardian?

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
User avatar
SL-KoL-yaN
Posts: 12
Joined: October 10th, 2013, 10:01 am

How can I remove the ai_special=guardian?

Post by SL-KoL-yaN »

Few hours ago i had a trouble. I need modify unit with ai_special=guardian ability to unit without it. I try transform unit to new type, try modify unit to ai_special=no. But it doesn't removed.

WML-code:

General fragment in code of scenario:

Code: Select all

    [event]
        name=attack
        first_time_only=no
		
        [filter]
            side=1
        [/filter]
		
        [filter_second]
            side=2
        [/filter_second]
		
        [set_variable]
            name=target_activated
            add=1
        [/set_variable]
		
        [if]
            [variable]
                name=target_activated
                equals=1
            [/variable]
			
            [then]				
                [message]
                    speaker=Alan
                    message= _ "..."
                [/message]
				
                [message]
                    speaker=Harg
                    message= _ "..."
                [/message]
            [/then]
			
            [else]
            [/else]
        [/if]
		
        [if]
            [variable]
                name=target_activated
                equals=3
            [/variable]
			
            [then]				
                [message]
                    speaker=unit
                    message= _ "..."
                [/message]
            [/then]
			
            [else]
            [/else]
        [/if]
		
        [if]
            [variable]
                name=target_activated
                equals=7
            [/variable]
			
            [then]
                {MODIFY_UNIT 
                    (
                        id=gob
                    )
                    (
                        ai_special=no
		     )
	         }

				
                [modify_ai]
                    side=2
                    action=add
                    path=aspect[aggression].facet[]
					
                    [facet]
                        value=0.55
                    [/facet]

                    action=delete
                    path=aspect[caution].facet[]
					
                    [facet]
                        value=1.0
                    [/facet]
                [/modify_ai]
				
                [objectives]
                    summary= _ "New objectives"
			
                    [objective]
                        description= _ "Retereat for river"
                        condition=win
                    [/objective]

                    [objective]
                        description= _ "Death of Alan"
                        condition=lose
                    [/objective]

                    {TURNS_RUN_OUT}

                    [gold_carryover]
                        bonus=yes
                        carryover_percentage=80
                    [/gold_carryover]
                [/objectives]
				
                [message]
                    speaker=unit
                    message= _ "..."
                [/message]
				
                [message]
                    speaker=Harg
                    message= _ "..."
                [/message]
				
                [message]
                    speaker=Alan
                    message= _ "..."
                [/message]
				
                [message]
                    speaker=Alan
                    message= _ "..."
                [/message]
            [/then]
			
            [else]
            [/else]
        [/if]
    [/event]
Macros of unit modification:

Code: Select all

#define MODIFY_UNIT FILTER_WML UPGRADE
    [modify_unit]
   
        [filter]
            {FILTER_WML}
        [/filter]
		
        {UPGRADE}
    [/modify_unit]
#enddef
Code of ai's options:

Code: Select all

        [ai]
            aggression=0.45
            caution=0.10
            village_value=0.0
        [/ai]
Questions:
0. Why removing ai_special with [modify_unit] do not working?
1.How can i remove ai_special from unit?
2.Ai_special can be only "guardian". Where i can find code of this speciality?
3. How i can create my ai_special?

P.S: Counter of variables and my macros for modification completely tested and work. But ai_special work after modification of unit.
Last edited by SL-KoL-yaN on June 13th, 2014, 8:08 am, edited 1 time in total.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How can I remove the ai_special=guardian?

Post by zookeeper »

To un-guardian a unit, you also need to clear its status.guardian key. So, in your case, this should do the job:

Code: Select all

{MODIFY_UNIT id=gob (
    ai_special=no
    [status]
        guardian=no
    [/status]
)}
P.S. See how nice

Code: Select all

 tags are? Please use them. :eng:
User avatar
SL-KoL-yaN
Posts: 12
Joined: October 10th, 2013, 10:01 am

How can I create new ai_special?

Post by SL-KoL-yaN »

Thanks for help! :D

But can you answer another question:
how can i create new my ai_special?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How can I remove the ai_special=guardian?

Post by zookeeper »

You can't; guardianing is the only use the feature has. There has simply never been any other specials added, and nowadays if you want to give units special AI behavior it'd be done via Micro AIs anyway, so ai_special is pretty much just a historical relic (although a very often used one).
User avatar
SL-KoL-yaN
Posts: 12
Joined: October 10th, 2013, 10:01 am

Re: How can I remove the ai_special=guardian?

Post by SL-KoL-yaN »

Thanks for help
Post Reply