First shot at triggers, math?

Hey guys,

I’m trying to set up a trigger where basically, if morale comes below a certain point the unit is said to be in rebellion. I’m setting this up with triggers, basically. My question is can I perform math on variables within the “Trigger when properties match”

Morale * 4 < $Population$ is my current thing and its not working. am I missing something?

Unless you have the CP trait not yet as Brent has said this is coming with the new beanshell stuff (should be part of it I think).
But there is a work around if you dont have CP or can’t wait by using 2 triggers and 2 DP’s

The first DP is the value of Morale
The second DP we will call MoraleTotal with a value of 0

What you do is have the 1st trigger execute 4 identical keys which increments the value of MoraleTotal by $Morale$ (thus 4x Morale),
Then have the 2nd trigger do the comparison of $MoraleTotal$ < $Population$, do whatever then RESET the DP $MoraleTotal$ back to 0 so you can use it again later on etc…

From: Furyofaseraph messages@forums.vassalengine.org
To: messages@forums.vassalengine.org
Sent: Friday, April 3, 2009 11:33:39 AM
Subject: [Module Design]First shot at triggers, math?

Hey guys,

I’m trying to set up a trigger where basically, if morale comes below a certain point the unit is said to be in rebellion. I’m setting this up with triggers, basically. My question is can I perform math on variables within the “Trigger when properties match”

Code:
Morale * 4 < $Population$

is my current thing and its not working. am I missing something?


"Remember: there once was a time in the evolution of all things that work, when it did not." ~ Leo McGarry (John Spencer)


Messages mailing list
Messages@forums.vassalengine.org (Messages@forums.vassalengine.org)
http://forums.vassalengine.org/mailman/listinfo/messages_forums.vassalengine.org

Post generated using Mail2Forum (mail2forum.com)

Forgive my ignorance. The CP trait? is that a custom java class from somewhere or is it part of beancounter in the 3.2

I think by CP trait, he’s referring to Calculated Property and, from what I understand, that will be available in future versions of Vassal.

Personally, I’m very excited about that feature as well as the features of using “names” to trigger things instead of strictly using key commands and combining variable. It’ll make things so much easier.