I want to add a couple of features to the game I am working on that I don’t think Vassal supports so I am going to code them in.
I want to be able to bring up a window for a chit and mark how many battles it has been in by checking a box. Once a certain number of boxes have been checked I want to chit to either display a V for veteran or become darker, for fatigued.
The second is a better fog of war system. I want units to be invisible to the other player unless they are adjacent to them.
I understand Vassal is written in Java but I need to know where I can find the code that handles the properties window as well as invisible attributes. Or, if those are the wrong places to code in these features, I’d appreciate being pointed in the right direction.
Thanks in advance,
This seems like a rather cumbersome way of doing this. Wouldn’t it be better to just have a display on the piece showing the number of battles it’s been in, along with adjusters (like an up and down arrow) and then have the piece display it’s status? …and the status would change automatically under certain conditions.
Something like this is easily done in Vassal and far easier to accomplish then to try and tie in a separate window with check marks. I can post a sample, if you like.
I’ve never worked with invisible pieces so this is out of my experience but I’m sure someone knows how to do this with the current tools available.
The problem with having a ticker on the chit is the chits are rather small. If I expand them to include the buttons to increase and decrees the number of battles the chit becomes too large. I could have a small number showing the number of battles participated in off to one side, that would prevent having to go into properties just to see how fatigued a unit is.
You said both of these were possible without coding? How so?
The controls (up / down buttons) wouldn’t be necessary …you could just right-click the piece and have menu options to raise / lower the kill count. That will save you a bit of real estate on the piece. I’ll make a sample and post it …should only take a few minutes.
Here’s a sample. If you click the up / down arrows, this will adjust the kill count in the upper left. For every 5 kills, the unit’s rack increases. The kill count can also be adjusted by right-clicking the unit and selecting from a menu.
This is NOT a zip package but the actual mod file. Change the .zip extension to .vmod
That actually should work. Thank you!
Ok, snag. I got the Kill count and everything to work like it should. Then I tried making it a prototype and adding it together with other prototypes to make a new unit and now it won’t work. Is there something special I need to know about using this within prototypes?
In this order your prototype should have (from the example mod)
Dynamic Property - Kills
Trigger Action - Decrease Kill count
Trigger Action - Increase Kill count
Action Button - Decrease Kills
Action Button - Increase Kills
Provided you’ve got all that and have matched the keys and property names
exactly (including capitalization) should work fine - there is nothing
special about this being/not being in a prototype
[mailto:email@example.com] On Behalf Of DonMegel
Sent: Friday, September 02, 2011 8:52 PM
Subject: [messages] [General Discussion] Re: Coding New Features
Ok, snag. I got the Kill count and everything to work like it should.
Then I tried making it a prototype and adding it together with other
prototypes to make a new unit and now it won’t work. Is there something
special I need to know about using this within prototypes?
Read this topic online here:
If that doesn’t work right, you might try keeping the Dynamic Property trait on each piece. I’ve had trouble in the past with putting Dynamic Properties in prototypes. It could have been something I wasn’t doing right but I’ve personally just gotten into the habit of keeping DP’s on the piece.
Ok, I got it work as a prototype, I had some values wrong. Can I add another counter system? Say, one for Battles fought and for Fatigue level?
You mean another layer …one to show Battles Fought and one to show Fatigue? Sure, you can do that.
Check out this thread here. It includes an enhanced sample of what I attached to this thread using 2 layers instead of just one.