"Patrol" command in WML

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
jg
Posts: 244
Joined: September 12th, 2005, 7:17 am

"Patrol" command in WML

Post by jg »

A command in which you could make a unit patrol a certain area. You give the coordinates (in the WML-text) and in the game the unit would move. If you have played Freeciv, you probably know what I mean.

This would be nice, so that you could make a patrol go around a keep, or area, as long as they find another unit.

jg

P.S: Sorry if this was proposed/exists already...
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Well, this can be done purely in WML already, so I don't see a need to write that kind of an option to the engine directly.
jg
Posts: 244
Joined: September 12th, 2005, 7:17 am

Post by jg »

OH?! This probably has to be moved into the WML workshop then.

In case you undestood me wrong, then something like this is what I meant:

Code: Select all

[patrol]
  [filter]
  type=Spearman
  side=2
  [/filter]
  x=2,3,4,5,4,3,2
  y=2,3,4,5,4,3,2
[/patrol]
jg
CuddleFish
Posts: 80
Joined: December 10th, 2005, 10:50 pm
Location: Inside My PC

Post by CuddleFish »

well.... unless this is something for the AI player... its not very useful

in MP fog is insignificant.... and in no fog maps people can see everything anyway.... recon in wesnoth is not that important
"Quantity has a quality of its own" Joesph Stalin
jg
Posts: 244
Joined: September 12th, 2005, 7:17 am

Post by jg »

Well I think it is kind-of, since if you develope a campaign, you could sometime use something like that.

IMHO I actually think it could be quite useful sometimes.

And now that I thought about it, I remembered that it is possible to probably do it with macros.

jg
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

You can do it in WML...
use the guardian AI and create a variable about when the unit is patrolling or not.
Then you need triggers that change the state if enemy units gets inside the patroling route (or near)
If not disturbed move the unit "by hand" and change its movement to zero. (easier if you only set 2 points where the unit will stand every other turn)
If disturbed change variable and the ai_special to something else and then let the AI to manage it.
You also need to be carefull to check that the destination tile is also free from allied units and manage it somehow (find and empy tile of just wait to next turn).
You can package all of this in a nice macro...

{PATROL $unit,$x,$y,$x2,$y2,$trigger1}

soo you can reyuse it easily.
Post Reply