ai_special=guardian seems don't works [solve]
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.
ai_special=guardian seems don't works [solve]
Hi, it's me again 
An other problem with my WML code.
I've a bridge, and I create 2 unit near to this bridge to "defend" the acces. For that I try to use "ai_special=guardian" but...
I try two different way :
("Engeance" is a created unit witch works correclty, I don't thinks the problem is here)
TRY NUM 1 :
And next :
And TRY NUM 2
Your help is welcome ! 

An other problem with my WML code.
I've a bridge, and I create 2 unit near to this bridge to "defend" the acces. For that I try to use "ai_special=guardian" but...
I try two different way :
("Engeance" is a created unit witch works correclty, I don't thinks the problem is here)
TRY NUM 1 :
Code: Select all
(In the SIDE section)
{NAMED_GENERIC_UNIT 2 Engeance 45 6 garde1 "Garde du pont"}
{NAMED_GENERIC_UNIT 2 Engeance 46 8 garde2 "Garde du pont"}
Code: Select all
[event]
name=prestart
[objectives]
#objectives are defined here
[/objectives]
# Modification of the two guards to made them static
[modify_unit]
[filter]
id=garde1, garde2
[/filter]
# hitpoints=5
ai_special=guardian
[/modify_unit]
[/event]
Code: Select all
# Units --> protect the bridge
[unit]
side=2
type="Engeance"
id=garde1
name"Garde du Pont"
x=45
y=6
random_traits=yes
ai_special=guardian
[/unit]
[unit]
side=2
type="Engeance"
id=garde2
name="Garde du Pont"
x=46
y=8
random_traits=yes
ai_special=guardian
[/unit]

Last edited by Cluric on October 15th, 2012, 8:47 am, edited 2 times in total.
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Re: ai_special=guardian seems don't works
But what ? Which behavior do you expect exactly ?Cluric wrote: I've a bridge, and I create 2 unit near to this bridge to "defend" the acces. For that I try to use "ai_special=guardian" but...
Friendly,
HowTos: WML filtering, WML variables
Re: ai_special=guardian seems don't works
Well I wanted these units no longer move. But when I run the script, they move as soon as I approach to them
I hear about the GUARDIAN Macro, so I modify the first code like this :
Then the units still move 
I link the stderr file, if It can help (however I don't think so because messages seem to have nothing to do with the topic
I hear about the GUARDIAN Macro, so I modify the first code like this :
Code: Select all
# Units --> protect the bridge
{NAMED_GENERIC_UNIT 2 Engeance 45 6 garde1 "Garde du pont"}
{GUARDIAN}
{NAMED_GENERIC_UNIT 2 Engeance 46 8 garde2 "Garde du pont"}
{GUARDIAN}

I link the stderr file, if It can help (however I don't think so because messages seem to have nothing to do with the topic
Battle for Wesnoth v1.10.1
Started on Mon Oct 15 10:13:17 2012
Automatically found a possible data directory at C:/Users/Fred/Desktop/Wesnoth
Data directory: C:/Users/Fred/Desktop/Wesnoth
User configuration directory: C:/Users/Fred/Documents/My Games/Wesnoth1.10
User data directory: C:/Users/Fred/Documents/My Games/Wesnoth1.10
Cache directory: C:/Users/Fred/Documents/My Games/Wesnoth1.10/cache
Checking video mode: 1024x768x32...
setting mode to 1024x768x32
20121015 10:13:21 error filesystem: Trying to open file with empty name.
20121015 10:13:31 warning unit: Unknown attribute 'genre' discarded.
20121015 10:13:31 warning unit: Unknown attribute 'recruitment_ignore_bad_combat' discarded.
20121015 10:13:31 warning unit: Unknown attribute 'recruitment_ignore_bad_combat' discarded.
20121015 10:13:32 warning unit: Unknown attribute 'recruitment_ignore_bad_combat' discarded.
20121015 10:13:48 error ai/actions: Return value of AI ACTION was not checked. This may cause bugs!
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: ai_special=guardian seems don't works
Because ai_special=guardian does not block the unit. It merely stops it from moving until it can attack an enemy unit.Cluric wrote:Then the units still move
If you want to completely forbid a unit to move, you need to set its max_moves to 0. You have several ways:
1) modify directly the max_moves variable, either while creating the unit, or with [store_unit], or with [modify_unit]:
Code: Select all
{NAMED_GENERIC_UNIT 2 Engeance 45 6 garde1 "Garde du pont"}
[+unit]
moves=0
max_moves=0
[/unit]
Code: Select all
{NAMED_GENERIC_UNIT 2 Engeance 45 6 garde1 "Garde du pont"}
[+unit]
[modifications]
[object]
duration=forever
silent=yes
[effect]
apply_to=movement
set=0
[/effect]
[/object]
[/modifications]
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)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: ai_special=guardian seems don't works
Okay, once again it was me who had misunderstood what I thought to. I know however, that the code does exactly what it says, and yet I always come back crying "does not work, help me" 
Thank you for your detailed response, I will test it immediately.
EDIT : Fine, your code works on the first try ! I make a macro for reuse in the future, it's perfect

Thank you for your detailed response, I will test it immediately.
EDIT : Fine, your code works on the first try ! I make a macro for reuse in the future, it's perfect
Re: ai_special=guardian seems don't works [solve]
Ah, I see...
Put "passive_leader=yes", please, on your file of this one: http://forums.wesnoth.org/viewtopic.php ... 26#p539826 I edited it as "no" because I thought you wanted the leader, Chef Trolloc, to behave like the ai_special=guardian. (but you probably did it already, I guess.) Elvish_Hunter probably recommends to do the first one on my post, though.
You can actually use the same thread to ask multiple questions by editing the topic title & adding sub-titles if necessary. (zookeeper doesn't mind AFaIK because he is a nice person, but ex-Forum Emperor mentioned it, and I support his opinions on the forums...)
(this post has been edited to add words.)
Put "passive_leader=yes", please, on your file of this one: http://forums.wesnoth.org/viewtopic.php ... 26#p539826 I edited it as "no" because I thought you wanted the leader, Chef Trolloc, to behave like the ai_special=guardian. (but you probably did it already, I guess.) Elvish_Hunter probably recommends to do the first one on my post, though.
You can actually use the same thread to ask multiple questions by editing the topic title & adding sub-titles if necessary. (zookeeper doesn't mind AFaIK because he is a nice person, but ex-Forum Emperor mentioned it, and I support his opinions on the forums...)
(this post has been edited to add words.)
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