Zone of Control

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
Wecth
Posts: 13
Joined: April 14th, 2023, 9:07 am

Zone of Control

Post by Wecth »

Anyone know how to increase zones of control. For example if I wanted an unit to have a radius 2 zone of control how would I go about doing it.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2358
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Zone of Control

Post by Lord-Knightmare »

Dont think it's possible

Code: Select all

zoc: if "yes" the unit will have a zone of control regardless of level. If present but set to anything other than "yes," the unit will have no zone of control. If the tag is omitted, zone of control is dictated by unit level (level 0 = no zoc, level 1+ = has zoc).
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: Zone of Control

Post by Toranks »

With events everything is possible
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Zone of Control

Post by beetlenaut »

Wecth wrote: April 15th, 2023, 1:46 pm how would I go about doing it
There is more than one way, but this is how I would do it. I would put an enter_hex event in this unit's [unit_type] tag. This is what the event would do:
  • store_locations that are two hexes away from enemy units of this type
  • use find_in to see if the moving unit has entered one of those hexes
  • if yes, set the moving unit's movement points to zero
  • [allow_undo][/allow_undo] (Don't forget this or undo will always be blocked if one of these units is on the screen.)
Code following this idea could be sped up a lot by moving the store_locations to a separate event that is not called so often, but this is how I would start.

Hopefully, that answers the question.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply