Question regarding WML, Shroud, fog and AI.

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
Posts: 3
Joined: December 9th, 2005, 12:44 pm
Location: Sweden

Question regarding WML, Shroud, fog and AI.

Post by Ewok » December 9th, 2005, 1:11 pm

I'm making a scenario, where I want my character find a object. The enemy should try and hunt my character. The problem is as follows.

I want my characters to search for the object. Thus I use shroud. I also don't want my characters to know where the enemy are, unless they can see them, hence I use fog. This works fine.

I want my enemy to try and find my characters. So I use Shroud and fog on them. The problem is, this doesn't work. They always knows where I am.

The thing is I don't use any leaders, just sides. Here is the code:

type=Noble Youth
description=Prince Luthor
user_description= _"Prince Luthor"


I'm placing the units in the prestart event.

What am I doing wrong?
"Luck is also a skill"

User avatar
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas

Post by turin » December 9th, 2005, 1:17 pm

The AI can't handle fog and shroud, so it ignores them even if you give it to them.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

User avatar
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper » December 9th, 2005, 1:33 pm

It would be possible to just have the AI move its units around randomly, and use a sighted event to spot when they see you, at which point the AI units would be flipped to another AI side which does something useful (like attacks).

Another way would be to place idle AI units randomly around the map at the beginning and when the player runs into one, have them flip to an active side.

Those are the two ways I can think of to simulate how you want it to work, although the WML for random movement is probably not very simple (but I think Flight to Freedom does something like it). Not sure if such behaviour would work for your scenario well enough, though. But in any case, if I've understood correctly, in whatever way you do this, it will work so that either the player or the AI sees the other one (at random places with pretty much random units), after which the AI starts to actively pursue the player.

Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott » December 9th, 2005, 1:47 pm

You can set the guardian AI and combine it with the random wandering WML. Guardian units won't attack until you get close to them.
Hope springs eternal.
Wesnoth acronym guide.

Posts: 3
Joined: December 9th, 2005, 12:44 pm
Location: Sweden

Post by Ewok » December 9th, 2005, 2:01 pm

Thanks for the answears.

I believe that the solution is found, but I will be open to other suggestions.
I think I'll divide the units into a couple of different sides, making search partys that travel in group, with the guardian ability.

/Your friendly neighbourhood Ewok
"Luck is also a skill"

Posts: 3
Joined: December 9th, 2005, 12:44 pm
Location: Sweden

Post by Ewok » December 9th, 2005, 5:29 pm

How exactly am I supposed to set a target for a unit.
I used
goto_x = x0
goto_y = y0
in the unit tag. They still don't move to x0,y0.
They move after my characters.
Is there another way of setting a unit to move to a certain position.

/Your friendly neighbourhood Ewok
"Luck is also a skill"

Inactive Developer
Posts: 293
Joined: June 26th, 2005, 8:39 pm

Post by bruno » December 10th, 2005, 1:55 pm

You need to provide starting locations for the leaders you have defined or use no_leader=yes. You can add units using the [unit] tag under [side] instead of during a prestart event. Unless you are doing something tricky, this is the preferred method of placing units.

Posts: 25
Joined: February 12th, 2006, 6:21 pm

Post by Nyxl » April 18th, 2006, 9:10 pm

Greetings. I'm taking advantage of this topic to ask a question about fog, too.

I'm trying to find a way to use an event to remove the fog for one side. I've investigated the problem a little and found that the [change_side/] tag does not allow to change the value of the "fog" parameter.

So, this far, I have two solutions : either I don't use fog (therefore I don't have that problem) and rely on shroud to approximate the wanted effect, either I start fidgeting with [set_variable/] with all stored units of target side, changing their unit.side variable to the value of a non-foggy side.

I find both solutions silly or unclean. Have anyone among you a better idea (and by better I mean "closer to a [change_side/] operation") ?

Post Reply