Hey all, been a while but I've decided to get back into the MTW2 modding scene. Since I lost most of my progress on my (very basic) levy script, I've decided to try again but with a different angle on the functionality. As an aside, I know Alpaca was working on a levy script for Italia Invicta but decided to cancel it (the script), so I'm wondering what made him swear off of it as well. Anyway...

In my previous attempt, the concept was that the player would construct a special building called a "Muster Call", which had several levels each incurring a large upfront cost to construct and a small upkeep to maintain. The concept was that when destroyed, a number of units would spawn around the settlement in question whose composition would be based on the quality of the Muster building, the presence of other military buildings in the settlement, and finally the traits of the governor.

If I recall last time, the issue was that it was hard (if not impossible) to get the script to fire off on the destruction of a building in a particular settlement (there were some other issues, mostly related to my lack of familiarity with Total War's script commands). Given that constraint and my relative noobishness, I've decided to try again on a slightly different tack.

The same general principle applies, players build a "Muster Call" building, only this time, the script keeps track of how many turns that building has been active and awards units every turn (and subtracts cash) until the building is destroyed. I'd still like to have the army composition rely on the buildings in the settlement, and since I've scaled back scope of the concept a bit to deal only with the "main" cities of each nation, I think the code should be a bit more manageable (only have to write 16 versions instead of 400).

My first goal is to get a lil' test off the ground. The pseudocode (as far as I can determine) is as follows;
Code:
LOGIC
;event end of the turn
;and Capital Settlement belongs to Player
;and muster_call building exists within settlement
;        increment muster_counter
;        if muster_counter > 1
;            spawn some peasant level armies around capital
;        if muster_counter > 2
;            spawn some militia level armies around capital
;        if muster_counter > 3
;            spawn some sergeant level armies around capital
;        if settlement has a governor with command > 2
;            spawn some decent soldiers
;        if muster_counter > 2 and settlement has stable structure
;            spawn some basic cavalry
;        subtract (muster_counter * 2000) from player account
Anyone have any pointers to help me on my way? I must confess that I've completely forgotten the logic for checking building existence in a settlement as well as character traits, etc. so much help is needed.

(also reposted some of this over on twcenter)