passive_leader Question
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.
passive_leader Question
I'm attemtping to create a side 2 leader that simply sits there until your hero moves next to him, at which point they will talk. The problem I am having is that the side 2 leader keeps wandering off. In the side 2 [side] tag I have the following:
which I think is the correct code? I wonder if the fact that I change his keep into grassland in the pre-start event is interfering with the passive_leader tag? Anyone with good success using passive_leader in 1.1.1?
- b.
Code: Select all
[ai]
passive_leader=yes
[/ai]
- b.
La perfection est atteinte non quand il ne reste rien àajouter, mais quand il ne reste rien àenlever. - Antoine de Saint Exupery (of course)
I'm not sure about passive_leader, except that I once had some similar problems with it. More reliable would be to use ai_algorithm=idle_ai, but that would make the whole side be completely idle, which might not be what you want. Other way could be to put a name=side turn event which sets the movement points (unit.moves) of the unit to 0 every time it's side is about to take it's turn.
Re: passive_leader Question
Try this:
Works fine. You can surround the innards with an [if] statement if you want to turn it off after a point. If you don't want it to recruit, you would have to remember to adjust its gold too. I haven't tested it with a leader, but I assume it would still try to recruit.
Code: Select all
[event]
name=side turn
[store_unit]
variable=passive_store
[filter]
description=leadername
[/filter]
[/store_unit]
{VARIABLE passive_store.moves 0}
[unstore_unit]
variable=passive_store
[/unstore_unit]
{CLEAR_VARIABLE passive_store}
[/event]
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
Well, I thought it worked like a charm. The leader still moves and attacks. The actual code that I use in my scenario is:
Adding a debug message and a first_time_only=no. The game reports his movement as 0 at the beginning of his side turn, but he still moves and attacks. I may have to resort to idle_ai...
- b.
Code: Select all
[event]
name=side turn
first_time_only=no
[store_unit]
variable=passive_store
[filter]
description=Ukark
[/filter]
[/store_unit]
{VARIABLE passive_store.moves 0}
{DEBUG_MSG $passive_store.moves}
[unstore_unit]
variable=passive_store
[/unstore_unit]
{CLEAR_VARIABLE passive_store}
[/event]
- b.
La perfection est atteinte non quand il ne reste rien àajouter, mais quand il ne reste rien àenlever. - Antoine de Saint Exupery (of course)
I think so. I thought it was working for me on Gryphon Mountain, but I must be mistaken. The movement is wiped out and then immediately restored due to how side_turn works. Sorry.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
To disable the movement of your leader, you can do something like this :
He will be still able to attack...
Code: Select all
[event]
name=prestart
[object]
silent=yes
[filter]
description=Ukark
[/filter]
[effect]
apply_to=movement
set=0
[/effect]
[/object]
[/event]
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
The first thing won't work. The second thing is correct.Elvish Pillager wrote:Set his current moves in a side turn event. Last I checked, units with 0 moves crash the game.
I'm trying to see if changing goto_x and goto_y work. A recent bugfix makes these work for AI units.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
So if you set goto_x and goto_y to his current location in a side turn event, he'll still move?
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.