Question regarding WML, Shroud, fog and AI.

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

Question regarding WML, Shroud, fog and AI.

Post by Ewok »

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:

[side]
type=Noble Youth
description=Prince Luthor
user_description= _"Prince Luthor"
unrenamable=yes
side=1
canrecruit=1
controller=human
recruit=
gold=100
team_name=Luthor
shroud=yes
[/side]

[side]
type=Commander
side=2
no_leader=yes
team_name=Orcs
fog=yes
shroud=yes
[/side]

I'm placing the units in the prestart event.
[unit]
type=Spearman
side=2
x=21
y=51
[/unit]

What am I doing wrong?
"Luck is also a skill"
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

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
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

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.
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

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

Post by Ewok »

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

Post by Ewok »

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"
bruno
Inactive Developer
Posts: 293
Joined: June 26th, 2005, 8:39 pm
Contact:

Post by bruno »

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.
Nyxl
Posts: 25
Joined: February 12th, 2006, 6:21 pm
Contact:

Post by Nyxl »

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