# How to get a hex terrain-based zoc propagation working?

**URL:** <https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723>\
**Category:** Module Design\
**Created:** [June 14, 2020, 4:47am UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723 "2020-06-14T04:47:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 14, 2020, 4:47am UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/1 "2020-06-14T04:47:37Z")

</div>

Here’s the situation:

Hex grid, every hex already has a terrain-specific hex-shaped piece in it.

Zone of control from a piece extends 2-3 hexes away from the piece, but only along some types of terrain - not water.

To visualise this for the player, I’m trying to set up a command to view/clear the zoc. Something isn’t working, but I’m not sure what.

The view zoc command is simply a GKC zoccomm with a fixed range of 1, looking for a property zoc==0

Each applicable terrain piece has the following traits from bottom up:

DP zoc = 0, with a key command zocprop+1 to increment  
AoE with a range of 0 toggled by key zoc  
Trigger when zoc==0, triggers zoc, zocprop+1, zoccomm1  
GKC activated by zoccomm1, sends zoctrig1 to property zoc==0 at range 1  
Trigger when zoc==0, triggers zoc, zocprop+1, zoccomm2  
GKC activated by zoccomm2, sends zoctrig2 to property zoc==0 at range 1  
Trigger when zoc==0, triggers zoc

This should(?) propagate the command 3 hexes along only the correct terrain, along lines of terrain that haven’t already been triggered, but nothing happens.

Any tips? Ideas?

---

<div class="post-metadata">

**Author:** ![Tim\_M](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/tim_m/32/2_2.png) [@Tim\_M](https://forum.vassalengine.org/u/Tim_M)\
**Post date:** [June 14, 2020, 5:24am UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/2 "2020-06-14T05:24:16Z")

</div>

I think your going to find a big headache here. I did hex specific pieces once - wasnt worth it.  
How do you control the formula? On what axis? Perhaps 2 are true but 4 are not (if you are using hexes…). It becomes very complex. How do you tell/ show this. Area of effect would be the one thing that comes to my mind as a visual display tool if it matches your formula criteria

---

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 14, 2020, 5:42am UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/3 "2020-06-14T05:42:39Z")

</div>

All 6 axes, no control needed other than the fact that the blocking terrain has no triggers and is unaffected.

---

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 15, 2020, 8:53pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/4 "2020-06-15T20:53:49Z")

</div>

OK, odd thing: I have kind of got this working, using exactly the traits I posted above, and it works better as 2 hexes than 3 (which is fine), but the command propagates in some odd inexplicable patterns.

![](https://i.ibb.co/jbTF0Hp/Antiquity-ZOC.png)

Each of those red zones should extend from 2 hexes from the white-bordered pieces, excluding water, but _sometimes_ only extends one hex. The terrain is all from the same prototype and should function identically.

Is there some command propagation limit going on? But if so, the tiny 3-hex zone on the bottom right makes no sense.

Two other zones hemmed in by water worked fine, while all the other mostly open zones are missing hexes.

I just can’t think of any way to explain this behaviour.

---

<div class="post-metadata">

**Author:** ![Cattlesquat](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/cattlesquat/32/241_2.png) [@Cattlesquat](https://forum.vassalengine.org/u/Cattlesquat)\
**Post date:** [June 16, 2020, 3:09pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/5 "2020-06-16T15:09:15Z")

</div>

The algorithm you’ve roughly described “should work” in general terms. Which means that there’s probably something minor wrong in the details of your implementation, or how “range” is being calculated.

---

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 16, 2020, 5:13pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/6 "2020-06-16T17:13:59Z")

</div>

…or there’s a bug in Vassal. There’s no way I can conceive of for the outcomes I screenshotted to all be possible.

---

<div class="post-metadata">

**Author:** ![Cattlesquat](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/cattlesquat/32/241_2.png) [@Cattlesquat](https://forum.vassalengine.org/u/Cattlesquat)\
**Post date:** [June 16, 2020, 5:53pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/7 "2020-06-16T17:53:01Z")

</div>

Well, “no way I can conceive” is actually a pretty standard mental state in debugging code, right before the part where I actually find the bug. 😃

The best approach is probably to put in a whole lot of Report traits that show the “progress” of one of these – who thinks it’s sending a GCK, what GCK does it think it’s sending, who thinks it’s receiving a GCK, what does it think the state is when it receives it, etc, etc, etc.

---

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 16, 2020, 8:00pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/8 "2020-06-16T20:00:47Z")

</div>

Oh, I think I have an answer.

First GKC at range 1  
Hex 1 at range 1 completes the trigger, does AoE, sends the second GKC, hexes at range 1 _from hex 1_ do AoE.  
Hex 2 at range 1 is one of the hexes already triggered by the second GKC above, so is no longer a valid target for the first GKC.

This would explain most of the patterns above, and maybe even the tiny 3-hex result if the origin hex somehow triggered first.

Thanks for the nudge. I’m too quick to assume Vassal is buggy.

---

<div class="post-metadata">

**Author:** ![Benkyo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/benkyo/32/3289_2.png) [@Benkyo](https://forum.vassalengine.org/u/Benkyo)\
**Post date:** [June 16, 2020, 8:54pm UTC](https://forum.vassalengine.org/t/how-to-get-a-hex-terrain-based-zoc-propagation-working/10723/9 "2020-06-16T20:54:02Z")

</div>

The solution is not to have conditions for the GKCs or triggers at all, and to not use zocprop as described. You do need a DP to prevent AoE from being turned off once it is on, but that’s all it is for.

…now I can start work on the hard stuff.
