Trigger Via Movement?

Howdy, I’ve recently run into Vassal and this website and I’m very impressed. Thank you to the devs for putting this together!

In fiddling with my first module I’ve learned a lot but I have yet to figure out one element. I’m hoping a kind soul will point me in the right direction. I’m building a game where each time a game piece moves onto a region of the map board the region gets a +1 (player 1). The more guys you move onto the region the more +1s you get. However, other players can also move their pieces around to gain their own influence on the region. The player with more influence on the region gains control. So you can have a region with +5 (player 1) and +7 (player 2) and player 1 gets control. In other words, pretty much the same mechanic as Twilight Struggle. So, whats the problem you say?

Well, the crux of the issue is I need the trigger event to be the movement of a piece that’s already on the board as it goes from one region to another. In Twilight Struggle the trigger event is a keyboard shortcut that adds influence directly to a region. There are no movable pieces involved. That won’t do it for me here unfortunately. So, is there any way to use movement as a trigger? Are there any modules that use such a mechanic that I can study? If anyone can point me in the right direction I would sure appreciate it. Thanks.

Oh, and to whomever made the Twilight Struggle module, it’s very nicely done and I’m very jealous of your calculated property trait. I’m going to have to figure out how you got that in there.

I’ve never tried to do that and I’m not sure if this works but I know the Map Window properties has the option: “Key Command to apply to all units ending movement on this map”.

You can also create Global Properties in specific map zones as opposed to the entire mod.

I would think that with some experimenting, you could apply some sort of trigger to the game piece that would, in turn, adjust the Global Property for that zone.

hmm, I haven’t messed with global properties yet. I’ll see what I can drum up. Do you know of any modules that implements such a system?

Thanks for your help!

Instead of using movement as a trigger I created a right click option for each unit to “Garrison” a region. I used a Global Property on the zone that gets incremented when a unit Garrisons and decremented when that unit Deploys. The Global Property name is the name of the region location. So thank you Dr Nostromo for the tip. It got me going right.

To make it more fun I also added the ability to directly increase the Global Property via a right click menu on the region. So there are ways of updating the Global Property via two different game pieces (units and now the region itself).

My problem is now that I have this nifty Global Property, how do I pass it to a layer in order to show the garrison status of the region? My thinking was to use a Layer with “Levels follow Property value” but the property field does not accept a variable input. I tried using a Dynamic Property and also a Marker as an in between but they too do not accept variable inputs. So, how does one utilize a Global Property with a variable in the name?

I have a Global Property named $LocationName$_la with an integer value assigned to it based on the number of Garrisoning units. I want to get that integer out of there and apply it to a layer on the region. There has to be a way of getting it done but I’m sure having a problem seeing it. When I manually input the location name in place of $LocationName$ everything works dandy.

Anyone have any thoughts? I’d sure appreciate it.

In my module I have units and planets. Units fight for control of the planets. Each unit defending (Garrisoning) a planet increases that players influence with that particular planet. You can also add and subtract influence via cards so I also added in a right click menu on the planets to allow for direct manipulation. The guy with the most influence controls the planet. Pretty simple… or so I thought. :blush:

Now my problem, naturally, is that it doesn’t work. :frowning: I think I’ve got the right idea here but I’m screwing up on the location of the traits or some other silly mistake that I just can’t wrap my brain around. The Global Hotkeys don’t seem to be firing and well I’m getting blue in the face trying to figure it out. Does anyone have a solution or see where I screwed up? If it makes it any easier I’ve added a scaled down version of the module as a .zip to this post.

You can get it here.

Here’s what I got:

I have a unit game piece called “Mech Unit” that has the prototype “Garrison” which uses a right click menu to allow a unit to “Garrison” (CTRL-G) or “Deploy” (CTRL-H) (if already garrisoned). If either option is selected two Global Properties “CurrentPlanet” ($LocationName$) & “CurrentPlayer” ($PlayerSide$) are set via Set Global Property using “set value directly” off of CTRL-G and CTRL-H. Also, two Global Hotkeys, one for Garrison and one for Deploy, are linked to CTRL-G and CTRL-H and use CTRL Period and Shift Period respectively.

On the flip side I have an At-Start Stack game piece called “Planet” that has a prototype called “LA IP”. Just as above, this prototype sets Global Properties for CurrentPlanet ($BasicName$) & CurrentPlayer (player1). It also has two Global Hotkeys linked to a menu, one for adding influence and one for subtracting influence. These two Global Hotkeys use the same global hotkeys as above CTRL PERIOD and SHIFT PERIOD. Finally it links another Prototype called “Influence Eval”.

In Influence Eval there’s two triggers for each player, one for adding and one for subtracting influence. Each trigger listens for CTRL PERIOD and SHIFT PERIOD and only fires when “PieceName = $CurrentPlanet$ && $CurrentPlayer$ = player1 (or player2, player3, etc.)”. The triggers perform CTRL 1 for player1 +1 influence, SHIFT 1 for player1 -1 influence, CTRL 2 for player2 +1 influence, SHIFT 2 for player2 -1 influence etc. When these keys fire they increment/decrement a layer that shows the current influence total.

If anyone solves my little problem I’ll happily donate $5 to the Vassal paypal account via Sourceforge. Thanks in advance!

I downloaded your test mod and took a quick look at it.

The first thing I noticed is that you’re using the Global Hotkey trait improperly.

The GH is used to trigger something like a die roll or some other global key item that you’ve set up …like your End Turn Component uses a global hotkey. It will not trigger a Trigger Action within a piece or prototype.

Example: Regardless of what you are doing in the game, if you type ALT CTRL SHIFT Q, the turn will end. So, that’s a Global Hotkey

If you haven’t selected a piece and you type CTRL PERIOD. Nothing happens. Therefore that is NOT a global hotkey and a GH trait will not activate it.

I haven’t had time to fully comprehend what it is you want to do or help fix the problem but if you want to meet on line through Skype, send me an E-mail and we’ll set up a time. That way I can get an idea of exactly what you want to do and assist in getting it functioning right.

Cool graphics, btw!

unfortunately there is zero documentation on the Global Hotkey feature so I was making a guess. Perhaps a Global Key Command would be a better solution? I will certainly send you an e-mail. Thanks