Counting and indicating controlled regions

Hello

How do I total the number or regions controlled by individual factions?

I have "at start’ pieces on my map for each region. They have layers that can be changed to show which faction is controlling the region. I want to count the regions controlled be each faction, similar to counting pieces for each side, however as the indicator in each layer representing control is an image and not a piece I can’t add a marker and global key command. I thought of creating a prototype, but still ran into the same problem as the layer will only allow images.

The other issue is selecting the faction for each region. Currently I have to use the keyboard CTRL/Shift keys to scroll through an unseen faction list until I get the image I want. What I would like to have is the factions all displayed in a drop down box on the piece so I can select the one I want directly, I just haven’t been able to figure out how.

Any advice?

Best regards
Col

Hi, the marker in this case would be the layer level or the level’s name. Click the help button for the Layer trait and on the bottom of the help page you’ll find a list of properties attached to it. So (from the help example) all the pieces set to Manpower_Level=4 can be totaled, etc.

For the right-click selection… you could use a dynamic property with a prompt list and the layer set to expression value, or a sub-menu trait. I’ll run through the latter. Besides the sub-menu, you’d also add a trigger action for every level designated in the layer (which will do the scrolling for you). The faction layer itself would have no menu commands, always active, advFactionLayer (or whatever) as its increase level key, and setFactionLayer as its reset to level 1 key. Each trigger action would have the faction name as its menu command, a key command and identical watch key, and then perform keys that match the steps required to reach that level. For example, the third level in the layer would be set with these perform keys:

setFactionLayer
advFactionLayer
advFactionLayer

Finally, give the sub-menu an appropriate menu command, then add the trigger action names into it. Hope that helps.

Hi RRVS

Thanks for the reply, apologies for being slow in getting back.

T’ll work through these and write back if I have any problems.

Regards
Col

Hi RRVS

Apologies, I’m completely lost with this. I have my “At-Start stack” with a single piece. Could you step e through what to add to be able to sum the number of regions controlled by each faction.

Best regards
Col

Hey, yeah, so I was riffing on the “number of total pieces on map” method mentioned earlier, adjusting it to tally each faction layer level (rather than every piece). So rather than looking for “Count = 1” it would look for Manpower_Level=4 or whatever. That would tally all the pieces set to that level (or faction), and would need to be done for each faction. The toolbar buttons could all be compiled into one multi-action button (to tally all factions at once), or even hidden altogether and adjusted automatically with each change of a faction layer (if say you wanted to have text pieces on the map noting the current counts that are always adjusted automatically). To do the latter you’d just add hide the final multi-action button itself (which if I recall correctly is done simply by not having a name for it), and have its hotkey sent out to it after any change to a faction layer (on any piece) is made.

Anyway, let’s say your factions pieces have an always active faction layer (named: FactionLayer) covering three factions, and four levels in that layer depicted as: blank (no faction), dwarves, hobbits, elves. So level 1 shows nobody controlling the area, while level three of the faction layer shows hobbits controlling the area.

So this would be the map pieces total method rewritten for hobbits :

Totaling the Number of Hobbit Factions on a Map

  1. Create a Global Property called HobbitTotal.
  2. For the new Global Property, create a Change-Property button called ZeroHobbitTotal that will set HobbitTotal to 0 (In Type, choose Set Value Directly).
  3. [not needed, as the marker will be the layer level]
  4. Create a Set Global Property Trait on each piece, which will increment HobbitTotal by 1.
  5. Create a Global Key Command called TotalHobbitFactions. For Global Key Command, use the keyboard shortcut of the Set Global Property Trait you specified in Step 4, and in Matching Properties, enter FactionLayer_Level = 3.
  6. Create a Toolbar Action Button called HobbitReport. In Display Message, and enter Total Hobbit factions: $HobbitTotal$.
  7. Create a Multi-Action Button called Faction Totals, and add the ZeroHobbitTotal, TotalHobbitFactions, and HobbitReport buttons to it.
    Now, when the Multi-Action Button is clicked, HobbitTotal will first be zeroed out (to remove any previous totals), then each piece will add 1 to the HobbitTotal, and the Action Button will report the total in the chat window.

You can then add the remaining factions to the multi-action button as well.

Hope I got all that right, but quite possible not… so anything not working or not explained well, just ask.

Hi RRVS

Yeh, sorry, I don’t seem to be able to get it to work, don’t know why. Also, don’t understand the FactionLayer_Level = 3 part

“FactionLayer” was my example name, just to be clear on that. It’d be substituted out for whatever the layer’s actual name is. FactionLayer_Level = 3 means that layer is active on that piece and is currently set to level 3. It’s basically just a dynamic property for that piece, guided by the layer. So if FactionLayer_Level=3 was true, then FactionLayer_Active=true and FactionLayer_Level != 2 would also both be true. The wiki page via the help button lists all the available properties tied to layers, all which help in singling these pieces out for various things.

But maybe I misunderstood your initial post. I assumed a piece with one layer that had several levels to it, each level indicating a different faction. Do you have multiple layers in each piece, and how do they work in indicating what faction is in control?

If you do have multiple layers (rather than one layer w/multiple levels), with an active layer indicating faction control, then you could have HobbitLayer_Active=true (again as an example name). All these properties can act like the “count=1” marker (from the original ‘totaling pieces on a map’ example) in totaling pieces faction by faction.

Hope that’s better explained. And you get it working. If I’m misunderstanding the set-up of these pieces (and/or their layers) or you know what part of the totaling might be off, let me know.

Apologies for getting back slowly.

I’ve attached a screenshot of what I have done
On the left is the Module Editor list of at start stacks, for example, “Control Gangani” which has a grid coordinate on a map. (not shown)

I have highlighted a single piece called “Control-level” which has been opened on the right of the Module Editor. It has the traits basic piece and a prototype called “Control - Level”. This prototype trait is shown open in the next panel below the single piece.

The trait of concern is the one called “Layer - Control Faction”, which I have opened

There are 18 images attached here, one for each faction and one for no control. I have highlighted image 2, with the level name “Aquitani”

Hm, I don’t see the attached image for some reason.

This sounds fine… 18 levels then in an always active layer called: Layer - Control Faction, if I’m getting that right.

There may be an easier way to do this, for that many factions at least, but I’m not coming up with one at the moment. And with 17 factions, compiling them all into a single multi-action button might be too much happening at once, I don’t know, but worth it to try imo.

  1. Create 17 Global Properties, one for each faction’s total (I’ll use ‘AquitaniTotal’ as my example), initial value 0, numeric: 0 min, 100 max.

  2. For each of those, create a Change-Property button that will set its total to 0 (In Type, choose Set Value Directly). (So one named ZeroAquitaniTotal will set AquitaniTotal to 0).

  3. Make a new prototype called: FactionGlobals, and add 17 ‘Set Global Property’ Traits into it, which will each increment its total by 1. For example, AquitaniTotal, numeric checked 0-100, no menu command name, key command: RaiseFactionGlobal, increment numeric value by 1. Place the FactionGlobals prototype into your Control - Level prototype.

  4. Create 17 Global Key Commands (one being: TotalAquitaniFaction). For each Key Command, use RaiseFactionGlobal, and in Matching Properties enter its faction layer name (so my example being: “Layer - Control Faction_Name = Aquitani”

  5. Create a Multi-Action Button called Faction Totals, and add all 17 button names from #2 (one being: ZeroAquitaniTotal) and then below those all 17 GKCs from #4 (one being TotalAquitaniFaction).

  6. Create one Toolbar Action Button called AquitaniReport. In Display Message, enter “The Aquitani faction controls $AquitaniTotal$ regions.” Add AquitaniReport to the bottom of the multi-action button list from # 5. [The other 16 factions will need their own Toolbar Action buttons made up and plugged into the multi-action button, but I’m just testing one for now]

Give it a try and see if it properly reports the Aquitani faction total. (I’ll try reading through this again later myself to see if there’s any mistakes I may have made above).

Thanks for this and apologies once again for the slow reply. I’m working on this one step at a time and will advise the results.