"Patrol" command in WML
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.
"Patrol" command in WML
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...
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...
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:
jg
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]
-
- Posts: 80
- Joined: December 10th, 2005, 10:50 pm
- Location: Inside My PC
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.
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.